This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Change to GOT initialization?


On Thu, 28 Nov 2002 at 08:45:31 +1030, Alan Modra wrote:

> On Wed, Nov 27, 2002 at 01:26:24PM -0800, Jason R Thorpe wrote:
> > The way we compute our relocation base is:
> > 
> >         bl      _GLOBAL_OFFSET_TABLE_@local-4
> >         mflr    %r31                    # r31 = (real) GOT
> >         lwz     %r30,_GLOBAL_OFFSET_TABLE_@got(31)
> >                                         # the linker thought GOT were ...
> >         subf    %r4,%r30,%r31           # r4 = relocbase
> > 
> > ...but this falls over completely, because 0 ends up being loaded
> > info %r30, so we can't compute the relocbase (nor can we compute
> > the real address of _DYNAMIC, since we don't know the relocbase to
> > add to the base-relative offset in _DYNAMIC's GOT entry).
> > 
> > So, I guess I have two questions:
> > 
> >       1. Can anyone tell me when this change was made, and why?
> 
> http://sources.redhat.com/ml/binutils/2002-09/msg00322.html
> http://sources.redhat.com/ml/libc-alpha/2002-09/msg00630.html

The first message you reference appears to be a response to a non-public
message, and without the missing context, it's very difficult to understand
what problem, exactly, the change in question was attempting to address.

The second message you reference explains the change as justified, in part,
because the values in the GOT were "random" in the old scheme of things, 
which is a false assertion.  Indeed, to avoid the gross hack of disassembling
a PC-relative branch that you suggest we now switch to, the NetBSD dynamic
linker relied, as Jason's pointed out, upon the very much *non-random*
values that used to be in the GOT.

This change probably broke any other system whose ld.elf_so doesn't use
the same hack as the current Linux implementation, as well.

Given that the rationale for the change was not really made public before
the code was committed, AFAICT, and that the later justification relied
on an assertion that is false -- that the data in the GOT was just random
junk and that, thus, zeroing it out must be harmless -- and that the zeroing
of said data did, in fact, break dynamic linkers that quite reasonably
relied on what the GOT _used to_ contain, would it it be too much to ask that 
the change in question be backed out?

Thor


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]