Need some help with bfd_elf_link_record_dynamic_symbol

Alan Modra amodra@bigpond.net.au
Wed May 21 01:48:00 GMT 2008


On Tue, May 20, 2008 at 01:04:36PM +0200, Bernd Schmidt wrote:
> The problem is that this apparently happens too early, in check_relocs, 
> before the definition of the symbol is seen.

Yes, check_relocs is too early in a lot of cases.  ld ought to delay
dynamic reloc processing until all the symbols have been seen.  gold
does it that way.

> This code is similar to the following idiom
>           /* Make sure this symbol is output as a dynamic symbol.  */
>           if (h->dynindx == -1 && !h->forced_local)
>             {
>               if (!bfd_elf_link_record_dynamic_symbol (info, h))
>                 return FALSE;
>             }
[snip]
> Why isn't this kind of thing done in the target-independent code, 
> anyway?  It seems wasteful to have near-identical but subtly out-of-sync 
> code in all the backends.

weak symbol behaviour isn't properly defined in the ELF spec.  Some
people think undefined weak should become dynamic, others disagree..
If you belong in the latter camp, then you might not want or need your
allocate_dynrelocs.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list