Re: linux and EGCS PATCH

Horst von Brand (
Wed, 10 Dec 1997 13:55:02 -0300

Linus Torvalds <> said:
> On Fri, 5 Dec 1997, Martin.Dalecki wrote:
> > The following little patch resolvs the compilation problems for the linux
> > kernel with the just releases egcs-1.0 compiler. It seems to be correct
> > anyway.

> I much prefer to just mark the "load_ldt()" asm as volatile, or as
> changing memory. Both of those should correctly tell egcs that it
> shouldn't move the ldt loading to before the ldt is set up completely.

> Good to see that egcs seems to be much more aggressive at these things, as
> far as I can tell egcs did the right thing given the constraints it had.

But without Martin's patch linux-2.1.72 won't compile with egcs-971207.

Anyway, there seem to be lots of gray areas here, and stuff you can get
away with, but shouldn't. The core problem is that the offending asm() has
too much arguments, egcs tries to put each into different registers and
goes down cause it can't. Inhibiting certain optimizations make it realize
that they can all be represented as varying bases for the same offset, and
everything is peachy. But (if I understand the documentation on asm() for
gcc correctly) this is definitely _not_ guarranteed in any way... you can
get away with it because gcc synthetizes the different arguments using the
same registers.

Perhaps (if doing stuff like this is at all common) a way to say that some
place is a base and others offset from it?

Dr. Horst H. von Brand             
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513