Force DT_RPATH for --enable-hardcoded-path-in-tests

(cherry picked from commit 24f047da6b0f1bfad09ee1171472fca38011a48d)
This commit is contained in:
liqingqing_1229 2024-05-13 08:54:55 +08:00 committed by openeuler-sync-bot
parent f6cdaa6daf
commit 0d03b0da4a
2 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,50 @@
From 249646f12b08f3dbd9a8e8b8021e5c0e3a0b7e1e Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 9 May 2024 20:07:01 -0700
Subject: [PATCH] Force DT_RPATH for --enable-hardcoded-path-in-tests
On Fedora 40/x86-64, linker enables --enable-new-dtags by default which
generates DT_RUNPATH instead of DT_RPATH. Unlike DT_RPATH, DT_RUNPATH
only applies to DT_NEEDED entries in the executable and doesn't applies
to DT_NEEDED entries in shared libraries which are loaded via DT_NEEDED
entries in the executable. Some glibc tests have libstdc++.so.6 in
DT_NEEDED, which has libm.so.6 in DT_NEEDED. When DT_RUNPATH is generated,
/lib64/libm.so.6 is loaded for such tests. If the newly built glibc is
older than glibc 2.36, these tests fail with
assert/tst-assert-c++: /export/build/gnu/tools-build/glibc-gitlab-release/build-x86_64-linux/libc.so.6: version `GLIBC_2.36' not found (required by /lib64/libm.so.6)
assert/tst-assert-c++: /export/build/gnu/tools-build/glibc-gitlab-release/build-x86_64-linux/libc.so.6: version `GLIBC_ABI_DT_RELR' not found (required by /lib64/libm.so.6)
Pass -Wl,--disable-new-dtags to linker when building glibc tests with
--enable-hardcoded-path-in-tests. This fixes BZ #31719.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 2dcaf70643710e22f92a351e36e3cff8b48c60dc)
---
Makeconfig | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/Makeconfig b/Makeconfig
index 77d7fd14df..3f8acff459 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -586,10 +586,13 @@ link-libc-rpath-link = -Wl,-rpath-link=$(rpath-link)
# before the expansion of LDLIBS-* variables).
# Tests use -Wl,-rpath instead of -Wl,-rpath-link for
-# build-hardcoded-path-in-tests.
+# build-hardcoded-path-in-tests. Add -Wl,--disable-new-dtags to force
+# DT_RPATH instead of DT_RUNPATH which only applies to DT_NEEDED entries
+# in the executable and doesn't applies to DT_NEEDED entries in shared
+# libraries which are loaded via DT_NEEDED entries in the executable.
ifeq (yes,$(build-hardcoded-path-in-tests))
-link-libc-tests-rpath-link = $(link-libc-rpath)
-link-test-modules-rpath-link = $(link-libc-rpath)
+link-libc-tests-rpath-link = $(link-libc-rpath) -Wl,--disable-new-dtags
+link-test-modules-rpath-link = $(link-libc-rpath) -Wl,--disable-new-dtags
else
link-libc-tests-rpath-link = $(link-libc-rpath-link)
link-test-modules-rpath-link =
--
2.33.0

View File

@ -67,7 +67,7 @@
############################################################################## ##############################################################################
Name: glibc Name: glibc
Version: 2.38 Version: 2.38
Release: 28 Release: 29
Summary: The GNU libc libraries Summary: The GNU libc libraries
License: %{all_license} License: %{all_license}
URL: http://www.gnu.org/software/glibc/ URL: http://www.gnu.org/software/glibc/
@ -197,6 +197,7 @@ Patch107: 0023-CVE-2024-33601-CVE-2024-33602-nscd-netgroup-Use-two-.patch
Patch108: 0024-elf-Also-compile-dl-misc.os-with-rtld-early-cflags.patch Patch108: 0024-elf-Also-compile-dl-misc.os-with-rtld-early-cflags.patch
Patch109: 0025-nscd-Use-time_t-for-return-type-of-addgetnetgrentX.patch Patch109: 0025-nscd-Use-time_t-for-return-type-of-addgetnetgrentX.patch
Patch110: 0026-resolv-Fix-some-unaligned-accesses-in-resolver-BZ-30.patch Patch110: 0026-resolv-Fix-some-unaligned-accesses-in-resolver-BZ-30.patch
Patch111: Force-DT_RPATH-for-enable-hardcoded-path-in-tests.patch
#openEuler patch list #openEuler patch list
Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch
@ -1420,6 +1421,9 @@ fi
%endif %endif
%changelog %changelog
* Mon May 13 Qingqing Li <liqingqing3@huawei.com> - 2.38-29
- Force DT_RPATH for --enable-hardcoded-path-in-tests
* Fri May 10 Qingqing Li <liqingqing3@huawei.com> - 2.38-28 * Fri May 10 Qingqing Li <liqingqing3@huawei.com> - 2.38-28
- backport glibc upstream 2.38 branch, here is the 26 patches: - backport glibc upstream 2.38 branch, here is the 26 patches:
- resolv: Fix some unaligned accesses in resolver [BZ #30750] - resolv: Fix some unaligned accesses in resolver [BZ #30750]