[PATCH] [libcxxabi] Add __cxa_thread_atexit for TLS support on Linux.

David Majnemer david.majnemer at gmail.com
Wed Dec 17 14:13:57 PST 2014


================
Comment at: src/cxa_thread_atexit.cpp:18-20
@@ +17,5 @@
+                        void *dso_symbol) throw() {
+  extern int __cxa_thread_atexit_impl(void (*)(void *), void *, void *);
+  return __cxa_thread_atexit_impl(dtor, obj, dso_symbol);
+}
+
----------------
danalbert wrote:
> majnemer wrote:
> > The only libc which provides `__cxa_thread_atexit_impl` is glibc.  Other libc implementations on linux do not and it doesn't seem available on the BSDs.
> > 
> > I think it makes sense to forward to `__cxa_thread_atexit_impl` if the symbol exists, otherwise we need to have a definition of `__cxa_thread_atexit` which can do the real heavy lifting.
> Oops. I added a guard to the header to make sure this was only there on Linux but forgot to do the same here and in the test.
> 
> BTW, glibc is the only one that supports it for now, but we're working on adding it to Bionic.
> 
> As for non-glibc libc implementations for non-Android Linux, are you thinking about newlib/musl? Those implementations would just need to add support for this if they want this kind of TLS; I don't think we need to add it here.
musl does not which makes me feel like we shouldn't unconditionally try to provide it.

I think it would make more sense to make it conditional on `_GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL`.  Bionic can create its own way to signal that it has the function.

http://reviews.llvm.org/D6708

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list