aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-09-04 20:03:37 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-09-04 20:03:37 +0200
commit6333a6014f32c7ced36ced610d5a5cecbafba6c3 (patch)
tree48a3cd9f10e8fb27ee36f76ad25d668bbebcbaac
parent2897b231a6b71ee17d47d3d63f1112b2641a476c (diff)
downloadglibc-6333a6014f32c7ced36ced610d5a5cecbafba6c3.zip
glibc-6333a6014f32c7ced36ced610d5a5cecbafba6c3.tar.gz
glibc-6333a6014f32c7ced36ced610d5a5cecbafba6c3.tar.bz2
__call_tls_dtors: Use call_function_static_weak
-rw-r--r--htl/pt-exit.c5
-rw-r--r--include/stdlib.h6
-rw-r--r--nptl/pthread_create.c5
-rw-r--r--stdlib/exit.c7
4 files changed, 5 insertions, 18 deletions
diff --git a/htl/pt-exit.c b/htl/pt-exit.c
index 22b585b..cb20a43 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 d1d00c0..0ed8271 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 1ac8862..6a41d50 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 d6c188b..0cf9bf7 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);