diff --git a/glibc.spec b/glibc.spec index 456bed1..b9472b5 100644 --- a/glibc.spec +++ b/glibc.spec @@ -90,7 +90,7 @@ Summary: The GNU libc libraries Name: glibc Version: %{glibcversion} -Release: 7%{?dist} +Release: 8%{?dist} # In general, GPLv2+ is used by programs, LGPLv2+ is used for # libraries. @@ -145,15 +145,20 @@ Source13: convnames.py # the definition of __debug_install_post. %{lua: local wrapper = rpm.expand("%{SOURCE10}") -local ldso = rpm.expand("%{glibc_sysroot}/%{_lib}/ld-%{VERSION}.so") +local sysroot = rpm.expand("%{glibc_sysroot}") local original = rpm.expand("%{macrobody:__debug_install_post}") -- Strip leading newline. It confuses the macro redefinition. -- Avoid embedded newlines that confuse the macro definition. original = original:match("^%s*(.-)%s*$"):gsub("\\\n", "") rpm.define("__debug_install_post bash " .. wrapper - .. " " .. ldso .. " " .. original) + .. " " .. sysroot .. " " .. original) } +# The wrapper script relies on the fact that debugedit does not change +# build IDs. +%define _no_recompute_build_ids 1 +%undefine _unique_build_ids + ############################################################################## # Patches: # - See each individual patch file for origin and upstream status. @@ -1849,6 +1854,9 @@ fi %files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared %changelog +* Mon Jun 21 2021 Florian Weimer - 2.32-8 +- Add valgrind support symbols to libc.so.6's symtab (#1965374) + * Fri Jun 11 2021 Arjun Shankar - 2.32-7 - Auto-sync with upstream branch release/2.32/master, commit 16949aeaa078b5994a333980d7a6cd5705d5e1f7: diff --git a/wrap-find-debuginfo.sh b/wrap-find-debuginfo.sh index 598c0d3..6f0113f 100644 --- a/wrap-find-debuginfo.sh +++ b/wrap-find-debuginfo.sh @@ -2,16 +2,21 @@ # Wrapper script for find-debuginfo.sh # # Usage: -# wrap-find-debuginfo.sh LDSO-PATH SCRIPT-PATH SCRIPT-ARGS... +# wrap-find-debuginfo.sh SYSROOT-PATH SCRIPT-PATH SCRIPT-ARGS... # -# The wrapper saves the original versions of the file at LDSO-PATH, +# The wrapper saves the original version of ld.so found in SYSROOT-PATH, # invokes SCRIPT-PATH with SCRIPT-ARGS, and then restores the -# LDSO-PATH file. As a result, LDSO-PATH has unchanged debuginfo even +# LDSO-PATH file, followed by note merging and DWZ compression. +# As a result, ld.so has (mostly) unchanged debuginfo even # after debuginfo extraction. +# +# For libc.so.6, a set of strategic symbols is preserved in .symtab +# that are frequently used in valgrind suppressions. set -ex ldso_tmp="$(mktemp)" +libc_tmp="$(mktemp)" # Prefer a separately installed debugedit over the RPM-integrated one. if command -v debugedit >/dev/null ; then @@ -21,30 +26,113 @@ else fi cleanup () { - rm -f "$ldso_tmp" + rm -f "$ldso_tmp" "$libc_tmp" } trap cleanup 0 -ldso_path="$1" +sysroot_path="$1" shift script_path="$1" shift -# Preserve the original file. +# See run_ldso setting in glibc.spec. +ldso_path= +for ldso_candidate in `find "$sysroot_path" -name 'ld-*.so' -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_path= +for libc_candidate in `find "$sysroot_path" -name 'libc-*.so' -type f` ; do + if test -z "$libc_path" ; then + libc_path="$libc_candidate" + else + echo "error: multiple libc.so.6 candidates: $libc_path, $libc_candidate" + exit 1 + fi +done + + +# Preserve the original files. cp "$ldso_path" "$ldso_tmp" +cp "$libc_path" "$libc_tmp" # Run the debuginfo extraction. "$script_path" "$@" -# Restore the original file. +# Restore the original files. cp "$ldso_tmp" "$ldso_path" +cp "$libc_tmp" "$libc_path" # Reduce the size of notes. Primarily for annobin. objcopy --merge-notes "$ldso_path" +objcopy --merge-notes "$libc_path" -# Rewrite the source file paths to match the extracted locations. -# First compute the arguments for invoking debugedit. See -# find-debuginfo.sh. +# libc.so.6: Reduce to strategic symbols needed by valgrind. +# pthread_create is needed to trigger loading of libthread_db in GDB. +# (Debuginfo is gone after this, so no need to optimize it.) +strip \ + -K __GI___rawmemchr \ + -K __GI___strcasecmp_l \ + -K __GI___strncasecmp_l \ + -K __GI_memchr \ + -K __GI_memcmp \ + -K __GI_memcpy \ + -K __GI_memmove \ + -K __GI_mempcpy \ + -K __GI_stpcpy \ + -K __GI_strcasecmp \ + -K __GI_strcasecmp_l \ + -K __GI_strcat \ + -K __GI_strchr \ + -K __GI_strcmp \ + -K __GI_strcpy \ + -K __GI_strcspn \ + -K __GI_strlen \ + -K __GI_strncasecmp \ + -K __GI_strncasecmp_l \ + -K __GI_strncmp \ + -K __GI_strncpy \ + -K __GI_strnlen \ + -K __GI_strrchr \ + -K __GI_wcsnlen \ + -K __GI_wmemchr \ + -K __memcmp_sse2 \ + -K __memcmp_sse4_1 \ + -K __memcpy_avx_unaligned_erms \ + -K __memcpy_chk \ + -K __memcpy_sse2 \ + -K __memmove_chk \ + -K __stpcpy_chk \ + -K __stpcpy_sse2 \ + -K __stpcpy_sse2_unaligned \ + -K __strchr_sse2 \ + -K __strchr_sse2_no_bsf \ + -K __strcmp_sse2 \ + -K __strcmp_sse42 \ + -K __strcpy_chk \ + -K __strlen_sse2 \ + -K __strlen_sse2_no_bsf \ + -K __strlen_sse42 \ + -K __strncmp_sse2 \ + -K __strncmp_sse42 \ + -K __strncpy_sse2 \ + -K __strncpy_sse2_unaligned \ + -K __strrchr_sse2 \ + -K __strrchr_sse2_no_bsf \ + -K __strrchr_sse42 \ + -K __strstr_sse2 \ + -K __strstr_sse42 \ + -K pthread_create \ + "$libc_path" + +# ld.so: Rewrite the source file paths to match the extracted +# locations. First compute the arguments for invoking debugedit. +# See find-debuginfo.sh. debug_dest_name="/usr/src/debug" last_arg= while true ; do