View previous topic :: View next topic |
Author |
Message |
Biker Apprentice
Joined: 11 Jun 2003 Posts: 170 Location: A very dark, cold and moisty place...
|
Posted: Thu Jun 19, 2003 6:34 pm Post subject: make.conf says -O3 but kernel compiles with -O2 |
|
|
My CFLAGS in make.conf contains "-O3". The full bootstrap process compiled with "-O3".
Still, the kernel compile insists on using "-O2".
'tis "working as designed"?
If so, why?
If not, how do I correct this?
Gus |
|
Back to top |
|
|
dberkholz Retired Dev
Joined: 18 Mar 2003 Posts: 1008 Location: Minneapolis, MN, USA
|
Posted: Thu Jun 19, 2003 8:00 pm Post subject: |
|
|
The kernel has its own set of CFLAGS. /usr/src/linux/Makefile wrote: | HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer |
|
|
Back to top |
|
|
DrkPlague Tux's lil' helper
Joined: 04 Jun 2003 Posts: 107
|
Posted: Thu Jun 19, 2003 9:16 pm Post subject: |
|
|
this is done for a reason. certain things such as the kernal and heavily used libs like glibc specify their own cflags to achieve what they consider to be optimal performance.
Also, i am pretty sure that specifying -O3 on kernel would prevent ANY debugging of programs, which is probably a bad idea. my advice is that the flags were put there for a reason and unless you are a kernel dev, don't touch them. _________________ DKP
There are 10 kinds of people in the world:
Those who understand binary and those who don't... |
|
Back to top |
|
|
qubex Tux's lil' helper
Joined: 06 Mar 2003 Posts: 133 Location: Portland
|
Posted: Fri Jun 20, 2003 11:16 am Post subject: |
|
|
Yeah, messing with kernel optimizations is bad, m'kay? If you try and optimize your kernel with -O3, you're bad, m'kay?
Seriously though, your kernel is the foundation of your system - why mess with it's stability? How's that stupid christian children's song go - the wise man built his house upon the mid optimized but quick and rock solid kernel, the foolish man built his house upon a highly optimized but memory-leaky and flaky kernel. Wait - maybe it doesn't go like that.. But then again, I'm not a christian (and I think you get the point.)
And -O3 *shouldn't* stop you from debugging, that's generally in the hands of -fomit-frame-pointer, but I could be wrong in this case.
M |
|
Back to top |
|
|
DigitalP1mp Tux's lil' helper
Joined: 13 Jun 2003 Posts: 97 Location: USA
|
Posted: Fri Jun 20, 2003 1:16 pm Post subject: What's it all mean Bazil? |
|
|
What's the -02 and the -03 all about. I'm at the point where I need to set my flags now and want to set them correctly. I have an AMD k-6-2 with a 400 mhZ processor. _________________ Where's the any key? |
|
Back to top |
|
|
bsolar Bodhisattva
Joined: 12 Jan 2003 Posts: 2764
|
Posted: Fri Jun 20, 2003 1:24 pm Post subject: Re: What's it all mean Bazil? |
|
|
DigitalP1mp wrote: | What's the -02 and the -03 all about. I'm at the point where I need to set my flags now and want to set them correctly. I have an AMD k-6-2 with a 400 mhZ processor. |
First of all, is -O[n], big, fat, "o", NOT a "zero".
Basically they specify the optimization level, more infos in various threads in these forums, man gcc or google.
About your system, I suggest to here. There is also a script that attemps to identify the adeguate CFLAGS for your system if you want to try.
BTW since this is unrelated with the topic, start a new thread and even better search before, there are a lot of threads about CFLAGS. _________________ I may not agree with what you say, but I'll defend to the death your right to say it. |
|
Back to top |
|
|
darket n00b
Joined: 19 Mar 2003 Posts: 43
|
Posted: Fri Jun 20, 2003 1:25 pm Post subject: |
|
|
the kernel might be using O2 instead of O3 because O3 increases the size of the binary, AFAIK. Or I'm completely off ;-)
For the K6-2: I would use -Os, because that uses all optimizations from O2 without a few to get a small binary - which appears to be better, because of the small on-die cache (L1 only) and the rather slow onboard-L2-Cache. Apart from that, look there:
http://www.freehackers.org/gentoo/gccflags/flag_gcc3.html |
|
Back to top |
|
|
DrkPlague Tux's lil' helper
Joined: 04 Jun 2003 Posts: 107
|
Posted: Fri Jun 20, 2003 7:08 pm Post subject: |
|
|
yes -fomit-frame-pointer completely kills debugging, but -finline-functions (added by -O3) on the kernel and glibc REALLY reak havok on debugging since most function calls made to the kernel or glibc are near impossible to trace.
For those who don't understand what -O does, here it is strait from the horses mouth:
man gcc wrote: | -O1
Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function.
Without `-O ', the compiler's goal is to reduce the cost of compilation and to make debugging produce the expected results. Statements are independent: if you stop the program with a breakpoint between statements, you can then assign a new value to any variable or change the program counter to any other statement in the function and get exactly the results you would expect from the source code.
Without `-O ', only variables declared register are allocated in registers. The resulting compiled code is a little worse than produced by PCC without `-O '.
With `-O ', the compiler tries to reduce code size and execution time.
When you specify `-O ', the two options `-fthread-jumps ' and `-fdefer-pop ' are turned on. On machines that have delay slots, the `-fdelayed-branch ' option is turned on. For those machines that can support debugging even without a frame pointer, the `-fomit-frame-pointer ' option is turned on. On some machines other flags may also be turned on.
-O2
Optimize even more. Nearly all supported optimizations that do not involve a space-speed tradeoff are performed. Loop unrolling and function inlining are not done, for example. As compared to -O , this option increases both compilation time and the performance of the generated code.
-O3
Optimize yet more. This turns on everything -O2 does, along with also turning on -finline-functions.
|
_________________ DKP
There are 10 kinds of people in the world:
Those who understand binary and those who don't... |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|