public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH to libstdc++ to use __cxa_thread_atexit_impl if available
@ 2013-01-19 17:22 Jason Merrill
  2013-01-21 14:29 ` Jakub Jelinek
  2013-02-26  4:38 ` Jason Merrill
  0 siblings, 2 replies; 5+ messages in thread
From: Jason Merrill @ 2013-01-19 17:22 UTC (permalink / raw)
  To: gcc-patches List, libstdc++; +Cc: Siddhesh Poyarekar, Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 567 bytes --]

Siddhesh has a patch to implement the thread atexit functionality in 
glibc in order to integrate better with the dynamic loader and run the 
cleanups in the correct order.  Once it's available there, this patch 
will make the copy in libsupc++ use it.  The main __cxa_thread_atexit 
function will always live in libsupc++, however, in order to maintain 
ABI compatibility between releases of libstdc++.

Does this configure change look right, or should it go in linkage.m4 
somewhere?

I think I'll hold off checking this in until Siddhesh's patch goes into 
glibc.

[-- Attachment #2: atexit-impl.patch --]
[-- Type: text/x-patch, Size: 2607 bytes --]

commit cba5e8c2535f5950d1c78a6c35a2f83d549f37dc
Author: Jason Merrill <jason@redhat.com>
Date:   Sat Jan 19 12:08:25 2013 -0500

    	* 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.

diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index dd14b91..c14862d 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -652,6 +652,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 a4cf5c9..f53b9cf 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -26584,6 +26584,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 66164a2..a64fee2 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 95bdcf0..ce26717 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 */

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH to libstdc++ to use __cxa_thread_atexit_impl if available
  2013-01-19 17:22 PATCH to libstdc++ to use __cxa_thread_atexit_impl if available Jason Merrill
@ 2013-01-21 14:29 ` Jakub Jelinek
  2013-02-26  4:38 ` Jason Merrill
  1 sibling, 0 replies; 5+ messages in thread
From: Jakub Jelinek @ 2013-01-21 14:29 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches List, libstdc++, Siddhesh Poyarekar

On Sat, Jan 19, 2013 at 12:22:23PM -0500, Jason Merrill wrote:
> Siddhesh has a patch to implement the thread atexit functionality in
> glibc in order to integrate better with the dynamic loader and run
> the cleanups in the correct order.  Once it's available there, this
> patch will make the copy in libsupc++ use it.  The main
> __cxa_thread_atexit function will always live in libsupc++, however,
> in order to maintain ABI compatibility between releases of
> libstdc++.
> 
> Does this configure change look right, or should it go in linkage.m4
> somewhere?
> 
> I think I'll hold off checking this in until Siddhesh's patch goes
> into glibc.

Yeah, it should make it into glibc first (no idea why is it taking so long),
otherwise we can't be sure it won't be implemented differently in glibc.

	Jakub

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH to libstdc++ to use __cxa_thread_atexit_impl if available
  2013-01-19 17:22 PATCH to libstdc++ to use __cxa_thread_atexit_impl if available Jason Merrill
  2013-01-21 14:29 ` Jakub Jelinek
@ 2013-02-26  4:38 ` Jason Merrill
  1 sibling, 0 replies; 5+ messages in thread
From: Jason Merrill @ 2013-02-26  4:38 UTC (permalink / raw)
  To: gcc-patches List, libstdc++; +Cc: Siddhesh Poyarekar, Jakub Jelinek

On 01/19/2013 12:22 PM, Jason Merrill wrote:
> I think I'll hold off checking this in until Siddhesh's patch goes into
> glibc.

It's in now, so I'm going to go ahead and check in my patch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH to libstdc++ to use __cxa_thread_atexit_impl if available
  2013-01-23  0:24 Siddhesh Poyarekar
@ 2013-01-23  4:09 ` Carlos O'Donell
  0 siblings, 0 replies; 5+ messages in thread
From: Carlos O'Donell @ 2013-01-23  4:09 UTC (permalink / raw)
  To: Siddhesh Poyarekar
  Cc: Jakub Jelinek, Jason Merrill, gcc-patches, libstdc++, Siddhesh Poyarekar

On 01/22/2013 07:24 PM, Siddhesh Poyarekar wrote:
> Cc'ing Carlos on this so that he's aware of it.
> 
> Siddhesh
> 
> Jakub Jelinek <jakub@redhat.com> wrote:
> 
> On Sat, Jan 19, 2013 at 12:22:23PM -0500, Jason Merrill wrote:
>> Siddhesh has a patch to implement the thread atexit functionality in
>> glibc in order to integrate better with the dynamic loader and run
>> the cleanups in the correct order.  Once it's available there, this
>> patch will make the copy in libsupc++ use it.  The main
>> __cxa_thread_atexit function will always live in libsupc++, however,
>> in order to maintain ABI compatibility between releases of
>> libstdc++.
>>
>> Does this configure change look right, or should it go in linkage.m4
>> somewhere?
>>
>> I think I'll hold off checking this in until Siddhesh's patch goes
>> into glibc.
> 
> Yeah, it should make it into glibc first (no idea why is it taking so long),
> otherwise we can't be sure it won't be implemented differently in glibc.
> 
> 	Jakub
> 

If there is a patch that needs to be reviewed immediately
then Siddhesh should ping that patch and CC me so I can
do a timely review. I'll look into this patch tomorrow.

In general we lack qualified reviewers in glibc.
We try our best to get through the incoming patches,
but given the new friendliness of the community
we're flooded with patches, but not with reviewers.

Please have patience has the community grows up.

Cheers,
Carlos.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH to libstdc++ to use __cxa_thread_atexit_impl if available
@ 2013-01-23  0:24 Siddhesh Poyarekar
  2013-01-23  4:09 ` Carlos O'Donell
  0 siblings, 1 reply; 5+ messages in thread
From: Siddhesh Poyarekar @ 2013-01-23  0:24 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Jason Merrill, gcc-patches, libstdc++, Siddhesh Poyarekar, codonell

Cc'ing Carlos on this so that he's aware of it.

Siddhesh

Jakub Jelinek <jakub@redhat.com> wrote:

On Sat, Jan 19, 2013 at 12:22:23PM -0500, Jason Merrill wrote:
> Siddhesh has a patch to implement the thread atexit functionality in
> glibc in order to integrate better with the dynamic loader and run
> the cleanups in the correct order.  Once it's available there, this
> patch will make the copy in libsupc++ use it.  The main
> __cxa_thread_atexit function will always live in libsupc++, however,
> in order to maintain ABI compatibility between releases of
> libstdc++.
> 
> Does this configure change look right, or should it go in linkage.m4
> somewhere?
> 
> I think I'll hold off checking this in until Siddhesh's patch goes
> into glibc.

Yeah, it should make it into glibc first (no idea why is it taking so long),
otherwise we can't be sure it won't be implemented differently in glibc.

	Jakub

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-02-26  4:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-19 17:22 PATCH to libstdc++ to use __cxa_thread_atexit_impl if available Jason Merrill
2013-01-21 14:29 ` Jakub Jelinek
2013-02-26  4:38 ` Jason Merrill
2013-01-23  0:24 Siddhesh Poyarekar
2013-01-23  4:09 ` Carlos O'Donell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).