PATCH for i386: --no-copy-relocs

Ian Lance Taylor ian@zembu.com
Tue Jun 19 13:50:00 GMT 2001


Alan Modra <amodra@bigpond.net.au> writes:

> On Mon, Jun 18, 2001 at 09:25:46PM +0200, Jose Luu wrote:
> > http://sources.redhat.com/ml/binutils/2000-12/msg00183.html
> 
> I had a look at your testcase and spent a little time thinking, and
> am coming to the conclusion that the root cause of this problem is
> that the dynamic linker is not behaving correctly.
> 
> Here's what I think the dynamic linker should do with a COPY reloc:
> a) copy the initialised value of the associated variable from the
>    shared library into space allocated in the executable.
> b) set the shared lib's .got entry for the variable to point at the
>    space in the executable.
> 
> That way the shared lib, which must access the variable through the
> .got, will access the same space as the executable.  Point (b) seems
> to not be happening with glibc's dynamic loader.

That is indeed precisely correct.  If that is not happening, there is
a bug.

However, based on the earlier mail, I wonder if point (b) is not
happening because the shared library was linked using -Bsymbolic.  I
haven't actually looked at the test case.  When a library is linked
using -Bsymbolic, the program linker is not required to send every
reference to a global variable through the GOT.  So even if the
runtime linker is adjusting the GOT, it may not affect the program.

Ian



More information about the Binutils mailing list