public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Should asm("" : : : "memory") order accesses to the GOT?
@ 1999-06-17 13:13 Franz Sirl
  1999-06-17 13:44 ` David S. Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Franz Sirl @ 1999-06-17 13:13 UTC (permalink / raw)
  To: egcs

Hi,

the subject says it all, should address loads from the GOT considered as memory
accesses?

Currently this is not true at least on PPC and so I can't use the asm() to
cure a glibc-2.1.1/ld.so segfault (gcc-2.95pre moves an access to the GOT
before the call to the bootstrap relocation of ld.so).

This is just a question for understanding, it has come up while trying the
"easy" workaround.

Franz.

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

* Re: Should asm("" : : : "memory") order accesses to the GOT?
  1999-06-17 13:13 Should asm("" : : : "memory") order accesses to the GOT? Franz Sirl
@ 1999-06-17 13:44 ` David S. Miller
  1999-06-17 14:17   ` Franz Sirl
  1999-06-30 15:43   ` David S. Miller
  1999-06-17 13:47 ` Jeffrey A Law
  1999-06-30 15:43 ` Franz Sirl
  2 siblings, 2 replies; 16+ messages in thread
From: David S. Miller @ 1999-06-17 13:44 UTC (permalink / raw)
  To: Franz.Sirl-kernel; +Cc: egcs

   From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
   Date: Thu, 17 Jun 1999 21:57:36 +0200

   the subject says it all, should address loads from the GOT
   considered as memory accesses?

Try adding __volatile__, it might do the trick.

Later,
David S. Miller
davem@redhat.com

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

* Re: Should asm("" : : : "memory") order accesses to the GOT?
  1999-06-17 13:13 Should asm("" : : : "memory") order accesses to the GOT? Franz Sirl
  1999-06-17 13:44 ` David S. Miller
@ 1999-06-17 13:47 ` Jeffrey A Law
  1999-06-17 14:17   ` Franz Sirl
  1999-06-30 15:43   ` Jeffrey A Law
  1999-06-30 15:43 ` Franz Sirl
  2 siblings, 2 replies; 16+ messages in thread
From: Jeffrey A Law @ 1999-06-17 13:47 UTC (permalink / raw)
  To: Franz Sirl; +Cc: egcs

  In message < 99061722151000.00879@ns1102.munich.netsurf.de >you write:
  > the subject says it all, should address loads from the GOT considered as
  > memory accesses?
It should.  But typically we do not represent GOT references as memory
references. 

This is a fairly generic problem with our PIC code in the sense that we're
lying to the compiler about what the machine actually does.  Lots of ports
have the same problem.

If we ever revamp how we represent PIC internally, this is one of the problems
I want to fix :-)

jeff


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

* Re: Should asm("" : : : "memory") order accesses to the GOT?
  1999-06-17 13:44 ` David S. Miller
@ 1999-06-17 14:17   ` Franz Sirl
  1999-06-17 14:21     ` David S. Miller
  1999-06-30 15:43     ` Franz Sirl
  1999-06-30 15:43   ` David S. Miller
  1 sibling, 2 replies; 16+ messages in thread
From: Franz Sirl @ 1999-06-17 14:17 UTC (permalink / raw)
  To: David S. Miller; +Cc: egcs

Am Don, 17 Jun 1999 schrieb David S. Miller:
>From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
>   Date: Thu, 17 Jun 1999 21:57:36 +0200
>
>   the subject says it all, should address loads from the GOT
>   considered as memory accesses?
>
>Try adding __volatile__, it might do the trick.

sorry, I should have been exact, I already used __volatile__. The only dirty
trick I found so far is to clobber the PIC register.

BTW, don't you have problems with glibc-2.1.1 and gcc-2.95pre on Sparc? On PPC
the addresses of _dl_rtld_map and _dl_debug_statistics are loaded out of the
GOT before the ELF_DYNAMIC_RELOCATE happens in _dl_start(). I think the
cleanest solution is to move the end of _dl_start() to a separate file.

Franz.

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

* Re: Should asm("" : : : "memory") order accesses to the GOT?
  1999-06-17 13:47 ` Jeffrey A Law
@ 1999-06-17 14:17   ` Franz Sirl
  1999-06-17 22:30     ` Jeffrey A Law
  1999-06-30 15:43     ` Franz Sirl
  1999-06-30 15:43   ` Jeffrey A Law
  1 sibling, 2 replies; 16+ messages in thread
From: Franz Sirl @ 1999-06-17 14:17 UTC (permalink / raw)
  To: Jeffrey A Law; +Cc: egcs

Am Don, 17 Jun 1999 schrieb Jeffrey A Law:
>In message < 99061722151000.00879@ns1102.munich.netsurf.de >you write:
>  > the subject says it all, should address loads from the GOT considered as
>  > memory accesses?
>It should.  But typically we do not represent GOT references as memory
>references. 
>
>This is a fairly generic problem with our PIC code in the sense that we're
>lying to the compiler about what the machine actually does.  Lots of ports
>have the same problem.
>
>If we ever revamp how we represent PIC internally, this is one of the problems
>I want to fix :-)

Hmm, sounds like a big task. So there's currently no way to order accesses to
the GOT in gcc, independent of platform. Then the only way to fix ld.so is to
move these accesses out into a different file.

BTW, Geoff suggested to replace all unspec 8 with something like this:
(define_expand "movsi_got"
  [(set (match_operand:SI 0 "register_operand" "")
        (mem (plus (unspec [(match_operand:SI 1 "got_operand" "")] 8)
                 (match_dup 2))))]


But if all platforms are affected it's better to fix glibc once and forever.

Franz.

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

* Re: Should asm("" : : : "memory") order accesses to the GOT?
  1999-06-17 14:17   ` Franz Sirl
@ 1999-06-17 14:21     ` David S. Miller
  1999-06-17 14:45       ` Franz Sirl
  1999-06-30 15:43       ` David S. Miller
  1999-06-30 15:43     ` Franz Sirl
  1 sibling, 2 replies; 16+ messages in thread
From: David S. Miller @ 1999-06-17 14:21 UTC (permalink / raw)
  To: Franz.Sirl-kernel; +Cc: egcs

   From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
   Date: Thu, 17 Jun 1999 23:12:37 +0200

   BTW, don't you have problems with glibc-2.1.1 and gcc-2.95pre on
   Sparc?

Jakub has even 64-bit Sparc bootstrapping with shared glibc-2.1.1 and
the current mainline sources, so aparently we are just getting lucky...

Later,
David S. Miller
davem@redhat.com

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

* Re: Should asm("" : : : "memory") order accesses to the GOT?
  1999-06-17 14:21     ` David S. Miller
@ 1999-06-17 14:45       ` Franz Sirl
  1999-06-30 15:43         ` Franz Sirl
  1999-06-30 15:43       ` David S. Miller
  1 sibling, 1 reply; 16+ messages in thread
From: Franz Sirl @ 1999-06-17 14:45 UTC (permalink / raw)
  To: David S. Miller; +Cc: egcs

Am Don, 17 Jun 1999 schrieb David S. Miller:
>From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
>   Date: Thu, 17 Jun 1999 23:12:37 +0200
>
>   BTW, don't you have problems with glibc-2.1.1 and gcc-2.95pre on
>   Sparc?
>
>Jakub has even 64-bit Sparc bootstrapping with shared glibc-2.1.1 and
>the current mainline sources, so aparently we are just getting lucky...

Bah, lucky bastards you are ;-)

So I have to convince Uli now to change _dl_start() accordingly.

Franz.

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

* Re: Should asm("" : : : "memory") order accesses to the GOT?
  1999-06-17 14:17   ` Franz Sirl
@ 1999-06-17 22:30     ` Jeffrey A Law
  1999-06-30 15:43       ` Jeffrey A Law
  1999-06-30 15:43     ` Franz Sirl
  1 sibling, 1 reply; 16+ messages in thread
From: Jeffrey A Law @ 1999-06-17 22:30 UTC (permalink / raw)
  To: Franz Sirl; +Cc: egcs

  In message < 99061723185900.00938@ns1102.munich.netsurf.de >you write:
  > Am Don, 17 Jun 1999 schrieb Jeffrey A Law:
  > Hmm, sounds like a big task.
It's certainly nontrivial.  That's probably why it's been a todo item since
about 1992.

  > So there's currently no way to order accesses to the GOT in gcc,
  > independent of platform.
Not really..  A lot of platforms have unspecs to try and avoid some of these
problems.  For example you could have the code which computes the address
of a symbolic have a (unspec (mem ... )) or something like that.


  > BTW, Geoff suggested to replace all unspec 8 with something like this:
  > (define_expand "movsi_got"
  >   [(set (match_operand:SI 0 "register_operand" "")
  >         (mem (plus (unspec [(match_operand:SI 1 "got_operand" "")] 8)
  >                  (match_dup 2))))]
Yea, with a little work on GO_IF_LEGITIMATE_ADDRESS this kind of scheme
would probably work. 


jeff


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

* Re: Should asm("" : : : "memory") order accesses to the GOT?
  1999-06-17 14:45       ` Franz Sirl
@ 1999-06-30 15:43         ` Franz Sirl
  0 siblings, 0 replies; 16+ messages in thread
From: Franz Sirl @ 1999-06-30 15:43 UTC (permalink / raw)
  To: David S. Miller; +Cc: egcs

Am Don, 17 Jun 1999 schrieb David S. Miller:
>From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
>   Date: Thu, 17 Jun 1999 23:12:37 +0200
>
>   BTW, don't you have problems with glibc-2.1.1 and gcc-2.95pre on
>   Sparc?
>
>Jakub has even 64-bit Sparc bootstrapping with shared glibc-2.1.1 and
>the current mainline sources, so aparently we are just getting lucky...

Bah, lucky bastards you are ;-)

So I have to convince Uli now to change _dl_start() accordingly.

Franz.

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

* Re: Should asm("" : : : "memory") order accesses to the GOT?
  1999-06-17 14:21     ` David S. Miller
  1999-06-17 14:45       ` Franz Sirl
@ 1999-06-30 15:43       ` David S. Miller
  1 sibling, 0 replies; 16+ messages in thread
From: David S. Miller @ 1999-06-30 15:43 UTC (permalink / raw)
  To: Franz.Sirl-kernel; +Cc: egcs

   From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
   Date: Thu, 17 Jun 1999 23:12:37 +0200

   BTW, don't you have problems with glibc-2.1.1 and gcc-2.95pre on
   Sparc?

Jakub has even 64-bit Sparc bootstrapping with shared glibc-2.1.1 and
the current mainline sources, so aparently we are just getting lucky...

Later,
David S. Miller
davem@redhat.com

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

* Re: Should asm("" : : : "memory") order accesses to the GOT?
  1999-06-17 14:17   ` Franz Sirl
  1999-06-17 22:30     ` Jeffrey A Law
@ 1999-06-30 15:43     ` Franz Sirl
  1 sibling, 0 replies; 16+ messages in thread
From: Franz Sirl @ 1999-06-30 15:43 UTC (permalink / raw)
  To: Jeffrey A Law; +Cc: egcs

Am Don, 17 Jun 1999 schrieb Jeffrey A Law:
>In message < 99061722151000.00879@ns1102.munich.netsurf.de >you write:
>  > the subject says it all, should address loads from the GOT considered as
>  > memory accesses?
>It should.  But typically we do not represent GOT references as memory
>references. 
>
>This is a fairly generic problem with our PIC code in the sense that we're
>lying to the compiler about what the machine actually does.  Lots of ports
>have the same problem.
>
>If we ever revamp how we represent PIC internally, this is one of the problems
>I want to fix :-)

Hmm, sounds like a big task. So there's currently no way to order accesses to
the GOT in gcc, independent of platform. Then the only way to fix ld.so is to
move these accesses out into a different file.

BTW, Geoff suggested to replace all unspec 8 with something like this:
(define_expand "movsi_got"
  [(set (match_operand:SI 0 "register_operand" "")
        (mem (plus (unspec [(match_operand:SI 1 "got_operand" "")] 8)
                 (match_dup 2))))]


But if all platforms are affected it's better to fix glibc once and forever.

Franz.

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

* Re: Should asm("" : : : "memory") order accesses to the GOT?
  1999-06-17 22:30     ` Jeffrey A Law
@ 1999-06-30 15:43       ` Jeffrey A Law
  0 siblings, 0 replies; 16+ messages in thread
From: Jeffrey A Law @ 1999-06-30 15:43 UTC (permalink / raw)
  To: Franz Sirl; +Cc: egcs

  In message < 99061723185900.00938@ns1102.munich.netsurf.de >you write:
  > Am Don, 17 Jun 1999 schrieb Jeffrey A Law:
  > Hmm, sounds like a big task.
It's certainly nontrivial.  That's probably why it's been a todo item since
about 1992.

  > So there's currently no way to order accesses to the GOT in gcc,
  > independent of platform.
Not really..  A lot of platforms have unspecs to try and avoid some of these
problems.  For example you could have the code which computes the address
of a symbolic have a (unspec (mem ... )) or something like that.


  > BTW, Geoff suggested to replace all unspec 8 with something like this:
  > (define_expand "movsi_got"
  >   [(set (match_operand:SI 0 "register_operand" "")
  >         (mem (plus (unspec [(match_operand:SI 1 "got_operand" "")] 8)
  >                  (match_dup 2))))]
Yea, with a little work on GO_IF_LEGITIMATE_ADDRESS this kind of scheme
would probably work. 


jeff


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

* Should asm("" : : : "memory") order accesses to the GOT?
  1999-06-17 13:13 Should asm("" : : : "memory") order accesses to the GOT? Franz Sirl
  1999-06-17 13:44 ` David S. Miller
  1999-06-17 13:47 ` Jeffrey A Law
@ 1999-06-30 15:43 ` Franz Sirl
  2 siblings, 0 replies; 16+ messages in thread
From: Franz Sirl @ 1999-06-30 15:43 UTC (permalink / raw)
  To: egcs

Hi,

the subject says it all, should address loads from the GOT considered as memory
accesses?

Currently this is not true at least on PPC and so I can't use the asm() to
cure a glibc-2.1.1/ld.so segfault (gcc-2.95pre moves an access to the GOT
before the call to the bootstrap relocation of ld.so).

This is just a question for understanding, it has come up while trying the
"easy" workaround.

Franz.

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

* Re: Should asm("" : : : "memory") order accesses to the GOT?
  1999-06-17 14:17   ` Franz Sirl
  1999-06-17 14:21     ` David S. Miller
@ 1999-06-30 15:43     ` Franz Sirl
  1 sibling, 0 replies; 16+ messages in thread
From: Franz Sirl @ 1999-06-30 15:43 UTC (permalink / raw)
  To: David S. Miller; +Cc: egcs

Am Don, 17 Jun 1999 schrieb David S. Miller:
>From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
>   Date: Thu, 17 Jun 1999 21:57:36 +0200
>
>   the subject says it all, should address loads from the GOT
>   considered as memory accesses?
>
>Try adding __volatile__, it might do the trick.

sorry, I should have been exact, I already used __volatile__. The only dirty
trick I found so far is to clobber the PIC register.

BTW, don't you have problems with glibc-2.1.1 and gcc-2.95pre on Sparc? On PPC
the addresses of _dl_rtld_map and _dl_debug_statistics are loaded out of the
GOT before the ELF_DYNAMIC_RELOCATE happens in _dl_start(). I think the
cleanest solution is to move the end of _dl_start() to a separate file.

Franz.

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

* Re: Should asm("" : : : "memory") order accesses to the GOT?
  1999-06-17 13:47 ` Jeffrey A Law
  1999-06-17 14:17   ` Franz Sirl
@ 1999-06-30 15:43   ` Jeffrey A Law
  1 sibling, 0 replies; 16+ messages in thread
From: Jeffrey A Law @ 1999-06-30 15:43 UTC (permalink / raw)
  To: Franz Sirl; +Cc: egcs

  In message < 99061722151000.00879@ns1102.munich.netsurf.de >you write:
  > the subject says it all, should address loads from the GOT considered as
  > memory accesses?
It should.  But typically we do not represent GOT references as memory
references. 

This is a fairly generic problem with our PIC code in the sense that we're
lying to the compiler about what the machine actually does.  Lots of ports
have the same problem.

If we ever revamp how we represent PIC internally, this is one of the problems
I want to fix :-)

jeff


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

* Re: Should asm("" : : : "memory") order accesses to the GOT?
  1999-06-17 13:44 ` David S. Miller
  1999-06-17 14:17   ` Franz Sirl
@ 1999-06-30 15:43   ` David S. Miller
  1 sibling, 0 replies; 16+ messages in thread
From: David S. Miller @ 1999-06-30 15:43 UTC (permalink / raw)
  To: Franz.Sirl-kernel; +Cc: egcs

   From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
   Date: Thu, 17 Jun 1999 21:57:36 +0200

   the subject says it all, should address loads from the GOT
   considered as memory accesses?

Try adding __volatile__, it might do the trick.

Later,
David S. Miller
davem@redhat.com

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

end of thread, other threads:[~1999-06-30 15:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-17 13:13 Should asm("" : : : "memory") order accesses to the GOT? Franz Sirl
1999-06-17 13:44 ` David S. Miller
1999-06-17 14:17   ` Franz Sirl
1999-06-17 14:21     ` David S. Miller
1999-06-17 14:45       ` Franz Sirl
1999-06-30 15:43         ` Franz Sirl
1999-06-30 15:43       ` David S. Miller
1999-06-30 15:43     ` Franz Sirl
1999-06-30 15:43   ` David S. Miller
1999-06-17 13:47 ` Jeffrey A Law
1999-06-17 14:17   ` Franz Sirl
1999-06-17 22:30     ` Jeffrey A Law
1999-06-30 15:43       ` Jeffrey A Law
1999-06-30 15:43     ` Franz Sirl
1999-06-30 15:43   ` Jeffrey A Law
1999-06-30 15:43 ` Franz Sirl

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).