]> 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)
committerSam James <sam@gentoo.org>
Fri, 15 Aug 2025 21:18:16 +0000 (22:18 +0100)
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 ce949dba27eede5c11a03f8e09efe70ccd541277..a54c9be4bf1941bd37af24437a3181f32247b930 100644 (file)
@@ -209,6 +209,15 @@ LDFLAGS-tst-plt-rewrite2 = -Wl,-z,now
 LDFLAGS-tst-plt-rewritemod2.so = -Wl,-z,now,-z,undefs
 tst-plt-rewrite2-ENV = GLIBC_TUNABLES=glibc.cpu.plt_rewrite=2
 $(objpfx)tst-plt-rewrite2: $(objpfx)tst-plt-rewritemod2.so
+
+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
 
 test-internal-extras += tst-gnu2-tls2mod1
index e94758b23643a9056ae176f3a18d7f46686049b0..a63c11bcb25adf48df29083f2c0a498c5951b074 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;
+  }
 }
 libm {
   GLIBC_2.1 {