https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113211
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |RESOLVED Resolution|--- |WONTFIX --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Not a GCC bug as GCC is not involved here, thread_local might be a C/C++ concept and the compiler generates code to use per thread local variables but it is it is glibc which implements __tls_get_addr for use in shared libraries. Also I doubt this is a glibc issue either. Basically if you use getpwuid, etc. in a static linked executable, it will use dlopen and TLS in a shared library is not compatiable with a static linked executable.