global vars and symbol visibility for mips32/elf

Ian Lance Taylor ian@cygnus.com
Fri Aug 9 08:30:00 GMT 1996


   Date: Fri, 9 Aug 1996 02:46:18 -0700
   From: "David S. Miller" <dm@neteng.engr.sgi.com>

   The problem is caused by the symbol 'glob'.  GNU libc also has a
   symbol glob.

This is the bug.  An ANSI C compliant shared library may not have a
global symbol which infringes on the ANSI C namespace.  The symbol
must, instead, be weak.

It works to have a global symbol in a normal archive library, because
then it will only be included if there is no other definition.
However, all symbols in a shared library are included if any are, so
there must be no extraneous global symbols.

   The IRIX6.2 linker however places this symbol in the MIPS_ACOMMON
   section of the resulting executable and does not override using the
   libc symbol of the same name (the shared IRIX libc does in fact have a
   symbol named 'glob' just like my MIPS/Linux GNU libc does).

If you use elfdump -Dt on the Irix 6.2 libc, you will see that glob is
a weak symbol.

The use of the MIPS_ACOMMON section is an Irix linker optimization,
not supported by gld, which has no particular bearing on this issue.

Ian




More information about the Gas2 mailing list