Switching x86-64 to GNU2 TLS descriptors
Florian Weimer
fweimer@redhat.com
Tue Jul 15 04:02:12 GMT 2025
* H. J. Lu:
> On Tue, Jul 15, 2025 at 8:47 AM 'Florian Weimer' via X86-64 System V
> Application Binary Interface <x86-64-abi@googlegroups.com> wrote:
>>
>> * H. J. Lu:
>>
>> > Compilers will never know since the build-time glibc is independent of
>> > the run-time glibc. If compilers want to be 100% sure that the run-time
>> > is GNU2 TLS bug-free, they can require linkers which generate the
>> > GLIBC_ABI_GNU2_TLS dependency.
>>
>> (Such a linker requirement could be enforced by requiring that the
>> linker recognizes a command option specific to GLIBC_ABI_GNU2_TLS, and
>> that current linkers treat as an error.)
>>
>> Would such an unconditional requirement be acceptable to GCC 16? I
>> don't think so. So we'd still have to design a configure option for it.
>> And that requires further compiler changes. It's also not entirely
>> clear how this would interact with -fuse-ld.
>>
>> I just don't think option (b) is trivial from a compiler perspective.
>>
>
> It depends on what we want. If we want 100% guarantee of glibc
> run-time GNU2 TLS bug-free, GCC can pass -z gnu2-tls to linker
> whenever GNU2 TLS is used with glibc. It is an error if the linker
> doesn't support -z gnu2-tls. We can provide a GCC option to disable
> -z gnu2-tls.
Unknown -z options are ignored by default:
$ ld -z gnu2-tls
ld: warning: -z gnu2-tls ignored
It would have to be a regular option. But that's just a minor detail.
Thanks,
Florian
More information about the Binutils
mailing list