This is the mail archive of the mailing list for the GCC 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: libsupc++.a(eh_globals.o): In function `__gnu_internal::get_global()': undefined reference to `___tls_get_addr'

On Tue, Jun 13, 2006 at 08:35:17AM -0700, Ian Lance Taylor wrote:
> Well, your libstdc++ was configured for a system which supports TLS
> (Thread Local Storage).  That causes it to call __tls_get_addr in some
> cases.  And you are explicitly linking against -lsupc++, which is an
> archive, not a shared library.  This means that your program has a
> direct reference to __tls_get_addr which needs to be satisfied.
> Normally __tls_get_addr is defined by the dynamic linker itself.  When
> linking an executable, one normally links against the dynamic linker,
> so the symbol reference is satisfied.  When linking a shared library,
> one normally does not link against the dynamic linker, but that's OK
> because shared libraries are permitted to have undefined references.
> However, you are linking with -z defs, which directs the linker to
> prohibit undefined references even though it is linking a shared
> library.

If you have sufficiently recent glibc, you have something like:
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
GROUP ( /lib64/ /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ ) )
in /usr/lib64/ (and similarly for other arches).
If you have old glibc (approx. 16 months old or older), you either
need to stop using -Wl,-z,defs in this case, or add the dynamic
linker on the command line explicitly.


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