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>

Rawhide commit: 8e2d77f734
This commit is contained in:
Arjun Shankar 2022-09-06 17:49:02 +02:00
parent 1ca10cc71c
commit 5bcb836ffa
2 changed files with 29 additions and 2 deletions

View File

@ -159,7 +159,7 @@ Version: %{glibcversion}
# - It allows using the Release number without the %%dist tag in the dependency
# generator to make the generated requires interchangeable between Rawhide
# and ELN (.elnYY < .fcXX).
%global baserelease 2
%global baserelease 3
Release: %{baserelease}%{?dist}
# 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
%changelog
* Tue Sep 06 2022 Arjun Shankar <arjun@redhat.com> - 2.36-3
- 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 23 2022 Arjun Shankar <arjun@redhat.com> - 2.36-2
- Auto-sync with upstream branch release/2.36/master,
commit 5c62874f423af93e97b51bc9a57af228a546156f:

View File

@ -17,6 +17,7 @@ set -ex
ldso_tmp="$(mktemp)"
libc_tmp="$(mktemp)"
libc_dlink_tmp="$(mktemp)"
# Prefer a separately installed debugedit over the RPM-integrated one.
if command -v debugedit >/dev/null ; then
@ -26,7 +27,7 @@ else
fi
cleanup () {
rm -f "$ldso_tmp" "$libc_tmp"
rm -f "$ldso_tmp" "$libc_tmp" "$libc_dlink_tmp"
}
trap cleanup 0
@ -66,6 +67,10 @@ cp "$libc_path" "$libc_tmp"
# Run the debuginfo extraction.
"$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.
cp "$ldso_tmp" "$ldso_path"
cp "$libc_tmp" "$libc_path"
@ -74,6 +79,23 @@ cp "$libc_tmp" "$libc_path"
objcopy --merge-notes "$ldso_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,
# annobin symbols, and symbols used by the glibc build to implement
# hidden aliases (__EI_*). We would also like to remove __GI_*