From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1039) id F250E385840E; Fri, 10 May 2024 03:49:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F250E385840E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1715312981; bh=bTC1LuU4RW1Ar86ps0KGqB7Xj60CuGremJ91mVacrDs=; h=From:To:Subject:Date:From; b=uD7GqJNbonfbaLJu3snkgH+GxVagY7pLny+JeIFL5VSRLkLNVZuRXEryhYWk5QMPQ VRUkkS5G0dPZvBLlV8PNp8jRdrih8qJxugHy8sPNV4ZPbBRcT1t9Nzp7wBgqHugQEK ZUZpgP1QdUFuIGLHQs0y09Pf0olVgpq1apNVn6So= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: H.J. Lu To: glibc-cvs@sourceware.org Subject: [glibc] Force DT_RPATH for --enable-hardcoded-path-in-tests X-Act-Checkin: glibc X-Git-Author: H.J. Lu X-Git-Refname: refs/heads/master X-Git-Oldrev: ae515ba530be76d6627740ddc33a3a63f8c7e4f9 X-Git-Newrev: 2dcaf70643710e22f92a351e36e3cff8b48c60dc Message-Id: <20240510034941.F250E385840E@sourceware.org> Date: Fri, 10 May 2024 03:49:41 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2dcaf70643710e22f92a351e36e3cff8b48c60dc commit 2dcaf70643710e22f92a351e36e3cff8b48c60dc Author: H.J. Lu Date: Thu May 9 20:07:01 2024 -0700 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 Diff: --- Makeconfig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makeconfig b/Makeconfig index 61ff1d0d9b..59e21d4c82 100644 --- a/Makeconfig +++ b/Makeconfig @@ -607,10 +607,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 =