cc/c++ optimizations

Robert Connolly robert at linuxfromscratch.org
Thu Nov 11 17:15:30 PST 2004


This is just a tidbit for you optimizations nuts. Some packages, like bzip2 or 
QT don't respect enviroment CFLAGS. To force something like -march for gcc 
and g++ we can hack the gcc specs.

vi `gcc --print-file specs`

Scroll down to this (this might be different on non-x86 platforms):

*cc1:
%(cc1_cpu) %{profile:-p}

And replace that with this:

*cc1:
%(cc1_cpu) %{profile:-p} %{!no-march: -mtune=athlon -march=athlon }

Note the spaces can be important. -O2 can be added but not -pipe. Experiment 
if you like. This works for me on all packages, so far. You can also hard 
code this into gcc by editing gcc/config/i386/linux.h around line 93 and gcc 
will use it in a make bootstrap.

robert



More information about the lfs-chat mailing list