thread_local broken on clang

Troy Heron troy.heron at hixxy.org
Thu Jul 31 09:54:25 UTC 2014


Hello,

I'm attempting to port an application to FreeBSD (version 10 to be
specific). The application has been developed using C++11 and uses
thread_local.

As below, the use of thread_local is giving me linking errors for the C++
ABI.

troy at freebsd10:~ # cat tl.cpp
#include <string>

thread_local std::string test;

int main()
{
}
troy at freebsd10:~ # clang++ -std=c++11 tl.cpp -o tl
/tmp/tl-7sN7Nb.o: In function `__cxx_global_var_init':
tl.cpp:(.text+0xbb): undefined reference to `__cxa_thread_atexit'
clang++: error: linker command failed with exit code 1 (use -v to see
invocation)
troy at freebsd10:~ #

Has anyone else experienced this? Should I report it as a bug?

Thanks,
Troy Heron


More information about the freebsd-bugs mailing list