This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Undefined weak symbols stay undefined
On Tue, Nov 25, 2003 at 12:46:44PM +0200, Momchil Velikov wrote:
> >>>>> "Momchil" == Momchil Velikov <velco@fadata.bg> writes:
>
> >>>>> "Alan" == Alan Modra <amodra@bigpond.net.au> writes:
> Alan> On Tue, Nov 25, 2003 at 11:57:32AM +0200, Momchil Velikov wrote:
> >>> Aren't undefined weak symbols supposed to be _defined_ to zero by
> >>> the linker, probably putting them in SHN_ANS ?
>
> Alan> No. Undefined weak symbols have a _value_ of zero, which is different
> Alan> to saying they are defined to zero.
>
> Momchil> What is the need of undefined symbols in statically linked
> Momchil> executables ?
What's the need for any symbols in a statically linked executable?
You don't need any to run, but perhaps might find them useful in
debugging..
> Also, how come that the usual equivalence of "defined" and "having a
> value" does not apply to ELF objects ?
I don't particularly want to argue the meaning of words, but if the
linker did define unresolved weak syms as abs zero, you'd lose the
info in the executable that they were originally undefined weak.
--
Alan Modra
IBM OzLabs - Linux Technology Centre