[PATCH 05/13] string: Remove old TLS usage on strsignal

Florian Weimer fweimer@redhat.com
Thu May 28 11:38:04 GMT 2020


* Adhemerval Zanella via Libc-alpha:

> The per-thread state is refactored two use two strategies:
>
>   1. The default one uses a TLS structure, which will be place in the
>      static TLS space (using __thread keyword).
>
>   2. Linux allocates on struct pthread and access it through THREAD_*
>      macros.

Hurd can use the same infrastructure nowadays, since commit
b65a82e4e757c1e6cb7073916a29 ("hurd: Add THREAD_GET/SETMEM/_NC").

I'm not sure if struct tls_internal_t is necessary at this point.

> diff --git a/malloc/thread-freeres.c b/malloc/thread-freeres.c
> index c71ca4fc33..d42eea770b 100644
> --- a/malloc/thread-freeres.c
> +++ b/malloc/thread-freeres.c
> @@ -32,6 +32,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);
> +  call_function_static_weak (__strsignal_thread_freeres);

I think you can call free directly.  I doubt it increases binary
size—the data is in the thread descriptor, so nothing needs to be pulled
into the link for this.

Thanks,
Florian



More information about the Libc-alpha mailing list