http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54513

             Bug #: 54513
           Summary: "undefined reference to `___tls_get_addr'" when
                    linking .so with libstdc++.a
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: d....@ngs.ru
            Target: i686-pc-linux-gnu


Program:

#include<iostream>
void f() {}

Build command:

$ g++ -shared -static-libstdc++ -static-libgcc -Wl,-s -Wl,--no-undefined 1.cpp
/opt/gcc-4.7.1/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../libstdc++.a(future.o)(.gnu.linkonce.t._ZSt16__once_call_implISt12_Bind_simpleIFSt7_Mem_fnIMSt6threadFvvEESt17reference_wrapperIS2_EEEEvv+0x17):
In function `void std::__once_call_impl<std::_Bind_simple<std::_Mem_fn<void
(std::thread::*)()> ()(std::reference_wrapper<std::thread>)> >()':
/home/vdyachenko/work/gcc-4.7.1/i686-pc-linux-gnu/libstdc++-v3/include/mutex:787:
undefined reference to `___tls_get_addr'
/opt/gcc-4.7.1/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../libstdc++.a(future.o)(.gnu.linkonce.t._ZSt9call_onceIMSt6threadFvvEISt17reference_wrapperIS0_EEEvRSt9once_flagOT_DpOT0_+0x34):
In function
`_ZSt9call_onceIMSt6threadFvvEJSt17reference_wrapperIS0_EEEvRSt9once_flagOT_DpOT0_':
/home/vdyachenko/work/gcc-4.7.1/i686-pc-linux-gnu/libstdc++-v3/include/mutex:809:
undefined reference to `___tls_get_addr'
/opt/gcc-4.7.1/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../libstdc++.a(future.o)(.gnu.linkonce.t._ZSt9call_onceIMSt6threadFvvEISt17reference_wrapperIS0_EEEvRSt9once_flagOT_DpOT0_+0x45):/home/vdyachenko/work/gcc-4.7.1/i686-pc-linux-gnu/libstdc++-v3/include/mutex:810:
undefined reference to `___tls_get_addr'
/opt/gcc-4.7.1/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../libstdc++.a(mutex.o)(.text.__once_proxy+0x17):
In function `__once_proxy':
../../../.././libstdc++-v3/src/c++11/mutex.cc:90: undefined reference to
`___tls_get_addr'
/opt/gcc-4.7.1/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../libstdc++.a(eh_globals.o)(.text.__cxa_get_globals_fast+0x14):
In function `__cxa_get_globals_fast':
../../.././libstdc++-v3/libsupc++/eh_globals.cc:59: undefined reference to
`___tls_get_addr'
/opt/gcc-4.7.1/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../libstdc++.a(eh_globals.o)(.text.__cxa_get_globals+0x14):../../.././libstdc++-v3/libsupc++/eh_globals.cc:63:
more undefined references to `___tls_get_addr' follow
collect2: error: ld returned 1 exit status
make: *** [a.out] Error 1


OS: CentOS 4
$ uname -a
Linux jansmb 2.6.9-103.ELsmp #1 SMP Fri Dec 9 04:31:51 EST 2011 i686 i686 i386
GNU/Linux

Reply via email to