Changes

Jump to: navigation, search

SPO600 Compiled C Lab

118 bytes added, 12:35, 17 January 2014
Lab 2
}
2. Compile the program using the GCC compiler. Include these compiler options(refer to the gcc manpage for details):
-g # enable debugging information
4. Try to gain a basic understanding of what the compiled code is doing.
5. Recompile the code with these changes and note the effect --:
(1) Add the compiler option <code>-static</code>. Note and explain the change in size, section headers, and the function call.
(2) Remove the compiler option <code>-fno-builtins</code>. Note and explain the change in the function call.
(3) Remove the compiler option <code>-g</code>. Note and explain the change in size, section headers, and disassembly output.
(4) Add additional arguments to the <code>printf()</code> function in the your program. Note which register each argument is placed in. (Tip: Use sequential integer arguments after the first string argument. Go up to 10 arguments and note the pattern).
(5) Move the <code>printf()</code> call to a separate function, and call that function from <code>main()</code>. Explain the changes in the object code.
6. Blog about your results. Important! -- explain what you're doing so that a reader coming across your blog post understands the context.
{{Admon/tip|Make|Learn how to use [[Make and Makefiles|make]] -- your life as a programmer will be much easier, and you'll get back years of your life!}}
== External Resources ==
* For a general overview of ELF, see the Wikipedia article on [http://en.wikipedia.org/wiki/Executable_and_Linkable_Format Executable and Linkable Format]

Navigation menu