From patchwork Mon Jun 8 00:06:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 39510 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CFFF73870867; Mon, 8 Jun 2020 00:06:43 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from hera.aquilenet.fr (hera.aquilenet.fr [IPv6:2a0c:e300::1]) by sourceware.org (Postfix) with ESMTPS id 8A60C3851C0B for ; Mon, 8 Jun 2020 00:06:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8A60C3851C0B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=samuel.thibault@ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 98AFE37F0; Mon, 8 Jun 2020 02:06:40 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r3SSwIBkZa8C; Mon, 8 Jun 2020 02:06:39 +0200 (CEST) Received: from function (lfbn-bor-1-797-11.w86-234.abo.wanadoo.fr [86.234.239.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 5A98C37F7; Mon, 8 Jun 2020 02:06:37 +0200 (CEST) Received: from samy by function with local (Exim 4.93) (envelope-from ) id 1ji5JD-00Etuf-Nk; Mon, 08 Jun 2020 02:06:35 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Subject: [hurd, commited 4/5] htl: Fix registration of atfork handlers in modules Date: Mon, 8 Jun 2020 02:06:32 +0200 Message-Id: <20200608000633.3551460-5-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200608000633.3551460-1-samuel.thibault@ens-lyon.org> References: <20200608000633.3551460-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: commit-hurd@gnu.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" 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. --- 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 #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 #include +/* 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