Skip to contentSkip to conversation

kernel compiler

DISCUSSION John Weber 7 participants 9 messages Oct 25, 2001 – Oct 26, 2001

lore
Share & tools
lore

John Weber

author
#0 lore raw
Quoted 14 lines · David Weinehall
Quoted 7 lines · Frontgate Lab

Just out of a need to know things :)

What compiler do Alan Cox and Linus use to create the 2.4 series kernels?

I am currently using RedHat's compiler gcc-2.96-85 and have been told not to do so because it "breaks things" .

This is likely due to the fact that some people are still living with the misconception that all gcc-2.96 releases are buggy. They are not; only early versions are.

Quoted 6 lines

gcc-2.95.[34] and gcc-2.96-(newer versions) are viable choices if you want a working kernel. Some other versions might work, but then again,

At the moment, gcc3 doesn't work too well with the kernel, and you won't get any large benefit.

I use gcc3 to compile anything and everything I need. With the exception of "multi-line literal complaints", my kernel compiles fine.

Is there anything that I should know?

#1 lore raw

Hi,

Quoted 2 lines

I use gcc3 to compile anything and everything I need. With the exception of "multi-line literal complaints", my kernel compiles fine.

What exact version of gcc do you use. All attempts to use gcc3+ have caused compiler failures or kernel panics for me.

Axel

#2 lore raw
In reply to John Weber
Quoted 7 lines
Quoted 2 lines

At the moment, gcc3 doesn't work too well with the kernel, and you won't get any large benefit.

I use gcc3 to compile anything and everything I need. With the exception of "multi-line literal complaints", my kernel compiles fine.

Is there anything that I should know?

Mostly that gcc 3.0 generally produces slower code. I've had a couple of noticed glitches with -ac but those have workarounds in the tree now

#3 lore raw

GCC 3.0 Produces slower code, eh? I was of the understanding that it contained many more optimizations than previous versions...???

Any way, I've been able to run my system based entirely on a fairly recent GCC CVS-3.02 snapshot, including kernels, and everything EXCEPT for glibc which is specifically incompatible according to the GNU folks.

By way of information however, neither of the GCC 3.0 releases (3.0.0 or 3.0.1) work at all on my system, and I cannot get a kernel to function at better than -O2 (not that I could get that to work in 2.95.* or 2.96.* either).

--Lost Logic (Brandon Low)

Quoted 17 lines · Alan Cox
Quoted 8 lines
Quoted 3 lines

At the moment, gcc3 doesn't work too well with the kernel, and you won't get any large benefit.

I use gcc3 to compile anything and everything I need. With the exception of "multi-line literal complaints", my kernel compiles fine.

Is there anything that I should know?

Mostly that gcc 3.0 generally produces slower code. I've had a couple of noticed glitches with -ac but those have workarounds in the tree now -
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#4 lore raw
Quoted 2 lines

GCC 3.0 Produces slower code, eh? I was of the understanding that it contained many more optimizations than previous versions...???

It does - but the end result right now is typically slower. it has the infrastructure and optimisation code to create faster code than 2.x ever could but it isnt yet at the point it has been refined to do so

#5 lore raw
In reply to Lost Logic
Quoted 7 lines · On 20011025 Alan Cox wrote:
Quoted 2 lines

GCC 3.0 Produces slower code, eh? I was of the understanding that it contained many more optimizations than previous versions...???

It does - but the end result right now is typically slower. it has the infrastructure and optimisation code to create faster code than 2.x ever could but it isnt yet at the point it has been refined to do so -

3.0.2 is out. Time to check it.

What I sure have seen is that code is much bigger than with 2.96. About 40k for an 800k kernel.
Wil try with 14-pre1.

Signature · 4 lines
J.A. Magallon                           #  Let the source be with you...        
mailto:[email protected]
Mandrake Linux release 8.2 (Cooker) for i586
Linux werewolf 2.4.14-pre1-beo #1 SMP Thu Oct 25 16:19:19 CEST 2001 i686
#6 lore raw
In reply to Alan Cox
Quoted 12 lines · On 20011025 Lost Logic wrote:

GCC 3.0 Produces slower code, eh? I was of the understanding that it contained many more optimizations than previous versions...???

Any way, I've been able to run my system based entirely on a fairly recent GCC CVS-3.02 snapshot, including kernels, and everything EXCEPT for glibc which is specifically incompatible according to the GNU folks.

By way of information however, neither of the GCC 3.0 releases (3.0.0 or 3.0.1) work at all on my system, and I cannot get a kernel to function at better than -O2 (not that I could get that to work in 2.95.* or 2.96.* either).

-O3 activates -finline-functions:
`-finline-functions'
Integrate all simple functions into their callers. The compiler heuristically decides which functions are simple enough to be worth integrating in this way.

If all calls to a given function are integrated, and the function is declared `static', then the function is normally not output as assembler code in its own right.

Last paragraph is the key. Perhaps previous gcc'd did not all his work as the manual says (ie, did not kill the non-inline version, bug), but people has got used to the bug, and see it as a feature.

Signature · 4 lines
J.A. Magallon                           #  Let the source be with you...        
mailto:[email protected]
Mandrake Linux release 8.2 (Cooker) for i586
Linux werewolf 2.4.14-pre1-beo #1 SMP Thu Oct 25 16:19:19 CEST 2001 i686
#7 lore raw
In reply to Alan Cox
Quoted 19 lines · J . A . Magallon
Quoted 11 lines · On 20011025 Lost Logic wrote:

GCC 3.0 Produces slower code, eh? I was of the understanding that it contained many more optimizations than previous versions...???

Any way, I've been able to run my system based entirely on a fairly recent GCC CVS-3.02 snapshot, including kernels, and everything EXCEPT for glibc which is specifically incompatible according to the GNU folks.

By way of information however, neither of the GCC 3.0 releases (3.0.0 or 3.0.1) work at all on my system, and I cannot get a kernel to function at better than -O2 (not that I could get that to work in 2.95.* or 2.96.* either).

-O3 activates -finline-functions:
`-finline-functions'
Integrate all simple functions into their callers. The compiler heuristically decides which functions are simple enough to be worth integrating in this way.

Quoted 7 lines

If all calls to a given function are integrated, and the function is declared `static', then the function is normally not output as assembler code in its own right.

Last paragraph is the key. Perhaps previous gcc'd did not all his work as the manual says (ie, did not kill the non-inline version, bug), but people has got used to the bug, and see it as a feature.

I believe '-fkeep-inline-functions' is your friend in this case. I haven't tested it though on the kernel.

regards
`Allan

#8 lore raw
In reply to Alan Cox
Quoted 6 lines · Allan Sandfeld
Quoted 3 lines

Last paragraph is the key. Perhaps previous gcc'd did not all his work as the manual says (ie, did not kill the non-inline version, bug), but people has got used to the bug, and see it as a feature.

I believe '-fkeep-inline-functions' is your friend in this case. I haven't tested it though on the kernel.

Definitely not. -fkeep-inline-functions will not only prevent in compiler eyes unused static functions from beeing optimized away, but you'll get tons of code you really don't need.
__attribute__((used)) is what you can use in current gcc trunk to just say the compiler that it should not optimize away a particular function even if it seems to be unused at -O3 (e.g. it might be referenced from inline assembly, whatever).
No matter what, using -O3 for kernel builds is a bad idea, in vast majority functions which make sense to be inlined are in the kernel marked so with inline keyword, and the rest does not. With -O3 for kernel you just get bigger code with no gains (if there are some gains somewhere, then it should be considered to be marked inline on a case by case basis).

Jakub