On Thu, Oct 04, 2012 at 01:38:38PM -0400, Jason Merrill wrote: > commit 18c01be0ec8b7a3cda6a16e86356e8e434c12f89 > Author: Jason Merrill <ja...@redhat.com> > Date: Thu Sep 20 16:00:08 2012 -0400 > > Support C++11 thread_local destructors. > libstdc++-v3/ > * libsupc++/cxxabi.h: Declare __cxa_thread_atexit. > * libsupc++/atexit_thread.cc: New. > * libsupc++/Makefile.am (nested_exception.lo): Add it. > * config/abi/pre/gnu.ver: Add __cxa_thread_atexit.
If we want to add it to glibc, then it shouldn't be exported from libstdc++ (or perhaps only as a fallback implementation; the question is what to do if non-Linux targets add __cxa_thread_atexit to their C libraries). If this is a fallback implementation, then it needs to have some destructor that will call pthread_key_delete (well, its __gthread_* wrapper), so that it libstdc++.so is dlclosed, things don't crash (well, they likely will anyway if the C++ shared library using thread_local destructors is dlclosed with multiple running threads, but in the libstdc++ case it is at least avoidable). Jakub