Subject: Re: -current MIPS ld.elf_so fix/workaround
To: Christopher SEKIYA <wileyc@rezrov.net>
From: Charles M. Hannum <mycroft@netbsd.org>
List: tech-toolchain
Date: 04/14/2003 13:12:37
On Mon, 2003-04-14 at 04:40, Christopher SEKIYA wrote:
> On Sun, Apr 13, 2003 at 12:55:27PM -0400, Rafal Boni wrote:
> 
> > I'm not sure which binutils versions generate the correct output according
> > to the comment and which ones don't -- other than the fact that it appears
> > that the current in-tree one does not).
> 
> After a quick test, I agree.  Removing the "broken" conditional (per the first
> hunk of your patch) indicates that SUPPORT_OLD_BROKEN_LD should actually
> be SUPPORT_NEW_BROKEN_LD :)

I think y'all need to read the comments in there to understand what's
going on a bit.  That code had the "broken" conditional because it
entirely defeats lazy binding, and so is not very attractive for general
use.

The problem you're running into (which I documented a while back, and
asked for help from some MIPS binutils g00r00s) has to do with the use
of function pointers.  IIRC, function pointers in MIPS executables are
being resolved directly to the function, if the function exists in the
executable, but function pointers in shared libraries are being resolved
to the library's PLT slot.  This is causing the pointers to compare
incorrectly, which in turn causes some random lossage (e.g. libXt
doesn't work so well in some cases).

> > it's never actually hit because it seems that in all the cases I found, the
> > GOT value was exactly equal to sym->st_value.
> 
> Same here.  I think this bit can be safely omitted.

It not only can, but it should.  Again, read the comments explaining
what it does.