From 2a792efe7f9c17b3a89a1e281cb9cbe814c91e16 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 4 Jan 2017 15:41:19 +0000 Subject: [PATCH] PR78968 add configure check for __cxa_thread_atexit in libc PR libstdc++/78968 * config.h.in: Regenerate. * configure: Likewise. * configure.ac: Check for __cxa_thread_atexit. * libsupc++/atexit_thread.cc [_GLIBCXX_HAVE___CXA_THREAD_ATEXIT]: Don't define __cxa_thread_atexit if libc provides it. From-SVN: r244057 --- libstdc++-v3/ChangeLog | 9 +++++++++ libstdc++-v3/config.h.in | 3 +++ libstdc++-v3/configure | 10 ++++++---- libstdc++-v3/configure.ac | 2 +- libstdc++-v3/libsupc++/atexit_thread.cc | 6 +++++- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d0bd7e63fbd..10f362bdd69 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2017-01-04 Jonathan Wakely + + PR libstdc++/78968 + * config.h.in: Regenerate. + * configure: Likewise. + * configure.ac: Check for __cxa_thread_atexit. + * libsupc++/atexit_thread.cc [_GLIBCXX_HAVE___CXA_THREAD_ATEXIT]: + Don't define __cxa_thread_atexit if libc provides it. + 2017-01-04 Ville Voutilainen Implement 2801, Default-constructibility of unique_ptr. diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index 41ad510fbc2..cdd313bef6a 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -700,6 +700,9 @@ /* Define to 1 if you have the `_tanl' function. */ #undef HAVE__TANL +/* Define to 1 if you have the `__cxa_thread_atexit' function. */ +#undef HAVE___CXA_THREAD_ATEXIT + /* Define to 1 if you have the `__cxa_thread_atexit_impl' function. */ #undef HAVE___CXA_THREAD_ATEXIT_IMPL diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index be6763a0e42..8f9264637f7 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -28031,12 +28031,14 @@ $as_echo "#define HAVE_TLS 1" >>confdefs.h fi - for ac_func in __cxa_thread_atexit_impl + for ac_func in __cxa_thread_atexit_impl __cxa_thread_atexit 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 : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF -#define HAVE___CXA_THREAD_ATEXIT_IMPL 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 3d6177116c2..f2f6e0a10c2 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -255,7 +255,7 @@ if $GLIBCXX_IS_NATIVE; then # For TLS support. GCC_CHECK_TLS - AC_CHECK_FUNCS(__cxa_thread_atexit_impl) + AC_CHECK_FUNCS(__cxa_thread_atexit_impl __cxa_thread_atexit) AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc) # For iconv support. diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc index da633682acf..923a0707556 100644 --- a/libstdc++-v3/libsupc++/atexit_thread.cc +++ b/libstdc++-v3/libsupc++/atexit_thread.cc @@ -30,7 +30,11 @@ #include #endif -#if _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL +#if _GLIBCXX_HAVE___CXA_THREAD_ATEXIT + +// Libc provides __cxa_thread_atexit definition. + +#elif _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL extern "C" int __cxa_thread_atexit_impl (void (*func) (void *), void *arg, void *d); -- 2.30.2