This is the mail archive of the binutils@sourceware.cygnus.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]

Re: Question about ELF linker semantics


>    Date: Tue, 15 Jun 1999 13:55:59 -0700
> 
>    That makes sense to me.  But, I think this is the *opposite*
>    situation.  Here, the "canonical" name is _environ; that's the
>    non-weak symbol.  The main executable is using _environ.  IRIX ld
>    emits a symbol-table entry for _environ.  We emit entries for both
>    _environ and the (weak) environ.  I can't see why we're referencing
>    the weak symbol at all; nobody has mentioned it.  Or am I still
>    missing the point?
> 
> Oh yeah.
> 
> I think that bit in elflink.h may be there because if we are building
> a shared library, we need to make sure that both the weak symbol and
> the regular symbol are in the symbol table if the regular symbol is.
> 
> If I'm right, it's not needed when generating an executable.
> 
> That code hasn't changed in a long time, though.  It would be
> interesting to see what Solaris does.
> 

I learned at the IA64 ABI meeting that Solaris ld is different from
GNU ld. For Solaris ld, "weak" symbols are only meaningful in .o files
when they are used to build executables or shared objects. Once those
symbols are in executables or shared objects, they are treated as
"strong" symbols.

In fact, there are 3 different schemes to treat "weak" symbols:

1. SCO.
2. Sun and HP.
3. GNU and SGI.

We are not alone. There is a proposal to gABI which makes all
acceptable and notes that "weak" symbols are intended for system
libraries only.



-- 
H.J. Lu (hjl@gnu.org)

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