Re: Compiling kernel without -O2 flag
Sorav Bansal <firstname.lastname@example.org> writes:
> Hi all,
> There is a curious thing that I noticed in the kernel. The kernel does
> not compile if you remove the -O2 flag in the Makefile. It gives an error
> in an ASM directive mentioning that a register is being spilled.
The x86 has a very few registers. With in-line assembly you can
easily tie some registers up. I guess gcc got into a corner it
couldn't get out of. I would guess it's a bug in gcc, but at least
it had the presence of mind to fail loudly.
> Is this normal behavior?
I suppose it is. Have you tried -O1? I know that the kernel depends
upon certain functions being inlined for proper behavior. The kernel
has some hard time constraints since it needs to deal with the
hardware. You fiddle with the compile options at your own risk.