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



     From: mark@codesourcery.com
     Date: Mon, 14 Jun 1999 18:10:19 -0700

     When confronted with the following situation:

       o environ is a weak symbol, equivalent to _environ
       o _environ is defined in libc.so
       o _environ is referenced in crt1.o

     the IRIX6 linker does not emit an entry for "environ" in the dynamic
     symbol table in the main executable.  However, the GNU linker wants to
     do so:

  As I recall, the basic idea is that if the regular object refers to
  environ, and environ is a weak symbol defined as _environ, we're going
  to wind up generating a COPY reloc for environ.  If we don't put
  _environ in the dynamic symbol table, then environ in the executable
  and _environ in the shared object will be different variables, which
  obviously won't work.

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?

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

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