PATCH: ld/2218: Weak undefined symbol doesn't work properly with PIE

Daniel Jacobowitz drow@false.org
Mon Feb 20 03:47:00 GMT 2006


On Mon, Feb 20, 2006 at 10:19:39AM +1030, Alan Modra wrote:
> After giving this some more thought, I'm inclined to say that this patch
> does not belong in the generic ELF support.  The reason is that the
> behaviour of weak undefined symbols is not well defined.  At least, I'm
> not aware of any standard that says an undefined weak sym should be made
> dynamic when dynamic objects are involved in the link.  I think it would
> be quite reasonable for an ELF target to choose to resolve undefined
> weak syms in an executable to zero at link time.
> 
> So I think we ought to patch each backend individually, painful as that
> might be.  Note that many backends already handle undef weak syms
> specially, eg. calling bfd_elf_link_record_dynamic_symbol for plt and
> got references (even in non-pie exes).

I don't think I follow your logic here.  We've got a Linux port to the
lion's share of architectures that we have an ELF backend and dynamic
linking for; we're going to end up implementing the same thing in each
and every one of those backends, to be consistent.

Are you worried about compatibility with some as-yet-unknown tools that
don't do this?  If so, can we have a backend flag to turn it off, but
enable it by default and keep the code in common?

I'm generally distressed with how much platform-specific code there is
in all this; I think we should be trying to drive that down, not up.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Binutils mailing list