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 19:56:05 +02:00
parent 931ddd67fe
commit 2e466a0073
2 changed files with 29 additions and 2 deletions

View File

@ -152,7 +152,7 @@ end \
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: 16%{?dist}
Release: 17%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries.
@ -2171,6 +2171,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.35-17
- 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.35-16
- Auto-sync with upstream branch release/2.35/master,
commit 83f1d9851e0b143991448d41ff50744d9972cb6e:

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_*