Difference between -Os and -O2

Georg-Johann Lay avr@gjlay.de
Mon Apr 27 06:44:00 GMT 2009

Hieu Le Trung schrieb:
> Hi,
> I wonder what is the different between -Os and -O2 and where can I find
> more information relating to this.

Add -fverbose-asm to gcc's command line and have a look at the generated 
gcc output, i.e. the assembler code in the .s file. You can get the asm 
file by specifying -save-temps or by assembling only (-S, no -c).

Maybe the target supports -frecord-gcc-switches and you can find the 
command line/switches induced in some section of the object file (and, 
of course, in that case in the assembler, too).


More information about the Gcc-help mailing list