Hard-code ld.so paths for all architectures

Vaguely based on Fedora commit 7749ea58a9e2198f830d6eb8b162344aaf8acb84.

Co-authored-by: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
Related: RHEL-65334
This commit is contained in:
Florian Weimer 2024-04-12 13:33:21 +02:00
parent 22b00cdcc7
commit d19a50e449
2 changed files with 36 additions and 20 deletions

View File

@ -199,6 +199,36 @@ Source11: parse-SUPPORTED.py
Source12: ChangeLog.old
Source13: nscd-sysusers.conf
# ABI-specific program interpreter name. Used for debuginfo
# extraction (wrap-find-debuginfo.sh) and smoke testing ($run_ldso below).
%ifarch %{ix86}
%global glibc_ldso /lib/ld-linux.so.2
%endif
%ifarch aarch64
%global glibc_ldso /lib/ld-linux-aarch64.so.1
%endif
%ifarch ppc
%global glibc_ldso /lib/ld.so.1
%endif
%ifarch ppc64
%global glibc_ldso /lib64/ld64.so.1
%endif
%ifarch ppc64le
%global glibc_ldso /lib64/ld64.so.2
%endif
%ifarch riscv64
%global glibc_ldso /lib/ld-linux-riscv64-lp64d.so.1
%endif
%ifarch s390
%global glibc_ldso /lib/ld.so.1
%endif
%ifarch s390x
%global glibc_ldso /lib/ld64.so.1
%endif
%ifarch x86_64 x86_64_v2 x86_64_v3 x86_64_v4
%global glibc_ldso /lib64/ld-linux-x86-64.so.2
%endif
######################################################################
# Activate the wrapper script for debuginfo generation, by rewriting
# the definition of __debug_install_post.
@ -210,7 +240,7 @@ local original = rpm.expand("%{macrobody:__debug_install_post}")
-- Avoid embedded newlines that confuse the macro definition.
original = original:match("^%s*(.-)%s*$"):gsub("\\\n", "")
rpm.define("__debug_install_post bash " .. wrapper
.. " " .. sysroot .. " " .. original)
.. " " .. sysroot .. " %{glibc_ldso} " .. original)
}
# sysroot package support. These contain arch-specific packages, so
@ -2785,13 +2815,7 @@ echo ====================PLT RELOCS LIBC.SO==============
readelf -Wr %{glibc_sysroot}/%{_lib}/libc-*.so | sed -n -e "$PLTCMD"
echo ====================PLT RELOCS END==================
# Obtain a way to run the dynamic loader. Avoid matching the symbolic
# link and then pick the first loader (although there should be only
# one). Use -maxdepth 2 to avoid descending into the /sys-root/
# sub-tree. See wrap-find-debuginfo.sh.
ldso_path="$(find %{glibc_sysroot}/ -maxdepth 2 -regextype posix-extended \
-regex '.*/ld(-.*|64|)\.so\.[0-9]+$' -type f | LC_ALL=C sort | head -n1)"
run_ldso="$ldso_path --library-path %{glibc_sysroot}/%{_lib}"
run_ldso="%{glibc_sysroot}/%{glibc_ldso} --library-path %{glibc_sysroot}/%{_lib}"
# Show the auxiliary vector as seen by the new library
# (even if we do not perform the valgrind test).

View File

@ -40,21 +40,13 @@ trap cleanup 0
sysroot_path="$1"
shift
# Resolve symbolic link, so that the activities below only alter the
# file it points to.
ldso_path="$(readlink -f "$sysroot_path/$1")"
shift
script_path="$1"
shift
# See ldso_path setting in glibc.spec.
ldso_path=
for ldso_candidate in `find "$sysroot_path" -maxdepth 2 \
-regextype posix-extended -regex '.*/ld(-.*|64|)\.so\.[0-9]+$' -type f` ; do
if test -z "$ldso_path" ; then
ldso_path="$ldso_candidate"
else
echo "error: multiple ld.so candidates: $ldso_path, $ldso_candidate"
exit 1
fi
done
# libc.so.6 always uses this name, so it is simpler to locate.
libc_path=`find "$sysroot_path" -name libc.so.6`