Retain libc.so.6 debuglink section, remove ld.so debuginfo file (#2090744)

This commit fixes wrap-find-debuginfo.sh so that:
* the .gnu_debuglink section of libc.so.6 is retained, and
* the redundant debuginfo file generated for ld.so is removed

Co-Authored-By: Benjamin Herrenschmidt <benh@amazon.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
This commit is contained in:
Arjun Shankar 2022-09-05 16:24:44 +02:00
parent cfb2790658
commit 8e2d77f734
2 changed files with 29 additions and 3 deletions

View File

@ -159,7 +159,7 @@ Version: %{glibcversion}
# - It allows using the Release number without the %%dist tag in the dependency # - It allows using the Release number without the %%dist tag in the dependency
# generator to make the generated requires interchangeable between Rawhide # generator to make the generated requires interchangeable between Rawhide
# and ELN (.elnYY < .fcXX). # and ELN (.elnYY < .fcXX).
%global baserelease 4 %global baserelease 5
Release: %{baserelease}%{?dist} Release: %{baserelease}%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for # In general, GPLv2+ is used by programs, LGPLv2+ is used for
@ -2185,6 +2185,11 @@ update_gconv_modules_cache ()
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared %files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog %changelog
* Mon Sep 05 2022 Arjun Shankar <arjun@redhat.com> - 2.36.9000-5
- Co-Authored-By: Benjamin Herrenschmidt <benh@amazon.com>
- Retain .gnu_debuglink section in libc.so.6 (#2090744)
- Remove redundant ld.so debuginfo file (#2090744)
* Tue Aug 30 2022 DJ Delorie <dj@redhat.com> - 2.36.9000-4 * Tue Aug 30 2022 DJ Delorie <dj@redhat.com> - 2.36.9000-4
- Auto-sync with upstream branch master, - Auto-sync with upstream branch master,
commit c7509d49c4e8fa494120c5ead21338559dad16f5. commit c7509d49c4e8fa494120c5ead21338559dad16f5.
@ -2230,7 +2235,6 @@ update_gconv_modules_cache ()
- htl: make __pthread_hurd_cond_timedwait_internal check mutex is held - htl: make __pthread_hurd_cond_timedwait_internal check mutex is held
- Add AArch64 HWCAP2_* constants from Linux 5.19 - Add AArch64 HWCAP2_* constants from Linux 5.19
* Mon Aug 22 2022 Arjun Shankar <arjun@redhat.com> - 2.36.9000-3 * Mon Aug 22 2022 Arjun Shankar <arjun@redhat.com> - 2.36.9000-3
- Auto-sync with upstream branch master, - Auto-sync with upstream branch master,
commit a727220b37efc9d4d558a77c5fc57f3af99a4829: commit a727220b37efc9d4d558a77c5fc57f3af99a4829:

View File

@ -17,6 +17,7 @@ set -ex
ldso_tmp="$(mktemp)" ldso_tmp="$(mktemp)"
libc_tmp="$(mktemp)" libc_tmp="$(mktemp)"
libc_dlink_tmp="$(mktemp)"
# Prefer a separately installed debugedit over the RPM-integrated one. # Prefer a separately installed debugedit over the RPM-integrated one.
if command -v debugedit >/dev/null ; then if command -v debugedit >/dev/null ; then
@ -26,7 +27,7 @@ else
fi fi
cleanup () { cleanup () {
rm -f "$ldso_tmp" "$libc_tmp" rm -f "$ldso_tmp" "$libc_tmp" "$libc_dlink_tmp"
} }
trap cleanup 0 trap cleanup 0
@ -66,6 +67,10 @@ cp "$libc_path" "$libc_tmp"
# Run the debuginfo extraction. # Run the debuginfo extraction.
"$script_path" "$@" "$script_path" "$@"
# libc.so.6: Extract the .gnu_debuglink section
objcopy -j.gnu_debuglink --set-section-flags .gnu_debuglink=alloc \
-O binary "$libc_path" "$libc_dlink_tmp"
# Restore the original files. # Restore the original files.
cp "$ldso_tmp" "$ldso_path" cp "$ldso_tmp" "$ldso_path"
cp "$libc_tmp" "$libc_path" cp "$libc_tmp" "$libc_path"
@ -74,6 +79,23 @@ cp "$libc_tmp" "$libc_path"
objcopy --merge-notes "$ldso_path" objcopy --merge-notes "$ldso_path"
objcopy --merge-notes "$libc_path" objcopy --merge-notes "$libc_path"
# libc.so.6: Restore the .gnu_debuglink section
objcopy --add-section .gnu_debuglink="$libc_dlink_tmp" "$libc_path"
# ld.so does not have separated debuginfo and so the debuginfo file
# generated by find-debuginfo is redundant. Therefore, remove it.
ldso_debug=
for ldso_debug_candidate in `find "$sysroot_path" -regextype posix-extended \
-regex '.*/ld(-.*|64|)\.so\.[0-9]+.*debug$' -type f` ; do
if test -z "$ldso_debug" ; then
ldso_debug="$ldso_debug_candidate"
else
echo "error: multiple ld.so debug candidates: $ldso_debug, $ldso_debug_candidate"
exit 1
fi
done
rm -f "$ldso_debug"
# libc.so.6: Reduce to valuable symbols. Eliminate file symbols, # libc.so.6: Reduce to valuable symbols. Eliminate file symbols,
# annobin symbols, and symbols used by the glibc build to implement # annobin symbols, and symbols used by the glibc build to implement
# hidden aliases (__EI_*). We would also like to remove __GI_* # hidden aliases (__EI_*). We would also like to remove __GI_*