Changes

Jump to: navigation, search

SPO600 Compiled C Lab

214 bytes added, 00:13, 5 September 2014
Lab 2
--source # (implies -d) show source code, if available, along with disassembly
4. Try to gain a basic understanding of what the compiled code is doing. Focus on the section marked <main> but also take a look at the other sections.
5. Recompile the code with these changes:
(4) Add additional arguments to the <code>printf()</code> function in 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 functionnamed <code>output()</code>, and call that function from <code>main()</code>. Explain the changes in the object code.
(6) Remove <code>-O0</code> and add <code>-O3</code> to the gcc options. Note and explain the difference in the compiled code.
6. Blog about your results. Important! -- explain what you're doing so that a reader coming across your blog post understands the context(in other words, don't just jump into a discussion of optimization results -- give your post some 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!}}

Navigation menu