From 940d821afb0e50e5e5c8a54fe83c29c3b7e4d72d Mon Sep 17 00:00:00 2001 From: Jens Remus Date: Fri, 25 Jul 2025 15:40:03 +0200 Subject: [PATCH] Use TLS initial-exec model for __libc_tsd_CTYPE_* thread variables [BZ #33234] Commit 10a66a8e421b ("Remove ") removed the TLS initial-exec (IE) model attribute from the __libc_tsd_CTYPE_* 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_CTYPE_* 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"). Reviewed-by: Florian Weimer (cherry picked from commit e5363e6f460c2d58809bf10fc96d70fd1ef8b5b2) --- NEWS | 3 +++ ctype/ctype-info.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index f77d1471c3..738afd7970 100644 --- a/NEWS +++ b/NEWS @@ -15,7 +15,9 @@ Deprecated and removed features, and other changes affecting compatibility: The following bugs were resolved with this release: + [19341] ctype: Fallback initialization of TLS using relocations [31943] _dl_find_object can fail if ld.so contains gaps between load segments + [32483] ctype macros segfault in multithreaded programs with multiple libc.so [32269] RISC-V IFUNC resolver cannot access gp pointer [32626] math: math: log10p1f is not correctly rounded [32627] math: math: sinhf is not correctly rounded @@ -36,6 +38,7 @@ The following bugs were resolved with this release: [32994] stdlib: resolve a double lock init issue after fork [33164] iconv -o should not create executable files [33185] Fix double-free after allocation failure in regcomp + [33234] Use TLS initial-exec model for __libc_tsd_CTYPE_* thread variables [33245] nptl: nptl: error in internal cancellation syscall handling Version 2.41 diff --git a/ctype/ctype-info.c b/ctype/ctype-info.c index b7d3422726..fb5acf9419 100644 --- a/ctype/ctype-info.c +++ b/ctype/ctype-info.c @@ -24,11 +24,11 @@ __ctype_init before user code runs, but this does not happen for threads in secondary namespaces. With the initializers, secondary namespaces at least get locale data from the C locale. */ -__thread const uint16_t * __libc_tsd_CTYPE_B +__thread const uint16_t * __libc_tsd_CTYPE_B attribute_tls_model_ie = (const uint16_t *) _nl_C_LC_CTYPE_class + 128; -__thread const int32_t * __libc_tsd_CTYPE_TOLOWER +__thread const int32_t * __libc_tsd_CTYPE_TOLOWER attribute_tls_model_ie = (const int32_t *) _nl_C_LC_CTYPE_tolower + 128; -__thread const int32_t * __libc_tsd_CTYPE_TOUPPER +__thread const int32_t * __libc_tsd_CTYPE_TOUPPER attribute_tls_model_ie = (const int32_t *) _nl_C_LC_CTYPE_toupper + 128; -- 2.47.2