public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* linux and EGCS PATCH
@ 1997-12-05  1:17 Martin.Dalecki
  1997-12-05 10:44 ` Linus Torvalds
  0 siblings, 1 reply; 8+ messages in thread
From: Martin.Dalecki @ 1997-12-05  1:17 UTC (permalink / raw)
  To: torvalds; +Cc: egcs, linux kernel

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. 

Please apply it to the next kernel release.

--- linux-orig/arch/i386/kernel/process.c	Wed Oct 15 02:24:09 1997
+++ linux/arch/i386/kernel/process.c	Thu Dec  4 22:49:10 1997
@@ -443,6 +443,13 @@
 			if (task[i] == current)  {
 				set_ldt_desc(gdt+(i<<1)+
 					     FIRST_LDT_ENTRY,&default_ldt, 1);
+    	/*
+    	 * 1997/12/04 Marcin Dalecki:
+    	 *
+    	 * The introduction of the following (over-) optimization preventer
+    	 * fixes the compilation under egcs-1.0.
+    	 */
+			    	barrier();
 				load_ldt(i);
 			}
 		}	



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: linux and EGCS PATCH
  1997-12-05  1:17 linux and EGCS PATCH Martin.Dalecki
@ 1997-12-05 10:44 ` Linus Torvalds
  1997-12-06  8:41   ` Jeffrey A Law
  1997-12-10  8:57   ` Horst von Brand
  0 siblings, 2 replies; 8+ messages in thread
From: Linus Torvalds @ 1997-12-05 10:44 UTC (permalink / raw)
  To: Martin.Dalecki; +Cc: egcs, linux kernel

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.

		Linus


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: linux and EGCS PATCH
  1997-12-05 10:44 ` Linus Torvalds
@ 1997-12-06  8:41   ` Jeffrey A Law
  1997-12-10  8:57   ` Horst von Brand
  1 sibling, 0 replies; 8+ messages in thread
From: Jeffrey A Law @ 1997-12-06  8:41 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Martin.Dalecki, egcs, linux kernel

  In message < Pine.LNX.3.95.971205094911.18973C-100000@penguin.transmeta.com >you write:
  > 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.
BTW -- you should feel free to contact egcs@cygnus.com if/when you run
into problems -- being able to correctly compile Linux kernels is quite
important to us.

jeff

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: linux and EGCS PATCH
  1997-12-05 10:44 ` Linus Torvalds
  1997-12-06  8:41   ` Jeffrey A Law
@ 1997-12-10  8:57   ` Horst von Brand
  1997-12-10 10:58     ` Paul Koning
  1997-12-10 10:58     ` Linus Torvalds
  1 sibling, 2 replies; 8+ messages in thread
From: Horst von Brand @ 1997-12-10  8:57 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Martin.Dalecki, egcs, linux kernel

Linus Torvalds <torvalds@transmeta.com> 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                       mailto:vonbrand@inf.utfsm.cl
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: linux and EGCS PATCH
  1997-12-10  8:57   ` Horst von Brand
  1997-12-10 10:58     ` Paul Koning
@ 1997-12-10 10:58     ` Linus Torvalds
  1 sibling, 0 replies; 8+ messages in thread
From: Linus Torvalds @ 1997-12-10 10:58 UTC (permalink / raw)
  To: Horst von Brand; +Cc: Martin.Dalecki, egcs, linux kernel

On Wed, 10 Dec 1997, Horst von Brand wrote:
> 
> But without Martin's patch linux-2.1.72 won't compile with egcs-971207.

I just sent an email out to the egcs list explaining that there was no
Linux bug in the first place, and that it was egcs that does an illegal
optimization after all (all according to gcc documentation). 

So at this point, I haven't had any real indications of the kernel doing
anything wrong, and egcs should be considered broken for now. I can be
made to change my mind, but so far all the indications are that if you
want a stable kernel you should not use egcs yet.

			Linus


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: linux and EGCS PATCH
  1997-12-10  8:57   ` Horst von Brand
@ 1997-12-10 10:58     ` Paul Koning
  1997-12-10 10:58     ` Linus Torvalds
  1 sibling, 0 replies; 8+ messages in thread
From: Paul Koning @ 1997-12-10 10:58 UTC (permalink / raw)
  To: egcs; +Cc: torvalds, dalecki, linux-kernel

>>>>> "Horst" == Horst von Brand <vonbrand@inf.utfsm.cl> writes:

 Horst> Linus Torvalds <torvalds@transmeta.com> 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.

	paul

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: linux and EGCS PATCH
  1997-12-11 16:33 Daniel Egger
@ 1997-12-12 10:18 ` linux kernel account
  0 siblings, 0 replies; 8+ messages in thread
From: linux kernel account @ 1997-12-12 10:18 UTC (permalink / raw)
  To: Daniel Egger; +Cc: egcs, linux kernel

Compiled with PGCC 1.0 -mpentium -O6

limelight:~/kde# uname -a
Linux limelight 2.1.71 #26 Sun Dec 7 19:24:34 EST 1997 i586
limelight:~/kde# uptime
 10:00am  up 4 days, 14:30,  7 users,  load average: 0.00, 0.00, 0.00
limelight:~/kde#


On Thu, 11 Dec 1997, Daniel Egger wrote:

> On Wed, 10 Dec 1997, you wrote:
> 
> >So at this point, I haven't had any real indications of the kernel doing
> >anything wrong, and egcs should be considered broken for now. I can be
> >made to change my mind, but so far all the indications are that if you
> >want a stable kernel you should not use egcs yet.
> 
>  Hm, here works a linux kernel version 2.1.72 compiled with egcs-971207 on i486.
>  It's up now for 48h and stands heavy network traffic without any problems.
>  
>  Servus,
>               Daniel
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: linux and EGCS PATCH
@ 1997-12-11 16:33 Daniel Egger
  1997-12-12 10:18 ` linux kernel account
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Egger @ 1997-12-11 16:33 UTC (permalink / raw)
  To: egcs; +Cc: linux kernel

On Wed, 10 Dec 1997, you wrote:

>So at this point, I haven't had any real indications of the kernel doing
>anything wrong, and egcs should be considered broken for now. I can be
>made to change my mind, but so far all the indications are that if you
>want a stable kernel you should not use egcs yet.

 Hm, here works a linux kernel version 2.1.72 compiled with egcs-971207 on i486.
 It's up now for 48h and stands heavy network traffic without any problems.
 
 Servus,
              Daniel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1997-12-12 10:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-12-05  1:17 linux and EGCS PATCH Martin.Dalecki
1997-12-05 10:44 ` Linus Torvalds
1997-12-06  8:41   ` Jeffrey A Law
1997-12-10  8:57   ` Horst von Brand
1997-12-10 10:58     ` Paul Koning
1997-12-10 10:58     ` Linus Torvalds
1997-12-11 16:33 Daniel Egger
1997-12-12 10:18 ` linux kernel account

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).