This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libstdc++: add _GLIBCXX_ macro prefix in atexit_thread.cc


On 30/07/14 23:36 +0800, Zifei Tong wrote:
On Wed, Jul 30, 2014 at 11:25 PM, Jonathan Wakely <jwakely@redhat.com> wrote:
On 30/07/14 22:42 +0800, Zifei Tong wrote:

Hi,

I found an issue that the __cxa_thread_atexit_impl() function never called
by
__cxa_thread_atexit() even with newest glibc which have
__cxa_thread_atexit_impl
implemented.

It turns out that the code tried to use macro
HAVE___CXA_THREAD_ATEXIT_IMPL, but
not _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL which is defined in
bits/c++config.h
(generated from autoconf scripts).

This patch adds the missing macro prefix.


The patch is correct, thanks very much.

Do you have commit access?
I don't think so, this is my first patch to gcc :)

If not I can do it for you.
Thanks!

I've committed the attached patch to trunk, I'll apply it to the 4.8
and 4.9 branches soon too.

Tested x86_64-linux, with both glibc 2.11 and 2.18 so with and without
__cxa_thread_atexit_impl.

Thanks again for the report and patch.

commit ecaf491ba1a82e858b8a0654efeee74e55c74c05
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Aug 1 19:53:58 2014 +0100

    2014-08-01  Zifei Tong  <zifeitong@gmail.com>
    
    	* libsupc++/atexit_thread.cc (HAVE___CXA_THREAD_ATEXIT_IMPL): Add
    	_GLIBCXX_ prefix to macro.

diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc
index db20200..dff08e9 100644
--- a/libstdc++-v3/libsupc++/atexit_thread.cc
+++ b/libstdc++-v3/libsupc++/atexit_thread.cc
@@ -26,7 +26,7 @@
 #include <new>
 #include "bits/gthr.h"
 
-#if HAVE___CXA_THREAD_ATEXIT_IMPL
+#if _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
 
 extern "C" int __cxa_thread_atexit_impl (void (*func) (void *),
 					 void *arg, void *d);
@@ -38,7 +38,7 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *),
   return __cxa_thread_atexit_impl (dtor, obj, dso_handle);
 }
 
-#else /* HAVE___CXA_THREAD_ATEXIT_IMPL */
+#else /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
 
 namespace {
   // One element in a singly-linked stack of cleanups.
@@ -142,4 +142,4 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha
   return 0;
 }
 
-#endif /* HAVE___CXA_THREAD_ATEXIT_IMPL */
+#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]