Re: linux and EGCS PATCH

Paul Koning (
Wed, 10 Dec 1997 13:47:23 -0500

>>>>> "Horst" == Horst von Brand <> writes:

Horst> Linus Torvalds <> said:
>> 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.

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

I don't think your diagnosis is correct.

I've run into this same problem (a month or so ago -- reported here at
some length) with a one-line asm statement that had just one input.

The problem is very simple: the documentation says that an (extended
GNU style) asm with NO outputs is automatically unmovable, and this
makes perfect sense. But the compiler doesn't obey the documentation.

I've reported this twice; does anyone here know how this bug could be
fixed? I don't have the skill to fix it myself (though it push comes
to shove I suppose I can learn) so I'm hoping someone is an expert in
this subject and can fix it easily.