tavianator added inline comments. ================ Comment at: src/cxa_thread_atexit.cpp:36-47 @@ +35,14 @@ + public: + DtorListHolder() { + pthread_key_create(&key_, run_dtors); + } + + ~DtorListHolder() { + run_dtors(get()); + pthread_key_delete(key_); + } + + DtorList* get() { + return static_cast<DtorList*>(pthread_getspecific(key_)); + } + ---------------- majnemer wrote: > What happens if `pthread_key_create` fails? Nothing good! I'll add the necessary error handling.
================ Comment at: src/cxa_thread_atexit.cpp:61-67 @@ -18,6 +60,9 @@ +_LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(Dtor dtor, void *obj, void *dso_symbol) throw() { - extern int __cxa_thread_atexit_impl(void (*)(void *), void *, void *); - return __cxa_thread_atexit_impl(dtor, obj, dso_symbol); -} + extern int __cxa_thread_atexit_impl(Dtor, void *, void *) + __attribute__((__weak__)); -#endif // HAVE__CXA_THREAD_ATEXIT_IMPL + if (__cxa_thread_atexit_impl) { + return __cxa_thread_atexit_impl(dtor, obj, dso_symbol); + } else { + static DtorListHolder dtors; ---------------- majnemer wrote: > Is there a reason to use the weak symbol on non-Android platforms? Just simplicity. (There are some fringe benefits, like the ability to build against pre-2.18 glibc but have it detect ..._impl() support when run with newer libraries. Or magically supporting musl etc. if they add it, without having to recompile.) Would you rather keep the build-time checks for non-Android platforms? http://reviews.llvm.org/D21803 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits