diff --git a/glibc.spec b/glibc.spec index 8c644ad..52158a4 100644 --- a/glibc.spec +++ b/glibc.spec @@ -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). diff --git a/wrap-find-debuginfo.sh b/wrap-find-debuginfo.sh index 4cbb01b..59c7356 100644 --- a/wrap-find-debuginfo.sh +++ b/wrap-find-debuginfo.sh @@ -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`