public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/vineet/upstream-work] htl: Fix registration of atfork handlers in modules
@ 2020-06-19  2:44 Vineet Gupta
  0 siblings, 0 replies; only message in thread
From: Vineet Gupta @ 2020-06-19  2:44 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=15e995a8fb94a00d76da03756579ae6ff645b161

commit 15e995a8fb94a00d76da03756579ae6ff645b161
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sun Jun 7 23:29:44 2020 +0000

    htl: Fix registration of atfork handlers in modules
    
    We really need modules to use their own pthread_atfork so that
    __dso_handle properly identifies them.
    
    * sysdeps/htl/pt-atfork.c (__pthread_atfork): Hide function.
    (pthread_atfork): Hide alias.
    * sysdeps/htl/old_pt-atfork.c (pthread_atfork): Rename macro to
    __pthread_atfork to fix building the compatibility alias.

Diff:
---
 sysdeps/htl/old_pt-atfork.c |  4 ++--
 sysdeps/htl/pt-atfork.c     | 10 ++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/sysdeps/htl/old_pt-atfork.c b/sysdeps/htl/old_pt-atfork.c
index d954b68f63..c7231d1feb 100644
--- a/sysdeps/htl/old_pt-atfork.c
+++ b/sysdeps/htl/old_pt-atfork.c
@@ -19,8 +19,8 @@
 #include <shlib-compat.h>
 
 #if SHLIB_COMPAT(libpthread, GLIBC_2_12, GLIBC_2_23)
-# define pthread_atfork __dyn_pthread_atfork
+# define __pthread_atfork __dyn_pthread_atfork
 # include "pt-atfork.c"
-# undef pthread_atfork
+# undef __pthread_atfork
 compat_symbol (libpthread, __dyn_pthread_atfork, pthread_atfork, GLIBC_2_12);
 #endif
diff --git a/sysdeps/htl/pt-atfork.c b/sysdeps/htl/pt-atfork.c
index d547dd58e6..db8068e656 100644
--- a/sysdeps/htl/pt-atfork.c
+++ b/sysdeps/htl/pt-atfork.c
@@ -21,11 +21,21 @@
 #include <fork.h>
 #include <dso_handle.h>
 
+/* Hide the symbol so that no definition but the one locally in the
+   executable or DSO is used.  */
 int
+#ifndef __pthread_atfork
+/* Don't mark the compatibility function as hidden.  */
+attribute_hidden
+#endif
 __pthread_atfork (void (*prepare) (void),
 		void (*parent) (void),
 		void (*child) (void))
 {
   return __register_atfork (prepare, parent, child, __dso_handle);
 }
+#ifndef __pthread_atfork
+extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
+                           void (*child) (void)) attribute_hidden;
 weak_alias (__pthread_atfork, pthread_atfork)
+#endif


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-19  2:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-19  2:44 [glibc/vineet/upstream-work] htl: Fix registration of atfork handlers in modules Vineet Gupta

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