This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Possible weak linker bug in ld
On Wed, Oct 15, 2003 at 05:16:22PM +0200, Svein E. Seldal wrote:
> Alan Modra wrote:
>
> >On Wed, Oct 15, 2003 at 02:39:58PM +0200, Svein E. Seldal wrote:
> >
> >>I think I run across a bug in ld when linking files with weak symbols.
> >
> >
> >See http://www.caldera.com/developers/gabi/latest/ch4.symtab.html
> >
> >"When the link editor searches archive libraries [see ``Archive File''
> >in Chapter 7], it extracts archive members that contain definitions of
> >undefined global symbols. The member's definition may be either a global
> >or a weak symbol. **The link editor does not extract archive members to
> >resolve undefined weak symbols.** Unresolved weak symbols have a zero
> >value."
>
> May I ask why not?
That's the historical way. I believe the sunos ELF linker behaved like
this.
> I respect this policy if there's a reason behind it. But, if there's
> none, I would suggest that we alter this behavior to be able to seach
> libs for strong symbol overrides, please.
We certainly can't do this by default, as I can easily imagine cases
that depend on the old behaviour. Would you like to add a linker
switch to extract archive members to satisfy undefined weak syms? A
small change to elflink.h:elf_link_add_archive_symbols should do
what you want.
--
Alan Modra
IBM OzLabs - Linux Technology Centre