This is the mail archive of the binutils@sources.redhat.com 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: behavior of weak definitions in archive libraries


David Mosberger <davidm@napali.hpl.hp.com> writes:

> We're seeing a problem which appears to come from an unexpected (to
> me) behavior of the linker: it appears that if a program has a weak
> reference to a symbol in an archive object and there is no other
> reason for the archive object to be linked in, then the weak reference
> will end up being resolved to NULL.

This behaviour is intentional for ELF.  That is how ELF linkers work.

>From http://www.caldera.com/developers/gabi/1998-04-29/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.

Ian


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