This is the mail archive of the binutils@sourceware.org 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: PATCH: ld/2218: Weak undefined symbol doesn't work properly with PIE


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 have no strong opionions on either approach as long as we can get
undefined weak symbol in PIE to work correctly. If we want to make it
target dependent, I'd like to add 2 hooks to ELF backend:

1. fixup_undefined_weak_symbol, which will be called to fix up
the undefined weak symbol. The default will be NULL.
2. pie_fixup_output_extsym, which be called to fix up output symbol
for PIE. The default will also be NULL.

2 generic versions will be provided and x86/x86-64/ia64 will use them.


H.J.


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