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'

"yang xiaoxin" <> writes:

> Building project store
> =============
> /usr/src/rpm/BUILD/OOB680_m5/store/source
> -------------
> /usr/src/rpm/BUILD/OOB680_m5/store/util
> ------------------------------
> Making: ../
> g++ -Wl,-z,combreloc -Wl,-z,defs -Wl,-rpath,'$ORIGIN'
> "-Wl," -shared -Wl,-O1 -Wl,--version-script
> ../ -L../ -L../lib
> -L/usr/src/rpm/BUILD/OOB680_m5/solenv/unxlngi6/lib
> -L/usr/src/rpm/BUILD/OOB680_m5/solver/680/
> -L/usr/src/rpm/BUILD/OOB680_m5/solenv/unxlngi6/lib -L/usr/lib
> -L/usr/jre/lib/i386 -L/usr/jre/lib/i386/client
> -L/usr/jre/lib/i386/native_threads -L/usr/X11R6/lib
> -L/usr/lib/firefox- ../
> ../ -o
> ../ ../
> ../ ../
> ../ ../
> ../ ../
> ../ ../
> ../ -luno_sal -lsupc++ -lgcc_s -ldl -lpthread
> -lm
> /usr/lib/libsupc++.a(eh_globals.o): In function `__gnu_internal::get_global()':
> : undefined reference to `___tls_get_addr'
> collect2: ld 返回 1
> dmake:  Error code 1, while making '../'
> '---* *---'
> ERROR: Error 65280 occurred while making /usr/src/rpm/BUILD/OOB680_m5/store/util
> dmake:  Error code 1, while making 'build_instsetoo_native'
> What's the problem?

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

So you get an error.

Hope this helps.


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