]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
x86-64: Add GLIBC_ABI_GNU2_TLS version [BZ #33129]
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 28 Jul 2025 19:18:22 +0000 (12:18 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 20 Aug 2025 20:31:34 +0000 (13:31 -0700)
Programs and shared libraries compiled with -mtls-dialect=gnu2 may fail
silently at run-time against glibc without the GNU2 TLS run-time fix
for:

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

Add GLIBC_ABI_GNU2_TLS version to indicate that glibc has the working
GNU2 TLS run-time.  Linker can add the GLIBC_ABI_GNU2_TLS version to
binaries which depend on the working GNU2 TLS run-time:

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

so that such programs and shared libraries will fail to load and run at
run-time against libc.so without the GLIBC_ABI_GNU2_TLS version, instead
of fail silently at random.

This fixes BZ #33129.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
(cherry picked from commit 9df8fa397d515dc86ff5565f6c45625e672d539e)

sysdeps/x86_64/Makefile
sysdeps/x86_64/Versions

index 9c8af2730095bfa133811dcb026c8c1c174dbbed..191cf7f5b058461ad9362b3e9568411f86480b4e 100644 (file)
@@ -181,6 +181,14 @@ $(objpfx)check-dt-x86-64-plt.out: $(common-objpfx)libc.so
        $(evaluate-test)
 generated += check-dt-x86-64-plt.out
 
+tests-special += $(objpfx)check-gnu2-tls.out
+
+$(objpfx)check-gnu2-tls.out: $(common-objpfx)libc.so
+       LC_ALL=C $(READELF) -V -W $< \
+               | sed -ne '/.gnu.version_d/, /.gnu.version_r/ p' \
+               | grep GLIBC_ABI_GNU2_TLS > $@; \
+       $(evaluate-test)
+generated += check-gnu2-tls.out
 endif # $(subdir) == elf
 
 ifeq ($(subdir),csu)
index 6a989ad3b373cdf65f05dbe1f96d8d898040c96f..0a759029e5a00cf1b7e485c248235ecbe97b1332 100644 (file)
@@ -5,6 +5,11 @@ libc {
   GLIBC_2.13 {
     __fentry__;
   }
+  GLIBC_ABI_GNU2_TLS {
+    # This symbol is used only for empty version map and will be removed
+    # by scripts/versions.awk.
+    __placeholder_only_for_empty_version_map;
+  }
   GLIBC_ABI_DT_X86_64_PLT {
     # This symbol is used only for empty version map and will be removed
     # by scripts/versions.awk.