public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Samuel Thibault <sthibaul@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] __call_tls_dtors: Use call_function_static_weak
Date: Mon,  4 Sep 2023 18:18:30 +0000 (GMT)	[thread overview]
Message-ID: <20230904181830.D036F3858C30@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6333a6014f32c7ced36ced610d5a5cecbafba6c3

commit 6333a6014f32c7ced36ced610d5a5cecbafba6c3
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Mon Sep 4 20:03:37 2023 +0200

    __call_tls_dtors: Use call_function_static_weak

Diff:
---
 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);

                 reply	other threads:[~2023-09-04 18:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230904181830.D036F3858C30@sourceware.org \
    --to=sthibaul@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).