Lab 2 – Compiled C Lab

This lab will investigate the differences in compiler options by compiling a simple “Hello World” program. The changes for each GCC compiler option can affect the size, lines of code, the execution of code, the use of libraries, and so on.


(1) Add the compiler option -static.
Note and explain the change in size, section headers, and the function call.

The –static option links a program statically and prevents the use of using shared libraries, making the file much larger than without the option. The other change is that <_IO_printf> is called instead, again also due to the -static option.

(2) Remove the compiler option -fno-builtin.  Note and explain the change in the function call.

The difference with removing this compiler option is that it calls put() instead of printf(). According to , the -fno-builtin “results in code is often both smaller and faster, but since the function calls no longer appear as such, you cannot set a breakpoint on those calls, nor can you change the behavior of the functions by linking with a different library.” Without it, it seems that put() is called by default here.

(3) Remove the compiler option -g. Note and explain the change in size, section headers, and disassembly output.

Removing the compiler option -g results in a smaller sized file, which makes sense since the debugging information is removed.

(4) Add additional arguments to the printf() 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).

The arguments put into the printf function add some data stored into registers. It seems like some arguments have their own register and others have their own.

(5) Move the printf() call to a separate function named output(), and call that function from main(). Explain the changes in the object code.

The difference here is that the <main> calls <output>, which in turn calls the printf in the code.

(6) Remove -O0 and add -O3 to the gcc options. Note and explain the difference in the compiled code.

Changing from -O0 to –O3 is supposed to have a higher level of optimization – meaning the program should run faster, according to The mov $0x0,%eax is changed to xor %eax,%eax.



Lab 1 – Code Review Lab

This lab is designed to explore the code review processes used in open source projects/communities.

(1) GCC

Testing patches for submission: 

changes to backend or c/c++ frontend – complete build of GCC and runtime libraries on at least one target. complete bootstrap on all default languages and run all testsuites. (make bootstrap; make -k check; will accomplish this)

changes to front end – perform complete bootstrap.

test exactly the change that is intended for submission

Submitting patches:

  • Description of problem/bug and how patch addresses this
  • Testcases
  • ChangeLog
  • Bootstrapping and testing
  • the patch itself

Bundled into mail message and sent to appropriate mailing list(s)

GCC 6 Release Series (6.2) Patch

Participants and role

Problem Report and users involved listed here ->

issues discussed (and resolved)

aside from problem report above, specific targeted issues:

  • Support for –with-cpu-32 and –with-cpu-64 configure options have been added on bi-architecture platforms
  • Support for the SPARC M7(Niagara 7) processor has been added.
  • Support for the VIS 4.0 instruction set has been added

(2) VirtualBox

Testing/Submitting patches for submission:

The technical documentation can be accessed to get source code and submit patches via its own hosted website. More information detailing how to contribute can be found directly here: .

However, one of two things must be done before contributing to VirtualBox

  1. Fill out the Contributor’s Agreement (CA) and send it to Oracle. With the CA, you give Oracle permission to use your contribution under licenses other than the main VirtualBox license. This is a once-in-a-lifetime event: once we have your CA, we will never again ask you to undergo any bureaucratic procedures, and all future contributions are covered.
  2. If you don’t want to sign such an agreement, you can alternatively submit your contribution under the MIT license. This is a liberal, wide-spread Open Source license that allows Oracle (and anyone else) to use your contribution in both open-source and closed-source projects.