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

Fangrui Song maskray@google.com
Wed Aug 11 22:11:50 GMT 2021


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.

Hi Joseph,

Thanks for the your comments. Do you have specific suggestion on this
patch?

   __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?


More information about the Libc-alpha mailing list