about summary refs log tree commit diff
path: root/malloc
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-05-11 11:08:00 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-05-11 11:22:33 +0200
commitc79a31fb36fe265f7566bea622849b06c94b4022 (patch)
tree59bd2a7dde0670f24c0170a49038111c99008e65 /malloc
parent249bd833a08e2689e28ff9a094730f0b048a8442 (diff)
downloadglibc-c79a31fb36fe265f7566bea622849b06c94b4022.tar.gz
glibc-c79a31fb36fe265f7566bea622849b06c94b4022.tar.xz
glibc-c79a31fb36fe265f7566bea622849b06c94b4022.zip
nptl: Move stack cache management, __libpthread_freeres into libc
This replaces the FREE_P macro with the __nptl_stack_in_use inline
function.  stack_list_del is renamed to __nptl_stack_list_del,
stack_list_add to __nptl_stack_list_add, __deallocate_stack to
__nptl_deallocate_stack, free_stacks to __nptl_free_stacks.

It is convenient to move __libpthread_freeres into libc at the
same time.  This removes the temporary __default_pthread_attr_freeres
export and restores full freeres coverage for __default_pthread_attr.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'malloc')
-rw-r--r--malloc/set-freeres.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/malloc/set-freeres.c b/malloc/set-freeres.c
index d404250151..5c19a2725c 100644
--- a/malloc/set-freeres.c
+++ b/malloc/set-freeres.c
@@ -29,7 +29,15 @@ DEFINE_HOOK (__libc_subfreeres, (void));
 
 symbol_set_define (__libc_freeres_ptrs);
 
-extern __attribute__ ((weak)) void __libpthread_freeres (void);
+extern void __libpthread_freeres (void)
+#if PTHREAD_IN_LIBC && defined SHARED
+/* It is possible to call __libpthread_freeres directly in shared
+   builds with an integrated libpthread.  */
+  attribute_hidden
+#else
+  __attribute__ ((weak))
+#endif
+  ;
 
 void __libc_freeres_fn_section
 __libc_freeres (void)
@@ -51,10 +59,7 @@ __libc_freeres (void)
       /* We run the resource freeing after IO cleanup.  */
       RUN_HOOK (__libc_subfreeres, ());
 
-      /* Call the libpthread list of cleanup functions
-	 (weak-ref-and-check).  */
-      if (&__libpthread_freeres != NULL)
-	__libpthread_freeres ();
+      call_function_static_weak (__libpthread_freeres);
 
 #ifdef SHARED
       __libc_unwind_link_freeres ();