From 9deec7c8bab24659e78172dd850f4ca37c57940c Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Thu, 14 May 2020 17:02:38 -0300 Subject: string: Remove old TLS usage on strsignal The per-thread state is refactored two use two strategies: 1. The default one uses a TLS structure, which will be placed in the static TLS space (using __thread keyword). 2. Linux allocates via struct pthread and access it through THREAD_* macros. The default strategy has the disadvantage of increasing libc.so static TLS consumption and thus decreasing the possible surplus used in some scenarios (which might be mitigated by BZ#25051 fix). It is used only on Hurd, where accessing the thread storage in the in single thread case is not straightforward (afaiu, Hurd developers could correct me here). The fallback static allocation used for allocation failure is also removed: defining its size is problematic without synchronizing with translated messages (to avoid partial translation) and the resulting usage is not thread-safe. Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, and s390x-linux-gnu. Tested-by: Carlos O'Donell Reviewed-by: Carlos O'Donell --- malloc/thread-freeres.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'malloc') diff --git a/malloc/thread-freeres.c b/malloc/thread-freeres.c index c71ca4fc33..3408bdbefd 100644 --- a/malloc/thread-freeres.c +++ b/malloc/thread-freeres.c @@ -21,6 +21,7 @@ #include #include #include +#include /* Thread shutdown function. Note that this function must be called for threads during shutdown for correctness reasons. Unlike @@ -32,6 +33,7 @@ __libc_thread_freeres (void) call_function_static_weak (__rpc_thread_destroy); call_function_static_weak (__res_thread_freeres); call_function_static_weak (__strerror_thread_freeres); + __glibc_tls_internal_free (); /* This should come last because it shuts down malloc for this thread and the other shutdown functions might well call free. */ -- cgit v1.2.3