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. */ OUTPUT_FORMAT(elf64-x86-64) GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) ) in /usr/lib64/libc.so (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. Jakub