From patchwork Mon Sep 4 18:18:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 75235 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 F34B3385770F for ; Mon, 4 Sep 2023 18:19:00 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id A9AAB3858C30 for ; Mon, 4 Sep 2023 18:18:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A9AAB3858C30 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 7C5B220149; Mon, 4 Sep 2023 20:18:45 +0200 (CEST) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZHMxpqCjZClg; Mon, 4 Sep 2023 20:18:45 +0200 (CEST) Received: from begin (lfbn-bor-1-1163-184.w92-158.abo.wanadoo.fr [92.158.138.184]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 55B3720147; Mon, 4 Sep 2023 20:18:45 +0200 (CEST) Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1qdE9s-00D1hE-35; Mon, 04 Sep 2023 20:18:44 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Subject: [hurd,commited] __call_tls_dtors: Use call_function_static_weak Date: Mon, 4 Sep 2023 20:18:42 +0200 Message-Id: <20230904181842.3104742-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 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+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" --- htl/pt-exit.c | 5 +---- include/stdlib.h | 6 +----- nptl/pthread_create.c | 5 +---- stdlib/exit.c | 7 ++----- 4 files changed, 5 insertions(+), 18 deletions(-) diff --git a/htl/pt-exit.c b/htl/pt-exit.c index 22b585bb28..cb20a43aab 100644 --- a/htl/pt-exit.c +++ b/htl/pt-exit.c @@ -47,10 +47,7 @@ __pthread_exit (void *status) (*handlers)->__handler ((*handlers)->__arg); /* Call destructors for the thread_local TLS variables. */ -#ifndef SHARED - if (&__call_tls_dtors != NULL) -#endif - __call_tls_dtors (); + call_function_static_weak (__call_tls_dtors); __pthread_setcancelstate (oldstate, &oldstate); diff --git a/include/stdlib.h b/include/stdlib.h index d1d00c0f6f..0ed8271d9b 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -159,11 +159,7 @@ libc_hidden_proto (__cxa_atexit); extern int __cxa_thread_atexit_impl (void (*func) (void *), void *arg, void *d); -extern void __call_tls_dtors (void) -#ifndef SHARED - __attribute__ ((weak)) -#endif - ; +extern void __call_tls_dtors (void); libc_hidden_proto (__call_tls_dtors) extern void __cxa_finalize (void *d); diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index 1ac8862ed2..6a41d50109 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c @@ -446,10 +446,7 @@ start_thread (void *arg) } /* Call destructors for the thread_local TLS variables. */ -#ifndef SHARED - if (&__call_tls_dtors != NULL) -#endif - __call_tls_dtors (); + call_function_static_weak (__call_tls_dtors); /* Run the destructor for the thread-local data. */ __nptl_deallocate_tsd (); diff --git a/stdlib/exit.c b/stdlib/exit.c index d6c188b739..0cf9bf7032 100644 --- a/stdlib/exit.c +++ b/stdlib/exit.c @@ -37,11 +37,8 @@ __run_exit_handlers (int status, struct exit_function_list **listp, bool run_list_atexit, bool run_dtors) { /* First, call the TLS destructors. */ -#ifndef SHARED - if (&__call_tls_dtors != NULL) -#endif - if (run_dtors) - __call_tls_dtors (); + if (run_dtors) + call_function_static_weak (__call_tls_dtors); __libc_lock_lock (__exit_funcs_lock);