From e06e7b2e92a7f2bfe34fdf18e5219b506da9bdc2 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 27 Jan 2023 18:02:49 +0100 Subject: [PATCH] 5.0-7 Add find-debuginfo dwz -j and -q, --quiet support - Refresh 0001-tests-Handle-zero-directory-entry-in-.debug_line-DWA.patch - Add new upstream patches: 0001-use-READELF-not-readelf.patch 0001-find-debuginfo-Pass-j-down-to-dwz.patch 0002-configure.ac-Use-AC_LINK_IFELSE-for-gz-none-check.patch 0003-configure.ac-Use-AC_LANG_PROGRAM-for-AC_LINK_IFELSE-.patch 0004-scripts-find-debuginfo.in-Add-q-quiet.patch --- 0001-find-debuginfo-Pass-j-down-to-dwz.patch | 86 +++++ ...o-directory-entry-in-.debug_line-DWA.patch | 10 +- 0001-use-READELF-not-readelf.patch | 330 ++++++++++++++++++ ...Use-AC_LINK_IFELSE-for-gz-none-check.patch | 33 ++ ...-AC_LANG_PROGRAM-for-AC_LINK_IFELSE-.patch | 32 ++ ...cripts-find-debuginfo.in-Add-q-quiet.patch | 116 ++++++ debugedit.spec | 21 +- 7 files changed, 621 insertions(+), 7 deletions(-) create mode 100644 0001-find-debuginfo-Pass-j-down-to-dwz.patch create mode 100644 0001-use-READELF-not-readelf.patch create mode 100644 0002-configure.ac-Use-AC_LINK_IFELSE-for-gz-none-check.patch create mode 100644 0003-configure.ac-Use-AC_LANG_PROGRAM-for-AC_LINK_IFELSE-.patch create mode 100644 0004-scripts-find-debuginfo.in-Add-q-quiet.patch diff --git a/0001-find-debuginfo-Pass-j-down-to-dwz.patch b/0001-find-debuginfo-Pass-j-down-to-dwz.patch new file mode 100644 index 0000000..75be261 --- /dev/null +++ b/0001-find-debuginfo-Pass-j-down-to-dwz.patch @@ -0,0 +1,86 @@ +From 5b23e464528ef988cfcd0a87b3ec8db0520db867 Mon Sep 17 00:00:00 2001 +From: Kalev Lember +Date: Thu, 19 Jan 2023 17:03:18 +0100 +Subject: [PATCH 1/4] find-debuginfo: Pass -j down to dwz + +Now that dwz 0.15 supports parallel jobs, add a way to control it from +here. find-debuginfo already has a -j parameter so we can just extend it +and pass the value down to dwz as well. + +This should fix building large packages on memory constrained builders, +such as webkitgtk on s390x in Fedora koji build system, where we can now +use the -j option to tune down parallelism to avoid running out of +memory during dwz run. + +Add a configure check to make sure the installed dwz supports the +-j option. + +Signed-off-by: Kalev Lember +Signed-off-by: Mark Wielaard +--- + Makefile.am | 3 ++- + configure.ac | 21 +++++++++++++++++++++ + scripts/find-debuginfo.in | 1 + + 3 files changed, 24 insertions(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index 2060b96..4a5092d 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -33,7 +33,8 @@ CLEANFILES = $(bin_SCRIPTS) + # Some standard substitutions for scripts + do_subst = ($(SED) -e 's,[@]PACKAGE[@],$(PACKAGE),g' \ + -e 's,[@]VERSION[@],$(VERSION),g' \ +- -e 's,[@]READELF[@],$(READELF),g') ++ -e 's,[@]READELF[@],$(READELF),g' \ ++ -e 's,[@]DWZ_J[@],$(DWZ_J),g') + + find-debuginfo: $(top_srcdir)/scripts/find-debuginfo.in Makefile + $(do_subst) < "$(top_srcdir)/scripts/$@.in" > "$@" +diff --git a/configure.ac b/configure.ac +index 6a53365..f2d1571 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -47,6 +47,27 @@ AC_CHECK_TOOL([LD], [ld]) + AC_CHECK_TOOL([READELF], [readelf]) + AM_MISSING_PROG(HELP2MAN, help2man) + ++# Whether dwz support -j. ++# Make sure to compile something with -g. ++# Run dwz on it with -j1. ++DWZ_J="" ++AC_CHECK_PROG([DWZ], [dwz], [dwz]) ++if test "x$DWZ" = "xdwz"; then ++ save_CFLAGS="$CFLAGS" ++ CFLAGS="$save_CFLAGS -g" ++ AC_CACHE_CHECK([whether the dwz support -j], ac_cv_dwz_j, [dnl ++ AC_LINK_IFELSE([AC_LANG_PROGRAM()],[dnl ++ ac_cv_dwz_j=yes; ${DWZ} -j1 conftest$EXEEXT 2>/dev/null || ac_cv_dwz_j=no], ++ AC_MSG_FAILURE([unexpected compile failure]))]) ++ if test "x$ac_cv_dwz_j" = "xyes"; then ++ DWZ_J="-j" ++ fi ++ CFLAGS="$save_CFLAGS" ++else ++ AC_MSG_WARN([dwz not installed]) ++fi ++AC_SUBST([DWZ_J]) ++ + # Only really an issue on 32bit platforms. Makes sure we'll get large off_t. + AC_SYS_LARGEFILE + +diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in +index b07a52f..8090c84 100755 +--- a/scripts/find-debuginfo.in ++++ b/scripts/find-debuginfo.in +@@ -586,6 +586,7 @@ if $run_dwz \ + done + dwz_multifile_name="${dwz_multifile_name}${dwz_multifile_suffix}" + dwz_opts="-h -q -r" ++ [ -n "@DWZ_J@" ] && dwz_opts="${dwz_opts} -j ${n_jobs}" + [ ${#dwz_files[@]} -gt 1 ] && [ "$dwz_single_file_mode" = "false" ] \ + && dwz_opts="${dwz_opts} -m .dwz/${dwz_multifile_name}" + mkdir -p "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz" +-- +2.39.1 + diff --git a/0001-tests-Handle-zero-directory-entry-in-.debug_line-DWA.patch b/0001-tests-Handle-zero-directory-entry-in-.debug_line-DWA.patch index 2cadab2..2c3041c 100644 --- a/0001-tests-Handle-zero-directory-entry-in-.debug_line-DWA.patch +++ b/0001-tests-Handle-zero-directory-entry-in-.debug_line-DWA.patch @@ -29,7 +29,7 @@ index e5c9230..6a53365 100644 +save_CFLAGS="$CFLAGS" +CFLAGS="-gdwarf-5" +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i=0;]],[[/* empty main */]])], -+ [if readelf --debug-dump=line conftest.o 2>&1 | \ ++ [if $READELF --debug-dump=line conftest.o 2>&1 | \ + grep "DWARF Version:" 2>&1 | grep "5" > /dev/null 2>&1; \ + then ac_cv_dwarf_5_debugline=yes; \ + else ac_cv_dwarf_5_debugline=no; fi], @@ -71,7 +71,7 @@ index 0311d26..725e68e 100644 @@ -500,8 +502,8 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]]) AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]]) AT_CHECK([[ - readelf --debug-dump=line foo.o subdir_bar/bar.o baz.o \ + $READELF --debug-dump=line foo.o subdir_bar/bar.o baz.o \ - | grep -A5 "The Directory Table" | grep "^ [123]" \ - | cut -f2- -d/ | grep ^foo/ | sort + | grep -A5 "The Directory Table" | grep "^ [0123]" \ @@ -94,7 +94,7 @@ index 0311d26..725e68e 100644 AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]]) AT_CHECK([[ - readelf --debug-dump=line ./foobarbaz.part.o \ + $READELF --debug-dump=line ./foobarbaz.part.o \ - | grep -A5 "The Directory Table" | grep "^ [123]" \ - | cut -f2- -d/ | grep ^foo/ | sort + | grep -A5 "The Directory Table" | grep "^ [0123]" \ @@ -117,7 +117,7 @@ index 0311d26..725e68e 100644 AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]]) AT_CHECK([[ - readelf --debug-dump=line ./foobarbaz.exe \ + $READELF --debug-dump=line ./foobarbaz.exe \ - | grep -A5 "The Directory Table" | grep "^ [123]" \ - | cut -f2- -d/ | grep ^foo/ | sort + | grep -A5 "The Directory Table" | grep "^ [0123]" \ @@ -126,5 +126,5 @@ index 0311d26..725e68e 100644 AT_CLEANUP -- -2.27.0 +2.39.1 diff --git a/0001-use-READELF-not-readelf.patch b/0001-use-READELF-not-readelf.patch new file mode 100644 index 0000000..9e7f255 --- /dev/null +++ b/0001-use-READELF-not-readelf.patch @@ -0,0 +1,330 @@ +From 56e41d7c716a3657bdcce05146f7509d8a4e4a74 Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sun, 1 Aug 2021 21:15:35 +0100 +Subject: [PATCH] use $READELF, not readelf + +Allow user to specify own readelf. Use detected readelf, +not 'readelf'. + +Noticed as a set of test failures on system with only +$host-prefixed tools: + + debugedit/tests/testsuite.dir/at-groups/4/test-source: + line 40: readelf: command not found + + * configure.ac: Add READELF user override. + * scripts/find-debuginfo.in: Use @READELF@ instead of 'readelf'. + * tests/atlocal.in: Populate READELF variable detected by configure. + * tests/debugedit.at: Use $READELF instad of 'readelf' in tests. + * Makefile.am (do_subst): Add READELF substitution. + +Signed-off-by: Sergei Trofimovich +--- + Makefile.am | 3 ++- + configure.ac | 1 + + scripts/find-debuginfo.in | 2 +- + tests/atlocal.in | 1 + + tests/debugedit.at | 54 +++++++++++++++++++-------------------- + 5 files changed, 32 insertions(+), 29 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 98b2f20..2060b96 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -32,7 +32,8 @@ CLEANFILES = $(bin_SCRIPTS) + + # Some standard substitutions for scripts + do_subst = ($(SED) -e 's,[@]PACKAGE[@],$(PACKAGE),g' \ +- -e 's,[@]VERSION[@],$(VERSION),g') ++ -e 's,[@]VERSION[@],$(VERSION),g' \ ++ -e 's,[@]READELF[@],$(READELF),g') + + find-debuginfo: $(top_srcdir)/scripts/find-debuginfo.in Makefile + $(do_subst) < "$(top_srcdir)/scripts/$@.in" > "$@" +diff --git a/configure.ac b/configure.ac +index 85f2c4f..e5c9230 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -44,6 +44,7 @@ AC_PROG_SED + AC_PROG_CC_C99 + AC_PROG_LN_S + AC_CHECK_TOOL([LD], [ld]) ++AC_CHECK_TOOL([READELF], [readelf]) + AM_MISSING_PROG(HELP2MAN, help2man) + + # Only really an issue on 32bit platforms. Makes sure we'll get large off_t. +diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in +index 8b9ce77..9c0a735 100755 +--- a/scripts/find-debuginfo.in ++++ b/scripts/find-debuginfo.in +@@ -338,7 +338,7 @@ add_minidebug() + # symbol and NOBITS sections so cannot use --keep-only because that is + # too aggressive. Field $2 is the section name, $3 is the section type + # and $8 are the section flags. +- local remove_sections=`readelf -W -S "$debuginfo" \ ++ local remove_sections=`@READELF@ -W -S "$debuginfo" \ + | awk '{ if (index($2,".debug_") != 1 \ + && ($3 == "PROGBITS" || $3 == "NOTE" || $3 == "NOBITS") \ + && index($8,"A") == 0) \ +diff --git a/tests/atlocal.in b/tests/atlocal.in +index 0eec351..8399f8d 100644 +--- a/tests/atlocal.in ++++ b/tests/atlocal.in +@@ -9,6 +9,7 @@ CC="@CC@" + CFLAGS="" + LD="@LD@" + LDFLAGS="" ++READELF="@READELF@" + + GDWARF_5_FLAG=@GDWARF_5_FLAG@ + GZ_NONE_FLAG=@GZ_NONE_FLAG@ +diff --git a/tests/debugedit.at b/tests/debugedit.at +index 608b1d0..0311d26 100644 +--- a/tests/debugedit.at ++++ b/tests/debugedit.at +@@ -93,7 +93,7 @@ DEBUGEDIT_SETUP([-gdwarf-4]) + + # Capture strings that start with the testdir (pwd) directory path + # (and replace that textually with /foo/bar/baz) +-readelf -p.debug_str foo.o subdir_bar/bar.o baz.o | cut -c13- \ ++$READELF -p.debug_str foo.o subdir_bar/bar.o baz.o | cut -c13- \ + | grep ^$(pwd) | sort \ + | sed -e "s@$(pwd)@/foo/bar/baz@" > expout + +@@ -108,7 +108,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]]) + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]]) + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]]) + AT_CHECK([[ +-readelf -p.debug_str foo.o subdir_bar/bar.o baz.o | cut -c13- \ ++$READELF -p.debug_str foo.o subdir_bar/bar.o baz.o | cut -c13- \ + | grep ^/foo/bar/baz | sort + ]],[0],[expout]) + +@@ -125,7 +125,7 @@ DEBUGEDIT_SETUP([-gdwarf-5]) + + # Capture strings that start with the testdir (pwd) directory path + # (and replace that textually with /foo/bar/baz) +-readelf -p.debug_str -p.debug_line_str foo.o subdir_bar/bar.o baz.o \ ++$READELF -p.debug_str -p.debug_line_str foo.o subdir_bar/bar.o baz.o \ + | cut -c13- \ + | grep ^$(pwd) | sort | uniq \ + | sed -e "s@$(pwd)@/foo/bar/baz@" > expout +@@ -141,7 +141,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]]) + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]]) + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]]) + AT_CHECK([[ +-readelf -p.debug_str -p.debug_line_str foo.o subdir_bar/bar.o baz.o \ ++$READELF -p.debug_str -p.debug_line_str foo.o subdir_bar/bar.o baz.o \ + | cut -c13- \ + | grep ^/foo/bar/baz | sort | uniq + ]],[0],[expout],[ignore]) +@@ -160,7 +160,7 @@ DEBUGEDIT_SETUP([-gdwarf-4]) + # (and replace that textually with /foo/bar/baz) + # Note that partially linked files, might have multiple duplicate + # strings, but debugedit will merge them. So use sort -u. +-readelf -p.debug_str ./foobarbaz.part.o | cut -c13- \ ++$READELF -p.debug_str ./foobarbaz.part.o | cut -c13- \ + | grep ^$(pwd) | sort -u \ + | sed -e "s@$(pwd)@/foo/bar/baz@" > expout + +@@ -173,7 +173,7 @@ fi + # Check the replaced strings are all there. + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]]) + AT_CHECK([[ +-readelf -p.debug_str ./foobarbaz.part.o | cut -c13- \ ++$READELF -p.debug_str ./foobarbaz.part.o | cut -c13- \ + | grep ^/foo/bar/baz | sort + ]],[0],[expout]) + +@@ -192,7 +192,7 @@ DEBUGEDIT_SETUP([-gdwarf-5]) + # (and replace that textually with /foo/bar/baz) + # Note that partially linked files, might have multiple duplicate + # strings, but debugedit will merge them. So use sort -u. +-readelf -p.debug_str -p.debug_line_str ./foobarbaz.part.o | cut -c13- \ ++$READELF -p.debug_str -p.debug_line_str ./foobarbaz.part.o | cut -c13- \ + | grep ^$(pwd) | sort -u | uniq \ + | sed -e "s@$(pwd)@/foo/bar/baz@" > expout + +@@ -205,7 +205,7 @@ fi + # Check the replaced strings are all there. + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]]) + AT_CHECK([[ +-readelf -p.debug_str -p.debug_line_str ./foobarbaz.part.o | cut -c13- \ ++$READELF -p.debug_str -p.debug_line_str ./foobarbaz.part.o | cut -c13- \ + | grep ^/foo/bar/baz | sort | uniq + ]],[0],[expout],[ignore]) + +@@ -221,7 +221,7 @@ DEBUGEDIT_SETUP([-gdwarf-4]) + + # Capture strings that start with the testdir (pwd) directory path + # (and replace that textually with /foo/bar/baz) +-readelf -p.debug_str foobarbaz.exe | cut -c13- \ ++$READELF -p.debug_str foobarbaz.exe | cut -c13- \ + | grep ^$(pwd) | sort \ + | sed -e "s@$(pwd)@/foo/bar/baz@" > expout + +@@ -235,7 +235,7 @@ fi + # Check the replaced strings are all there. + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]]) + AT_CHECK([[ +-readelf -p.debug_str foobarbaz.exe | cut -c13- \ ++$READELF -p.debug_str foobarbaz.exe | cut -c13- \ + | grep ^/foo/bar/baz | sort + ]],[0],[expout]) + +@@ -252,7 +252,7 @@ DEBUGEDIT_SETUP([-gdwarf-5]) + + # Capture strings that start with the testdir (pwd) directory path + # (and replace that textually with /foo/bar/baz) +-readelf -p.debug_str -p.debug_line_str foobarbaz.exe | cut -c13- \ ++$READELF -p.debug_str -p.debug_line_str foobarbaz.exe | cut -c13- \ + | grep ^$(pwd) | sort | uniq \ + | sed -e "s@$(pwd)@/foo/bar/baz@" > expout + +@@ -266,7 +266,7 @@ fi + # Check the replaced strings are all there. + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]]) + AT_CHECK([[ +-readelf -p.debug_str -p.debug_line_str foobarbaz.exe | cut -c13- \ ++$READELF -p.debug_str -p.debug_line_str foobarbaz.exe | cut -c13- \ + | grep ^/foo/bar/baz | sort | uniq + ]],[0],[expout],[ignore]) + +@@ -305,7 +305,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]]) + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]]) + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]]) + AT_CHECK([[ +-readelf --debug-dump=info foo.o subdir_bar/bar.o baz.o \ ++$READELF --debug-dump=info foo.o subdir_bar/bar.o baz.o \ + | grep -E 'DW_AT_(name|comp_dir)' \ + | rev | cut -d: -f1 | rev | cut -c2- | grep ^/foo/bar/baz | sort -u + ]],[0],[expout]) +@@ -328,7 +328,7 @@ AT_DATA([expout], + + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]]) + AT_CHECK([[ +-readelf --debug-dump=info ./foobarbaz.part.o \ ++$READELF --debug-dump=info ./foobarbaz.part.o \ + | grep -E 'DW_AT_(name|comp_dir)' \ + | rev | cut -d: -f1 | rev | cut -c2- | grep ^/foo/bar/baz | sort -u + ]],[0],[expout]) +@@ -351,7 +351,7 @@ AT_DATA([expout], + + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]]) + AT_CHECK([[ +-readelf --debug-dump=info ./foobarbaz.exe | grep -E 'DW_AT_(name|comp_dir)' \ ++$READELF --debug-dump=info ./foobarbaz.exe | grep -E 'DW_AT_(name|comp_dir)' \ + | rev | cut -d: -f1 | rev | cut -c2- | grep ^/foo/bar/baz | sort -u + ]],[0],[expout]) + +@@ -385,7 +385,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]]) + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]]) + AT_CHECK([[ + for i in ./foo.o ./subdir_bar/bar.o ./baz.o;do \ +- readelf --debug-dump=info $i \ ++ $READELF --debug-dump=info $i \ + | awk '/Abbrev Number:.*DW_TAG_type_unit/{p=1}{if(p)print}/^$/{p=0}' \ + | sed -n 's/^.*> *DW_AT_name *:.* \(stringp[^ ]*\|st.\)$/\1/p' \ + | sort; +@@ -415,7 +415,7 @@ stz + + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]]) + AT_CHECK([[ +-readelf --debug-dump=info ./foobarbaz.part.o \ ++$READELF --debug-dump=info ./foobarbaz.part.o \ + | awk '/Abbrev Number:.*DW_TAG_type_unit/{p=1}{if(p)print}/^$/{p=0}' \ + | sed -n 's/^.*> *DW_AT_name *:.* \(stringp[^ ]*\|st.\)$/\1/p' \ + | sort +@@ -444,7 +444,7 @@ stz + + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]]) + AT_CHECK([[ +-readelf --debug-dump=info ./foobarbaz.exe \ ++$READELF --debug-dump=info ./foobarbaz.exe \ + | awk '/Abbrev Number:.*DW_TAG_type_unit/{p=1}{if(p)print}/^$/{p=0}' \ + | sed -n 's/^.*> *DW_AT_name *:.* \(stringp[^ ]*\|st.\)$/\1/p' \ + | sort +@@ -474,7 +474,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]]) + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]]) + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]]) + AT_CHECK([[ +-readelf --debug-dump=line foo.o subdir_bar/bar.o baz.o \ ++$READELF --debug-dump=line foo.o subdir_bar/bar.o baz.o \ + | grep -A3 "The Directory Table" | grep "^ [123]" \ + | grep /foo/ | cut -c5- | sort + ]],[0],[expout]) +@@ -499,7 +499,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]]) + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]]) + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]]) + AT_CHECK([[ +-readelf --debug-dump=line foo.o subdir_bar/bar.o baz.o \ ++$READELF --debug-dump=line foo.o subdir_bar/bar.o baz.o \ + | grep -A5 "The Directory Table" | grep "^ [123]" \ + | cut -f2- -d/ | grep ^foo/ | sort + ]],[0],[expout]) +@@ -521,7 +521,7 @@ AT_DATA([expout], + + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]]) + AT_CHECK([[ +-readelf --debug-dump=line ./foobarbaz.part.o \ ++$READELF --debug-dump=line ./foobarbaz.part.o \ + | grep -A3 "The Directory Table" | grep "^ [123]" \ + | grep /foo/ | cut -c5- | sort + ]],[0],[expout]) +@@ -544,7 +544,7 @@ foo/bar/baz/subdir_headers + + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]]) + AT_CHECK([[ +-readelf --debug-dump=line ./foobarbaz.part.o \ ++$READELF --debug-dump=line ./foobarbaz.part.o \ + | grep -A5 "The Directory Table" | grep "^ [123]" \ + | cut -f2- -d/ | grep ^foo/ | sort + ]],[0],[expout]) +@@ -566,7 +566,7 @@ AT_DATA([expout], + + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]]) + AT_CHECK([[ +-readelf --debug-dump=line ./foobarbaz.exe \ ++$READELF --debug-dump=line ./foobarbaz.exe \ + | grep -A3 "The Directory Table" | grep "^ [123]" \ + | grep /foo/ | cut -c5- | sort + ]],[0],[expout]) +@@ -589,7 +589,7 @@ foo/bar/baz/subdir_headers + + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]]) + AT_CHECK([[ +-readelf --debug-dump=line ./foobarbaz.exe \ ++$READELF --debug-dump=line ./foobarbaz.exe \ + | grep -A5 "The Directory Table" | grep "^ [123]" \ + | cut -f2- -d/ | grep ^foo/ | sort + ]],[0],[expout]) +@@ -615,7 +615,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]]) + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]]) + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]]) + AT_CHECK([[ +-readelf --debug-dump=macro foo.o subdir_bar/bar.o baz.o \ ++$READELF --debug-dump=macro foo.o subdir_bar/bar.o baz.o \ + | grep NUMBER | rev | cut -d: -f1 | rev | cut -c2- + ]],[0],[expout]) + +@@ -638,7 +638,7 @@ NUMBER 42 + + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]]) + AT_CHECK([[ +-readelf --debug-dump=macro ./foobarbaz.part.o \ ++$READELF --debug-dump=macro ./foobarbaz.part.o \ + | grep NUMBER | rev | cut -d: -f1 | rev | cut -c2- + ]],[0],[expout]) + +@@ -661,7 +661,7 @@ NUMBER 42 + + AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]]) + AT_CHECK([[ +-readelf --debug-dump=macro ./foobarbaz.exe \ ++$READELF --debug-dump=macro ./foobarbaz.exe \ + | grep NUMBER | rev | cut -d: -f1 | rev | cut -c2- + ]],[0],[expout]) + +-- +2.39.1 + diff --git a/0002-configure.ac-Use-AC_LINK_IFELSE-for-gz-none-check.patch b/0002-configure.ac-Use-AC_LINK_IFELSE-for-gz-none-check.patch new file mode 100644 index 0000000..5d6b74d --- /dev/null +++ b/0002-configure.ac-Use-AC_LINK_IFELSE-for-gz-none-check.patch @@ -0,0 +1,33 @@ +From 73652fa06c449f55b844890778c4cb592e0df62e Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Fri, 27 Jan 2023 15:23:15 +0100 +Subject: [PATCH 2/4] configure.ac: Use AC_LINK_IFELSE for -gz=none check + +Because of a bug in gcc 13.0 (pre-release) -gz=none does not work +correctly when linking the final binary in some situations (when +-gz=zstd isn't supported). Work around this by explicitly checking for +support with AC_LINK_IFELSE. + +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108572 + +Signed-off-by: Mark Wielaard +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index f2d1571..1d77e99 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -125,7 +125,7 @@ AC_SUBST([DWARF_5_DEBUGLINE]) + AC_CACHE_CHECK([whether gcc supports -gz=none], ac_cv_gz_none, [dnl + save_CFLAGS="$CFLAGS" + CFLAGS="-gz=none" +-AC_COMPILE_IFELSE([AC_LANG_SOURCE()], ac_cv_gz_none=yes, ac_cv_gz_none=no) ++AC_LINK_IFELSE([AC_LANG_SOURCE()], ac_cv_gz_none=yes, ac_cv_gz_none=no) + CFLAGS="$save_CFLAGS" + ]) + if test "$ac_cv_gz_none" = "yes"; then +-- +2.39.1 + diff --git a/0003-configure.ac-Use-AC_LANG_PROGRAM-for-AC_LINK_IFELSE-.patch b/0003-configure.ac-Use-AC_LANG_PROGRAM-for-AC_LINK_IFELSE-.patch new file mode 100644 index 0000000..cdfbb4b --- /dev/null +++ b/0003-configure.ac-Use-AC_LANG_PROGRAM-for-AC_LINK_IFELSE-.patch @@ -0,0 +1,32 @@ +From c206186e015aca89af2bb058f37e9db81160965e Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Fri, 27 Jan 2023 17:03:33 +0100 +Subject: [PATCH 3/4] configure.ac: Use AC_LANG_PROGRAM for AC_LINK_IFELSE + -gz=none check + +We do need a real AC_LANG_PROGRAM instead of just AC_LANG_SOURCE since +commit 73652f configure.ac: Use AC_LINK_IFELSE for -gz=none check + +Otherwise the check always fails because it will not have a main (). + +Signed-off-by: Mark Wielaard +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 1d77e99..6704dc0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -125,7 +125,7 @@ AC_SUBST([DWARF_5_DEBUGLINE]) + AC_CACHE_CHECK([whether gcc supports -gz=none], ac_cv_gz_none, [dnl + save_CFLAGS="$CFLAGS" + CFLAGS="-gz=none" +-AC_LINK_IFELSE([AC_LANG_SOURCE()], ac_cv_gz_none=yes, ac_cv_gz_none=no) ++AC_LINK_IFELSE([AC_LANG_PROGRAM()], ac_cv_gz_none=yes, ac_cv_gz_none=no) + CFLAGS="$save_CFLAGS" + ]) + if test "$ac_cv_gz_none" = "yes"; then +-- +2.39.1 + diff --git a/0004-scripts-find-debuginfo.in-Add-q-quiet.patch b/0004-scripts-find-debuginfo.in-Add-q-quiet.patch new file mode 100644 index 0000000..0e56d14 --- /dev/null +++ b/0004-scripts-find-debuginfo.in-Add-q-quiet.patch @@ -0,0 +1,116 @@ +From b8ac71d9f88202f00a32c5a8b3b4b93bb2fa110a Mon Sep 17 00:00:00 2001 +From: Prarit Bhargava +Date: Thu, 26 Jan 2023 16:08:57 -0500 +Subject: [PATCH 4/4] scripts/find-debuginfo.in: Add -q|--quiet + +Projects with a large number of compiled files end up with a large number +of 'extracting debug info from' messages in the build log. In the case of +the Fedora kernel these messages account for 8504 lines in the log, or 61% +of the entire log [1]. + +Removing these lines make the log easier to view and comprehend for some +projects, however, not all projects will want to silence these messages so +suppressing them must be optional. + +Add a -q|--quiet which allows users to silence the non-error output from +the script. + +[1] https://kojipkgs.fedoraproject.org//packages/kernel/6.2.0/0.rc5.20230123git2475bf0250de.38.fc38/data/logs/x86_64/build.log + +Signed-off-by: Prarit Bhargava +--- + scripts/find-debuginfo.in | 22 +++++++++++++++------- + 1 file changed, 15 insertions(+), 7 deletions(-) + +diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in +index 8090c84..7dec3c3 100755 +--- a/scripts/find-debuginfo.in ++++ b/scripts/find-debuginfo.in +@@ -26,7 +26,7 @@ Usage: find-debuginfo [OPTION]... [builddir] + automagically generates debug info and file lists + + Options: +-[--strict-build-id] [-g] [-r] [-m] [-i] [-n] ++[--strict-build-id] [-g] [-r] [-m] [-i] [-n] [-q] + [--keep-section SECTION] [--remove-section SECTION] + [--g-libs] + [-j N] [--jobs N] +@@ -94,6 +94,8 @@ will be called /usr/debug/src/. This makes sure the debug source + dirs are unique between package version, release and achitecture (Use + --unique-debug-src-base "%{name}-%{VERSION}-%{RELEASE}.%{_arch}") + ++The -q or --quiet flag silences non-error output from the script. ++ + All file names in switches are relative to builddir ('.' if not given). + EOF + } +@@ -146,6 +148,9 @@ n_jobs=1 + # exit early on --version or --help + done=false + ++# silence non-error output ++quiet=false ++ + BUILDDIR=. + out=debugfiles.list + srcout= +@@ -239,6 +244,9 @@ while [ $# -gt 0 ]; do + srcout=$2 + shift + ;; ++ -q|--quiet) ++ quiet=true ++ ;; + --version) + echo "find-debuginfo @VERSION@" + done=true; +@@ -437,7 +445,7 @@ do_file() + get_debugfn "$f" + [ -f "${debugfn}" ] && return + +- echo "extracting debug info from $f" ++ $quiet || echo "extracting debug info from $f" + # See also cpio SOURCEFILE copy. Directories must match up. + debug_base_name="$RPM_BUILD_DIR" + debug_dest_name="/usr/src/debug" +@@ -513,7 +521,7 @@ do_file() + grep "^$inum " "$temp/linked" | while read inum linked; do + link=$debugfn + get_debugfn "$linked" +- echo "hard linked $link to $debugfn" ++ $quiet || echo "hard linked $link to $debugfn" + mkdir -p "$(dirname "$debugfn")" && ln -nf "$link" "$debugfn" + done + fi +@@ -576,7 +584,7 @@ if $run_dwz \ + && [ -d "${RPM_BUILD_ROOT}/usr/lib/debug" ]; then + readarray dwz_files < <(cd "${RPM_BUILD_ROOT}/usr/lib/debug"; find -type f -name \*.debug | LC_ALL=C sort) + if [ ${#dwz_files[@]} -gt 0 ]; then +- size_before=$(du -sk ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1) ++ $quiet || size_before=$(du -sk ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1) + dwz_multifile_name="${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-${RPM_PACKAGE_RELEASE}.${RPM_ARCH}" + dwz_multifile_suffix= + dwz_multifile_idx=0 +@@ -600,8 +608,8 @@ if $run_dwz \ + echo >&2 "*** ERROR: DWARF compression requested, but no dwz installed" + exit 2 + fi +- size_after=$(du -sk ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1) +- echo "original debug info size: ${size_before}kB, size after compression: ${size_after}kB" ++ $quiet || size_after=$(du -sk ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1) ++ $quiet || echo "original debug info size: ${size_before}kB, size after compression: ${size_after}kB" + # Remove .dwz directory if empty + rmdir "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz" 2>/dev/null + +@@ -621,7 +629,7 @@ do + f=${f#$RPM_BUILD_ROOT} + t=${t#$RPM_BUILD_ROOT} + if [ -f "$debugdir$t" ]; then +- echo "symlinked /usr/lib/debug$t to /usr/lib/debug${f}.debug" ++ $quiet || echo "symlinked /usr/lib/debug$t to /usr/lib/debug${f}.debug" + debug_link "/usr/lib/debug$t" "${f}.debug" + fi + done +-- +2.39.1 + diff --git a/debugedit.spec b/debugedit.spec index a08ae74..b37bae6 100644 --- a/debugedit.spec +++ b/debugedit.spec @@ -1,6 +1,6 @@ Name: debugedit Version: 5.0 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Tools for debuginfo creation License: GPLv3+ and GPLv2+ and LGPLv2+ URL: https://sourceware.org/debugedit/ @@ -14,6 +14,9 @@ BuildRequires: pkgconfig(libdw) BuildRequires: help2man BuildRequires: gnupg2 +# For configure checking -j support +BuildRequires: dwz + # For the testsuite. BuildRequires: autoconf BuildRequires: automake @@ -38,7 +41,12 @@ Requires: grep %global _hardened_build 1 -Patch1: 0001-tests-Handle-zero-directory-entry-in-.debug_line-DWA.patch +Patch1: 0001-use-READELF-not-readelf.patch +Patch2: 0001-tests-Handle-zero-directory-entry-in-.debug_line-DWA.patch +Patch3: 0001-find-debuginfo-Pass-j-down-to-dwz.patch +Patch4: 0002-configure.ac-Use-AC_LINK_IFELSE-for-gz-none-check.patch +Patch5: 0003-configure.ac-Use-AC_LANG_PROGRAM-for-AC_LINK_IFELSE-.patch +Patch6: 0004-scripts-find-debuginfo.in-Add-q-quiet.patch %description The debugedit project provides programs and scripts for creating @@ -80,6 +88,15 @@ make check %{?_smp_mflags} %{_mandir}/man1/find-debuginfo.1* %changelog +* Fri Jan 27 2023 Mark Wielaard - 5.0-2 +- Refresh 0001-tests-Handle-zero-directory-entry-in-.debug_line-DWA.patch +- Add new upstream patches: + 0001-use-READELF-not-readelf.patch + 0001-find-debuginfo-Pass-j-down-to-dwz.patch + 0002-configure.ac-Use-AC_LINK_IFELSE-for-gz-none-check.patch + 0003-configure.ac-Use-AC_LANG_PROGRAM-for-AC_LINK_IFELSE-.patch + 0004-scripts-find-debuginfo.in-Add-q-quiet.patch + * Thu Jan 19 2023 Fedora Release Engineering - 5.0-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild