This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: why "only" -O optimization for building gcc?

Jonathan Thornburg <> writes:
>The gcc build instructions   install/build.html  say (in 2.95.2)
>> <p>If you want to save additional space during the bootstrap and in
>> the final installation as well, you can build the compiler binaries
>> without debugging information with "make CFLAGS='-O' LIBCFLAGS='-g
>> -O2' LIBCXXFLAGS='-g -O2 -fno-implicit-templates' bootstrap".  This will save
>> roughly 40% of disk space both for the bootstrap and the final
>Is there some deep reason why the instructions don't suggest using
>higher optimization for compiling gcc itself (and also the library), eg
>   make CFLAGS='-O9' LIBCFLAGS='-g -O9' \
>        LIBCXXFLAGS='-g -O9 -fno-implicit-templates' \
>        bootstrap
>This obviously makes for a slower and more memory-intensive build, but
>I'd expect it to yield a faster and maybe smaller gcc binary.  Is there
>a hidden gotcha here?

Well the only higher -O level that does anything is -O3, and IRRC all 
that does is inline functions, so that would make code bigger and 
may not make it faster as cache and paging issues mean inlining is not 
always a win.

>If not, perhaps the build instructions should say something about higher
>optimization levels?
Nick Ing-Simmons <>
Via, but not speaking for: Texas Instruments Ltd.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]