]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
__call_tls_dtors: Use call_function_static_weak
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 4 Sep 2023 18:03:37 +0000 (20:03 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 4 Sep 2023 18:03:37 +0000 (20:03 +0200)
htl/pt-exit.c
include/stdlib.h
nptl/pthread_create.c
stdlib/exit.c

index 22b585bb28b8c84bae240005f779b8c76c5b5b53..cb20a43aab4b8f3e1471bc011dee94b45cfeebce 100644 (file)
@@ -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);
 
index d1d00c0f6f262df3b2f0354f70f726123f821a1a..0ed8271d9bd76896fd3fe491a0f39691d7680503 100644 (file)
@@ -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);
index 1ac8862ed2c0ecd62394984cde7e1fbc5865a4c1..6a41d50109cb27ecc09e56ced4745b7f83c06e07 100644 (file)
@@ -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 ();
index d6c188b739234fae3fb12c5211ec5864b2c5efb4..0cf9bf703243aa67b48a82f9c869c9e171dff62b 100644 (file)
@@ -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);