-O or -g on gcc linker frontend?

Gerhard Theurich gtheurich@sgi.com
Thu Jun 22 16:57:00 GMT 2006


Hi All,

For a while now I have been wondering if the gcc linker frontend cares knowing 
about -g or -O flags. Let's say I have an object file a.o and I want to link it 
into an executable a.out using gcc I can just say:
     gcc a.o
But I can also use debug or optimization flags:
     gcc -g a.o
     gcc -O2 a.o
     ....
Does the gcc linker frontend care about these flags or are they simply ignored? 
Is it generally advisable to use some consistent set of -g/-O flags during 
linkage compared to what was used during compilation of the objects (what if the 
objects where compiled with different options)?

Thanks for any advice!
-Gerhard



More information about the Gcc-help mailing list