[PATCH] Use TLS initial-exec model for __libc_tsd_* thread variables

Florian Weimer fweimer@redhat.com
Thu Jul 31 10:01:06 GMT 2025


* Jens Remus:

> On 7/30/2025 5:51 PM, H.J. Lu wrote:
>> On Wed, Jul 30, 2025 at 8:22 AM Jens Remus <jremus@linux.ibm.com> wrote:
>>>
>>> One or more of the following files ( sample.sh ) violates IBM policy
>> and all attachment(s) have been removed from the message.
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> 
>> Please open a glibc bug report with your test.
>
> Argh!  Sorry!  Done:
> https://sourceware.org/pr33234
>
> @Stefan: Please add a reference to that PR to my patch if you commit it,
> so hat the PR gets updated.

So with the wider context, we have two separate but related issues here:

(1) Specifying the initial-exec TLS model using the GCC attribute results
    in a pessimization for static builds.  This prevents GCC from using
    the local-exec model directly, relying on linker relaxation instead.

(2) An issue when relaxing initial-exec TLS to local-exec TLS in the S390
    link editor.

It's not clear to me how the proposed patch fixes (2).  Does it stop the
optimization from happening?  I'm okay with applying this as a
workaround, given that it makes TLS usage more consistent.

Eventually, we should use local-exec TLS for libc.a, addressing (1).
I hope it won't bring back the S390 bug.

Thanks,
Florian



More information about the Libc-alpha mailing list