[PATCH] elf: Drop elf/tls-macros.h in favor of __thread and tls_model attributes [BZ #28152] [BZ #28205]

Szabolcs Nagy szabolcs.nagy@arm.com
Thu Aug 12 09:16:40 GMT 2021


The 08/11/2021 15:11, Fangrui Song via Libc-alpha wrote:
> On 2021-08-11, Joseph Myers wrote:
> > On Wed, 11 Aug 2021, Fangrui Song via Libc-alpha wrote:
> > 
> > > As a future clean-up, TLS_LD/TLS_IE/TLS_IE macros can be removed from
> > > sysdeps/*/tls-macros.h. aarch64 TLS_GD definition should be retained to
> > > test traditional TLS GD while the toolchain default is TLSDESC.
> > 
> > It might be better to test different TLS dialects through the compiler
> > generating appropriate code rather than keeping such macros around.  E.g.,
> > have a way for architectures to declare a set of supported -mtls-dialect=
> > arguments (or detect them at configure time, at present there's a test for
> > -mtls-dialect=gnu2 support), and, when more than one dialect is supported,
> > run various tests explicitly for each dialect supported by the compiler,
> > in addition to testing whatever the default dialect is.

yeah i prefer not to keep TLS_GD for aarch64 but
use -mtls-dialect= for tests if we care enough.

>   __thread int foo, bar;
>   extern __thread int foo_gd asm ("foo") __attribute__ ((tls_model("global-dynamic")));
>   extern __thread int foo_ld asm ("foo") __attribute__ ((tls_model("local-dynamic")));
>   extern __thread int foo_ie asm ("foo") __attribute__ ((tls_model("initial-exec")));
>   extern __thread int bar_gd asm ("bar") __attribute__ ((tls_model("global-dynamic")));
>   extern __thread int bar_ld asm ("bar") __attribute__ ((tls_model("local-dynamic")));
>   extern __thread int bar_ie asm ("bar") __attribute__ ((tls_model("initial-exec")));
> 
> Add
> 
>   extern __thread int foo_le asm ("foo") __attribute__ ((tls_model("local-exec")));
> 
> even if the default foo for non-PIC is local-exec?

i think adding an explicit declaration like that is clearer.


More information about the Libc-alpha mailing list