Considering that I'm building GCC from source + mpfr, gmp, mpc, libelf and binutils, is it a good idea to change the optimization flags like so
CFLAGS="-O3" CXXFLAGS="-O3" ./configure
while configuring GCC or any of the other software?
I have a c2duo.
EDIT: I'm worried about the fact that these flags could change the behaviour of those programs/libs.
There are two things which you can do:
If you're natively bootstrapping, you can do a full, and complete profile guided bootstrap. This will build the compiler and dependencies with a bootstrapped compiler providing the third round with the profile information it can use to optimize itself. After configure, do make profiledbootstrap. Note you can place the dependencies and stuff likke binutils and gdb inside the gcc source tree, and they should be built as well in the process.
If you don't want to go through a long profiled bootstrap process, set CFLAGS, CXXFLAGS, CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET, etc. at GCC configure time to:
-O2 -flto -march=core2
And set LDFLAGS and LDFLAGS_FOR_TARGET to
-flto
This will optimize the most and safest stuff.
Note that all this trouble will probably only result in a tiny speedup in the final executable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With