[PATCH v2] aarch64: Skip traditional GD/LD TLS which are unsupported by Clang and LLD [BZ #28205]

Fangrui Song maskray@google.com
Wed Aug 11 15:57:18 GMT 2021


On 2021-08-11, Szabolcs Nagy wrote:
>The 08/10/2021 14:14, Fangrui Song via Libc-alpha wrote:
>> On 2021-08-10, Fangrui Song wrote:
>> > TLSDESC is the default on aarch64.  Clang doesn't support
>> > -mtls-dialect=trad.  Its integrated assembler doesn't support the
>> > marker.  LLD's doesn't support R_AARCH64_TLSGD_*/R_AARCH64_TLSLD_*
>> > relocations.  Just skip the tests.
>> >
>> > With https://sourceware.org/pipermail/libc-alpha/2021-August/129966.html
>> > ("aarch64: Make elf_machine_{load_address, dynamic} robust [BZ #28203]"),
>> > if we allow LLD in configure.ac,
>> > `make check` test results of LLD are on par with GNU ld.
>>
>> I messed up in the diff.
>> The correct diff needs `#include <config.h>` to make HAVE_TRAD_TLS
>> defined.
>
>the fixed patch looks good to me.
>
>but now i looked at elf/tls-macros.h and it seems
>to be for when there is on compiler support.
>
>i think the only thing the compiler does not
>support is mixing different tls access models to a
>variable in the same tu, but i'm not sure if that's
>useful or necessary for the tests: we can use many
>files with different -ftls-model= or
>__attribute__((tls_model(...))).
>
>is there a need for these hard to maintain macros?

In GCC, mixing different tls access models to a variable in the same tu
can be emulated by:

   __thread int a __attribute__((tls_model("global-dynamic")));
   extern __thread int b __attribute__((alias("a"), tls_model("initial-exec")));

In Clang only one model is used.


Seems a good idea to switch them to variable attributes.


More information about the Libc-alpha mailing list