diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2024-05-09 20:07:01 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2024-05-10 06:16:48 -0700 |
commit | 6fc6b074ea78adc35e2e2df71e6cea1f4d35c9f0 (patch) | |
tree | 4294b9aca4022a006404e4390c06597cc3400771 | |
parent | 3d443b8d6a5e19edb5392d772685a58c5fb2310b (diff) | |
download | glibc-6fc6b074ea78adc35e2e2df71e6cea1f4d35c9f0.tar.gz glibc-6fc6b074ea78adc35e2e2df71e6cea1f4d35c9f0.tar.xz glibc-6fc6b074ea78adc35e2e2df71e6cea1f4d35c9f0.zip |
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)
-rw-r--r-- | Makeconfig | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Makeconfig b/Makeconfig index 4d9d337d00..a53b41b403 100644 --- a/Makeconfig +++ b/Makeconfig @@ -562,8 +562,13 @@ ifeq (yes,$(build-shared)) link-libc-rpath = -Wl,-rpath=$(rpath-link) link-libc-rpath-link = -Wl,-rpath-link=$(rpath-link) +# Tests use -Wl,-rpath instead of -Wl,-rpath-link for +# 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-libc-tests-rpath-link = $(link-libc-rpath) -Wl,--disable-new-dtags else link-libc-tests-rpath-link = $(link-libc-rpath-link) endif # build-hardcoded-path-in-tests |