]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
i386: Add GLIBC_ABI_GNU_TLS version [BZ #33221]
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 28 Jul 2025 19:16:11 +0000 (12:16 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 14 Aug 2025 12:43:32 +0000 (05:43 -0700)
On i386, programs and shared libraries with __thread usage may fail
silently at run-time against glibc without the TLS run-time fix for:

https://sourceware.org/bugzilla/show_bug.cgi?id=32996

Add GLIBC_ABI_GNU_TLS version to indicate that glibc has the working
GNU TLS run-time.  Linker can add the GLIBC_ABI_GNU_TLS version to
binaries which depend on the working TLS run-time so that such programs
and shared libraries will fail to load and run at run-time against
libc.so without the GLIBC_ABI_GNU_TLS version, instead of fail silently
at random.

This fixes BZ #33221.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
sysdeps/i386/Makefile
sysdeps/i386/Versions

index 74068ea80c5766657a32e91d3a74677d4b988ff2..4fbaaa252b4991690252b2a52d0e59d853b4e97f 100644 (file)
@@ -51,6 +51,15 @@ $(objpfx)tst-ld-sse-use.out: ../sysdeps/i386/tst-ld-sse-use.sh $(objpfx)ld.so
        @echo "Checking ld.so for SSE register use.  This will take a few seconds..."
        $(BASH) $< $(objpfx) '$(NM)' '$(OBJDUMP)' '$(READELF)' > $@; \
        $(evaluate-test)
+
+tests-special += $(objpfx)check-gnu-tls.out
+
+$(objpfx)check-gnu-tls.out: $(common-objpfx)libc.so
+       LC_ALL=C $(READELF) -V -W $< \
+               | sed -ne '/.gnu.version_d/, /.gnu.version_r/ p' \
+               | grep GLIBC_ABI_GNU_TLS > $@; \
+       $(evaluate-test)
+generated += check-gnu-tls.out
 else
 CFLAGS-.os += $(if $(filter rtld-%.os,$(@F)), $(rtld-CFLAGS))
 endif
index 36e23b466a622f438207a53284bdec1d7bd0ba7f..9c84c8ef049eb18d1cfcbf75556605a04d184985 100644 (file)
@@ -28,6 +28,11 @@ libc {
   GLIBC_2.13 {
     __fentry__;
   }
+  GLIBC_ABI_GNU_TLS {
+    # This symbol is used only for empty version map and will be removed
+    # by scripts/versions.awk.
+    __placeholder_only_for_empty_version_map;
+  }
 }
 libm {
   GLIBC_2.1 {