diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8e4d68f77b5c02a3132758bce063fee896a4083d..7681c73725ef56872b0a5079e9304bdd666198a1 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2013-02-25 Jason Merrill <jason@redhat.com> + + * configure.ac: Check for __cxa_thread_atexit_impl. + * libsupc++/atexit_thread.cc (__cxa_thread_atexit): Just forward + to it if available. + * config.h.in, configure: Regenerate. + 2013-02-20 Jonathan Wakely <jwakely.gcc@gmail.com> * include/std/streambuf (basic_streambuf): Use injected class name diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index 59a7fae0fbde385ef2dcecff9bd67abd688d3bbf..07a1e50be1f794fb39dec7482999f33bd378c48b 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -658,6 +658,9 @@ /* Define to 1 if you have the `_tanl' function. */ #undef HAVE__TANL +/* Define to 1 if you have the `__cxa_thread_atexit_impl' function. */ +#undef HAVE___CXA_THREAD_ATEXIT_IMPL + /* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 008ccbfc9a32b7faa5e9bee554a1429a8120b674..bf397f5cf12406003542e59eca586ca8803caf2c 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -26700,6 +26700,18 @@ $as_echo "#define HAVE_TLS 1" >>confdefs.h fi + for ac_func in __cxa_thread_atexit_impl +do : + ac_fn_c_check_func "$LINENO" "__cxa_thread_atexit_impl" "ac_cv_func___cxa_thread_atexit_impl" +if test "x$ac_cv_func___cxa_thread_atexit_impl" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE___CXA_THREAD_ATEXIT_IMPL 1 +_ACEOF + +fi +done + + # For iconv support. if test "X$prefix" = "XNONE"; then diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 66164a22628b31d19091657e1515b8d3df3abbce..a64fee28c2cabdabfc3bbf90f2df93799ef2f199 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -235,6 +235,8 @@ if $GLIBCXX_IS_NATIVE; then # For TLS support. GCC_CHECK_TLS + AC_CHECK_FUNCS(__cxa_thread_atexit_impl) + # For iconv support. AM_ICONV diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc index da8571c82d3d3834a8d79a7920639be8f2c695a5..3b33df233e817184fb14b3804e94480b595b7fd9 100644 --- a/libstdc++-v3/libsupc++/atexit_thread.cc +++ b/libstdc++-v3/libsupc++/atexit_thread.cc @@ -26,6 +26,20 @@ #include <new> #include "bits/gthr.h" +#if HAVE___CXA_THREAD_ATEXIT_IMPL + +extern "C" int __cxa_thread_atexit_impl (void (*func) (void *), + void *arg, void *d); +extern "C" int +__cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), + void *obj, void *dso_handle) + _GLIBCXX_NOTHROW +{ + return __cxa_thread_atexit_impl (dtor, obj, dso_handle); +} + +#else /* HAVE___CXA_THREAD_ATEXIT_IMPL */ + namespace { // One element in a singly-linked stack of cleanups. struct elt @@ -116,3 +130,5 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha return 0; } + +#endif /* HAVE___CXA_THREAD_ATEXIT_IMPL */