Hi Anders, Anders Dahlqvist [ 7.04.2002 13:52:25 +0200]:
I want to build my rpms with gcc and g++ using the -O3 flag.
You don't want to do that, believe me ;-) -O3 *only* switches on automatic inlining for *C* code and on a register poor architecture like ia32 the resulting register pressure will usually result in worse performance. So I'd really advise to stay away from -O3. There are other flags that do help more than -O3 but usually don't apply globally (like fast-math or loop unrolling). Look at arch/i386/Makefile in the kernel sources to get an idea of what to use (just keep in mind that -fomit-frame-pointer makes debugging impossible and that -mpreferred-stack-boundary only makes sense for the kernel).
I've tried setting CFLAGS and CXXFLAGS to -O3, but this value gets overriddenby the default value -O2, even if I use the --target=$(uname -m) (in my case i686) option wirth rpm.
So set the value in /usr/lib/rpmrc ;-)
Of course I could use sed to replace -O2 in the source code with -O3, and I have, but this is time-consuming for larger chunks of code such as qt3.
And specially for C++ code like qt3 '-O3' will buy you nothing at all. cheers Philipp