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

Jens Remus jremus@linux.ibm.com
Thu Jul 31 09:31:16 GMT 2025


On 7/30/2025 5:21 PM, Jens Remus wrote:
> On 7/29/2025 4:03 PM, Florian Weimer wrote:
>> * Jens Remus:
>>
>>> Commit 10a66a8e421b ("Remove <libc-tsd.h>") removed the TLS initial-exec
>>> (IE) model attribute from the __libc_tsd_* thread variable declarations
>>> and definitions.  Commit a894f04d8776 ("Optimize __libc_tsd_* thread
>>> variable access") restored it on declarations.
>>>
>>> Restore the TLS initial-exec model attribute on __libc_tsd_* thread
>>> variable definitions.
>>>
>>> This resolves test tst-locale1 failure on s390 32-bit, when using a
>>> GNU linker without the fix from GNU binutils commit aefebe82dc89
>>> ("IBM zSystems: Fix offset relative to static TLS").
>>>
>>> Signed-off-by: Jens Remus <jremus@linux.ibm.com>

>> It's weird that the declaration in include/ctype.h is not applied by the
>> compiler (and neither is the command line option).  Isn't this a
>> compiler bug?

>> I'm okay with this as a workaround.
>>
>> Reviewed-by: Florian Weimer <fweimer@redhat.com>
> 
> Thanks you!  Stefan would take care to commit during my leave, provided
> there are no objections.

In the PR for this issue Andrew Pinski referred to a post by Jakub
Jelinek, that the attribute is required on both the declaration and
definition to be correct:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78294#c18
(via https://sourceware.org/bugzilla/show_bug.cgi?id=33234#c3)

So Stefan (or I) should probably reword the commit message to refer
to that as well and go ahead and commit?

Thanks Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
+49-7031-16-1128 Office
jremus@de.ibm.com

IBM

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/



More information about the Libc-alpha mailing list