[PATCH] elf: Remove the GET_ADDR_ARGS and related macros from the TLS code
Florian Weimer
fweimer@redhat.com
Fri Dec 27 12:03:11 GMT 2024
* Florian Weimer:
> This was used to manage an IA-64 ABI divergence is no longere needed
> after the IA-64 removal.
>
> (It should be possible to encode all the required information in
> one machine word, so the pointer indirection is really unnecessary.
> Technically, none of this is part of the ABI, so perhaps it's
> possible to do this retroactively. See bug 27404.)
>
> Tested on x86_64-linux-gnu. Built with build-many-glibcs.py.
>
> ---
> elf/dl-tls.c | 55 +++++++++++++++++--------------------------------
> sysdeps/x86_64/dl-tls.c | 8 +++----
> 2 files changed, 23 insertions(+), 40 deletions(-)
>
> diff --git a/elf/dl-tls.c b/elf/dl-tls.c
> index 3d529b722c..4df83b9bb2 100644
> --- a/elf/dl-tls.c
> +++ b/elf/dl-tls.c
> @@ -695,23 +695,6 @@ rtld_hidden_def (_dl_deallocate_tls)
>
>
> #ifdef SHARED
> -/* The __tls_get_addr function has two basic forms which differ in the
> - arguments. The IA-64 form takes two parameters, the module ID and
> - offset. The form used, among others, on IA-32 takes a reference to
> - a special structure which contain the same information. The second
> - form seems to be more often used (in the moment) so we default to
> - it. Users of the IA-64 form have to provide adequate definitions
> - of the following macros. */
> -# ifndef GET_ADDR_ARGS
> -# define GET_ADDR_ARGS tls_index *ti
> -# define GET_ADDR_PARAM ti
> -# endif
> -# ifndef GET_ADDR_MODULE
> -# define GET_ADDR_MODULE ti->ti_module
> -# endif
> -# ifndef GET_ADDR_OFFSET
> -# define GET_ADDR_OFFSET ti->ti_offset
> -# endif
So it turns out this comment was very misleading. GET_ADDR_ARGS is
indeed specific to IA-64, but GET_ADDR_OFFSET was used on various other
architectures. This breaks TLS on s390x, among other things.
I'm working on a fix.
Thanks,
Florian
More information about the Libc-alpha
mailing list