How should the GNU linker treat weak references?

Alan Modra amodra@bigpond.net.au
Thu Jul 5 00:53:00 GMT 2001


On Thu, Jul 05, 2001 at 12:00:51AM -0700, Ulrich Drepper wrote:
> Alan Modra <amodra@bigpond.net.au> writes:
> 
> > Really?  If this is so, then bfd/elflink.h is currently doing the wrong
> > thing.  See elflink.h:688 and elflink.h:747
> 
> I know.

I've spent the last 10 minutes thinking over this, and can see one
implication of allowing a strong sym in a dynamic lib to take
precedence over a weak sym in an executable;  The dynamic linker would
need to fall back to using the weak definition in the executable if the
library changes and no longer exports the sym.

Can you enlighten us as to why you think that particular implementation
is wrong?  As you say, the elf spec "is very very weak in this area"
Actually, more than that, it doesn't say _anything_ about this area
apart from "The behavior of weak symbols in areas not specified by this
document is implementation defined."

Alan



More information about the Binutils mailing list