diff --git a/.gitignore b/.gitignore index 4d26b07..f4ae54b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ /debugedit-0.3.tar.xz.sig /debugedit-5.0.tar.xz /debugedit-5.0.tar.xz.sig +/debugedit-5.1.tar.xz +/debugedit-5.1.tar.xz.sig diff --git a/0001-debugedit-Add-support-for-.debug_str_offsets-DW_FORM.patch b/0001-debugedit-Add-support-for-.debug_str_offsets-DW_FORM.patch deleted file mode 100644 index ce45c4f..0000000 --- a/0001-debugedit-Add-support-for-.debug_str_offsets-DW_FORM.patch +++ /dev/null @@ -1,432 +0,0 @@ -From 3e7aeeab4f744ad15108775685db68d3a35b0735 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Thu, 23 Mar 2023 18:07:40 +0100 -Subject: [PATCH] debugedit: Add support for .debug_str_offsets (DW_FORM_strx) - -In theory supporting strx .debug_str_offsets is easy, the strings in -.debug_str are just read through an indirection table. When the -strings are updated in .debug_str we just need to rewrite the -indirection table. - -The tricky part is the ET_REL (object files or kernel modules) -support. Relocation reading is "global" per section and we expect to -read a relocation only once. But we need to read the -DW_AT_str_offsets_base before reading any strx form attributes. So we -read that first, then reset the relptr. And when we read from the -.debug_str_offsets section we need to save and restore the .debug_info -relptr. - - * tools/debugedit.c (do_read_24): New function. - (str_offsets_base): New static variable. - (buf_read_ule24): New function. - (buf_read_ube24): Likewise. - (setup_relbuf): Handle .debug_str_offsets. - (do_read_uleb128): New function. - (do_read_str_form_relocated): Likewise. - (read_abbrev): Handle DW_FORM_strx[1234]. - (edit_strp): Take the actual string form as argument. - Use do_read_str_form_relocated. - (read_dwarf5_line_entries): Pass form to edit_strp. - (edit_attributes_str_comp_dir): Take the actual string - form as argument. Use do_read_str_form_relocated. - (edit_attributes): Handle DW_FORM_strx[1234]. - (edit_info): Read DW_AT_str_offsets_base first. - (update_str_offsets): New function. - (edit_dwarf2): Setup do_read_24. Call update_str_offsets. - -https://sourceware.org/bugzilla/show_bug.cgi?id=28728 - -Signed-off-by: Mark Wielaard ---- - tools/debugedit.c | 216 ++++++++++++++++++++++++++++++++++++++++------ - 1 file changed, 192 insertions(+), 24 deletions(-) - -diff --git a/tools/debugedit.c b/tools/debugedit.c -index e654981..7802f9f 100644 ---- a/tools/debugedit.c -+++ b/tools/debugedit.c -@@ -1,4 +1,5 @@ - /* Copyright (C) 2001-2003, 2005, 2007, 2009-2011, 2016, 2017 Red Hat, Inc. -+ Copyright (C) 2022, 2023 Mark J. Wielaard - Written by Alexander Larsson , 2002 - Based on code by Jakub Jelinek , 2001. - String/Line table rewriting by Mark Wielaard , 2017. -@@ -264,6 +264,7 @@ typedef struct - }) - - static uint16_t (*do_read_16) (unsigned char *ptr); -+static uint32_t (*do_read_24) (unsigned char *ptr); - static uint32_t (*do_read_32) (unsigned char *ptr); - static void (*do_write_16) (unsigned char *ptr, uint16_t val); - static void (*do_write_32) (unsigned char *ptr, uint32_t val); -@@ -271,6 +272,9 @@ static void (*do_write_32) (unsigned char *ptr, uint32_t val); - static int ptr_size; - static int cu_version; - -+/* The offset into the .debug_str_offsets section for the current CU. */ -+static uint32_t str_offsets_base; -+ - static inline uint16_t - buf_read_ule16 (unsigned char *data) - { -@@ -283,6 +287,18 @@ buf_read_ube16 (unsigned char *data) - return data[1] | (data[0] << 8); - } - -+static inline uint32_t -+buf_read_ule24 (unsigned char *data) -+{ -+ return data[0] | (data[1] << 8) | (data[2] << 16); -+} -+ -+static inline uint32_t -+buf_read_ube24 (unsigned char *data) -+{ -+ return data[2] | (data[1] << 8) | (data[0] << 16); -+} -+ - static inline uint32_t - buf_read_ule32 (unsigned char *data) - { -@@ -544,10 +560,12 @@ setup_relbuf (DSO *dso, debug_section *sec, int *reltype) - /* Relocations against section symbols are uninteresting in REL. */ - if (dso->shdr[i].sh_type == SHT_REL && sym.st_value == 0) - continue; -- /* Only consider relocations against .debug_str, .debug_line, -- .debug_line_str, and .debug_abbrev. */ -+ /* Only consider relocations against .debug_str, -+ .debug_str_offsets, .debug_line, .debug_line_str, and -+ .debug_abbrev. */ - if (sym.st_shndx == 0 || - (sym.st_shndx != debug_sections[DEBUG_STR].sec -+ && sym.st_shndx != debug_sections[DEBUG_STR_OFFSETS].sec - && sym.st_shndx != debug_sections[DEBUG_LINE].sec - && sym.st_shndx != debug_sections[DEBUG_LINE_STR].sec - && sym.st_shndx != debug_sections[DEBUG_ABBREV].sec)) -@@ -684,6 +702,59 @@ update_rela_data (DSO *dso, struct debug_section *sec) - free (sec->relbuf); - } - -+static inline uint32_t -+do_read_uleb128 (unsigned char *ptr) -+{ -+ unsigned char *uleb_ptr = ptr; -+ return read_uleb128 (uleb_ptr); -+} -+ -+static inline uint32_t -+do_read_str_form_relocated (DSO *dso, uint32_t form, unsigned char *ptr) -+{ -+ uint32_t idx; -+ switch (form) -+ { -+ case DW_FORM_strp: -+ case DW_FORM_line_strp: -+ return do_read_32_relocated (ptr); -+ -+ case DW_FORM_strx1: -+ idx = *ptr; -+ break; -+ case DW_FORM_strx2: -+ idx = do_read_16 (ptr); -+ break; -+ case DW_FORM_strx3: -+ idx = do_read_24 (ptr); -+ break; -+ case DW_FORM_strx4: -+ idx = do_read_32 (ptr); -+ break; -+ case DW_FORM_strx: -+ idx = do_read_uleb128 (ptr); -+ break; -+ default: -+ error (1, 0, "Unhandled string form DW_FORM_0x%x", form); -+ return -1; -+ } -+ -+ unsigned char *str_off_ptr = debug_sections[DEBUG_STR_OFFSETS].data; -+ str_off_ptr += str_offsets_base; -+ str_off_ptr += idx * 4; -+ -+ /* Switch rel reading... */ -+ REL *old_relptr = relptr; -+ REL *old_relend = relend; -+ setup_relbuf(dso, &debug_sections[DEBUG_STR_OFFSETS], &reltype); -+ -+ uint32_t str_off = do_read_32_relocated (str_off_ptr); -+ -+ relptr = old_relptr; -+ relend = old_relend; -+ return str_off; -+} -+ - struct abbrev_attr - { - unsigned int attr; -@@ -789,7 +860,12 @@ no_memory: - || form == DW_FORM_addrx1 - || form == DW_FORM_addrx2 - || form == DW_FORM_addrx3 -- || form == DW_FORM_addrx4))) -+ || form == DW_FORM_addrx4 -+ || form == DW_FORM_strx -+ || form == DW_FORM_strx1 -+ || form == DW_FORM_strx2 -+ || form == DW_FORM_strx3 -+ || form == DW_FORM_strx4))) - { - error (0, 0, "%s: Unknown DWARF DW_FORM_0x%x", dso->filename, - form); -@@ -1520,9 +1596,10 @@ edit_dwarf2_line (DSO *dso) - } - } - --/* Record or adjust (according to phase) DW_FORM_strp or DW_FORM_line_strp. */ -+/* Record or adjust (according to phase) DW_FORM_strp or DW_FORM_line_strp. -+ Also handles DW_FORM_strx, but just for recording the (indexed) string. */ - static void --edit_strp (DSO *dso, bool line_strp, unsigned char *ptr, int phase, -+edit_strp (DSO *dso, uint32_t form, unsigned char *ptr, int phase, - bool handled_strp) - { - unsigned char *ptr_orig = ptr; -@@ -1537,16 +1614,19 @@ edit_strp (DSO *dso, bool line_strp, unsigned char *ptr, int phase, - recorded. */ - if (! handled_strp) - { -- size_t idx = do_read_32_relocated (ptr); -- record_existing_string_entry_idx (line_strp, dso, idx); -+ size_t idx = do_read_str_form_relocated (dso, form, ptr); -+ record_existing_string_entry_idx (form == DW_FORM_line_strp, -+ dso, idx); - } - } -- else if (line_strp -- ? need_line_strp_update : need_strp_update) /* && phase == 1 */ -+ else if ((form == DW_FORM_strp -+ || form == DW_FORM_line_strp) /* DW_FORM_strx stays the same. */ -+ && (form == DW_FORM_line_strp -+ ? need_line_strp_update : need_strp_update)) /* && phase == 1 */ - { - struct stridxentry *entry; - size_t idx, new_idx; -- struct strings *strings = (line_strp -+ struct strings *strings = (form == DW_FORM_line_strp - ? &dso->debug_line_str : &dso->debug_str); - idx = do_read_32_relocated (ptr); - entry = string_find_entry (strings, idx); -@@ -1926,9 +2006,10 @@ read_dwarf5_line_entries (DSO *dso, unsigned char **ptrp, - - switch (form) - { -+ /* Note we don't expect DW_FORM_strx in the line table. */ - case DW_FORM_strp: - case DW_FORM_line_strp: -- edit_strp (dso, line_strp, *ptrp, phase, handled_strp); -+ edit_strp (dso, form, *ptrp, phase, handled_strp); - break; - } - -@@ -2110,11 +2191,12 @@ find_new_list_offs (struct debug_lines *lines, size_t idx) - - /* Read DW_FORM_strp or DW_FORM_line_strp collecting compilation directory. */ - static void --edit_attributes_str_comp_dir (bool line_strp, DSO *dso, unsigned char **ptrp, -+edit_attributes_str_comp_dir (uint32_t form, DSO *dso, unsigned char **ptrp, - int phase, char **comp_dirp, bool *handled_strpp) - { - const char *dir; -- size_t idx = do_read_32_relocated (*ptrp); -+ size_t idx = do_read_str_form_relocated (dso, form, *ptrp); -+ bool line_strp = form == DW_FORM_line_strp; - /* In phase zero we collect the comp_dir. */ - if (phase == 0) - { -@@ -2245,20 +2327,29 @@ edit_attributes (DSO *dso, unsigned char *ptr, struct abbrev_tag *t, int phase) - } - } - } -- else if (form == DW_FORM_strp) -- edit_attributes_str_comp_dir (false /* line_strp */, dso, -+ else if (form == DW_FORM_strp -+ || form == DW_FORM_line_strp -+ || form == DW_FORM_strx -+ || form == DW_FORM_strx1 -+ || form == DW_FORM_strx2 -+ || form == DW_FORM_strx3 -+ || form == DW_FORM_strx4) -+ edit_attributes_str_comp_dir (form, dso, - &ptr, phase, &comp_dir, - &handled_strp); -- else if (form == DW_FORM_line_strp) -- edit_attributes_str_comp_dir (true /* line_strp */, dso, &ptr, -- phase, &comp_dir, &handled_strp); - } - else if ((t->tag == DW_TAG_compile_unit - || t->tag == DW_TAG_partial_unit) - && ((form == DW_FORM_strp - && debug_sections[DEBUG_STR].data) - || (form == DW_FORM_line_strp -- && debug_sections[DEBUG_LINE_STR].data)) -+ && debug_sections[DEBUG_LINE_STR].data) -+ || ((form == DW_FORM_strx -+ || form == DW_FORM_strx1 -+ || form == DW_FORM_strx2 -+ || form == DW_FORM_strx3 -+ || form == DW_FORM_strx4) -+ && debug_sections[DEBUG_STR_OFFSETS].data)) - && t->attr[i].attr == DW_AT_name) - { - bool line_strp = form == DW_FORM_line_strp; -@@ -2267,7 +2358,7 @@ edit_attributes (DSO *dso, unsigned char *ptr, struct abbrev_tag *t, int phase) - unit. If starting with / it is a full path name. - Note that we don't handle DW_FORM_string in this - case. */ -- size_t idx = do_read_32_relocated (ptr); -+ size_t idx = do_read_str_form_relocated (dso, form, ptr); - - /* In phase zero we will look for a comp_dir to use. */ - if (phase == 0) -@@ -2314,10 +2405,13 @@ edit_attributes (DSO *dso, unsigned char *ptr, struct abbrev_tag *t, int phase) - switch (form) - { - case DW_FORM_strp: -- edit_strp (dso, false /* line_strp */, ptr, phase, handled_strp); -- break; - case DW_FORM_line_strp: -- edit_strp (dso, true /* line_strp */, ptr, phase, handled_strp); -+ case DW_FORM_strx: -+ case DW_FORM_strx1: -+ case DW_FORM_strx2: -+ case DW_FORM_strx3: -+ case DW_FORM_strx4: -+ edit_strp (dso, form, ptr, phase, handled_strp); - break; - } - -@@ -2404,6 +2498,8 @@ edit_info (DSO *dso, int phase, struct debug_section *sec) - uint32_t value; - htab_t abbrev; - struct abbrev_tag tag, *t; -+ int i; -+ bool first; - - ptr = sec->data; - if (ptr == NULL) -@@ -2507,6 +2603,8 @@ edit_info (DSO *dso, int phase, struct debug_section *sec) - if (abbrev == NULL) - return 1; - -+ first = true; -+ str_offsets_base = 0; - while (ptr < endcu) - { - tag.entry = read_uleb128 (ptr); -@@ -2521,6 +2619,30 @@ edit_info (DSO *dso, int phase, struct debug_section *sec) - return 1; - } - -+ /* We need str_offsets_base before processing the CU. */ -+ if (first) -+ { -+ first = false; -+ if (cu_version >= 5) -+ { -+ uint32_t form; -+ unsigned char *fptr = ptr; -+ // We will read this DIE again, save and reset rel reading -+ REL *old_relptr = relptr; -+ for (i = 0; i < t->nattr; ++i) -+ { -+ form = t->attr[i].form; -+ if (t->attr[i].attr == DW_AT_str_offsets_base) -+ { -+ str_offsets_base = do_read_32_relocated (fptr); -+ break; -+ } -+ skip_form (dso, &form, &fptr); -+ } -+ // Reset the rel reading... -+ relptr = old_relptr; -+ } -+ } - ptr = edit_attributes (dso, ptr, t, phase); - if (ptr == NULL) - break; -@@ -2554,6 +2676,41 @@ edit_dwarf2_any_str (DSO *dso, struct strings *strings, debug_section *secp) - strings->str_buf = strdata->d_buf; - } - -+/* Rebuild .debug_str_offsets. */ -+static void -+update_str_offsets (DSO *dso) -+{ -+ unsigned char *ptr = debug_sections[DEBUG_STR_OFFSETS].data; -+ unsigned char *endp = ptr + debug_sections[DEBUG_STR_OFFSETS].size; -+ -+ while (ptr < endp) -+ { -+ /* Read header, unit_length, version and padding. */ -+ if (endp - ptr < 3 * 4) -+ break; -+ uint32_t unit_length = read_32 (ptr); -+ if (unit_length == 0xffffffff || endp - ptr < unit_length) -+ break; -+ unsigned char *endidxp = ptr + unit_length; -+ uint32_t version = read_32 (ptr); -+ if (version != 5) -+ break; -+ uint32_t padding = read_32 (ptr); -+ if (padding != 0) -+ break; -+ -+ while (ptr < endidxp) -+ { -+ struct stridxentry *entry; -+ size_t idx, new_idx; -+ idx = do_read_32_relocated (ptr); -+ entry = string_find_entry (&dso->debug_str, idx); -+ new_idx = strent_offset (entry->entry); -+ write_32_relocated (ptr, new_idx); -+ } -+ } -+} -+ - static int - edit_dwarf2 (DSO *dso) - { -@@ -2675,6 +2832,7 @@ edit_dwarf2 (DSO *dso) - if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2LSB) - { - do_read_16 = buf_read_ule16; -+ do_read_24 = buf_read_ule24; - do_read_32 = buf_read_ule32; - do_write_16 = dwarf2_write_le16; - do_write_32 = dwarf2_write_le32; -@@ -2682,6 +2840,7 @@ edit_dwarf2 (DSO *dso) - else if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2MSB) - { - do_read_16 = buf_read_ube16; -+ do_read_24 = buf_read_ube24; - do_read_32 = buf_read_ube32; - do_write_16 = dwarf2_write_be16; - do_write_32 = dwarf2_write_be32; -@@ -2997,6 +3156,15 @@ edit_dwarf2 (DSO *dso) - dirty_section (DEBUG_MACRO); - if (need_stmt_update || need_line_strp_update) - dirty_section (DEBUG_LINE); -+ if (need_strp_update && debug_sections[DEBUG_STR_OFFSETS].data != NULL) -+ { -+ setup_relbuf(dso, &debug_sections[DEBUG_STR_OFFSETS], &reltype); -+ rel_updated = false; -+ update_str_offsets (dso); -+ dirty_section (DEBUG_STR_OFFSETS); -+ if (rel_updated) -+ update_rela_data (dso, &debug_sections[DEBUG_STR_OFFSETS]); -+ } - - /* Update any relocations addends we might have touched. */ - if (info_rel_updated) --- -2.42.0 - diff --git a/0001-find-debuginfo-Add-v-verbose-for-per-file-messages.patch b/0001-find-debuginfo-Add-v-verbose-for-per-file-messages.patch deleted file mode 100644 index a8294a9..0000000 --- a/0001-find-debuginfo-Add-v-verbose-for-per-file-messages.patch +++ /dev/null @@ -1,199 +0,0 @@ -From 84cfaca936a9dcfc26bd9d59edbdeeae88fc4763 Mon Sep 17 00:00:00 2001 -From: Denys Vlasenko -Date: Thu, 22 Jun 2023 15:31:03 +0200 -Subject: [PATCH] find-debuginfo: Add -v,--verbose for per file messages - -Only print messages what big steps we are at without --verbose. - -For a reader of rpmbuild's log, it's rather unclear what find-debuginfo -is doing. It used to be too verbose, "extracting debug info from FILE" -for every file, and while this can be suppressed now, we still end up -with something semi-mysterious like this: - -... -extracting debug info from /builddir/build/BUILDROOT/xyz -gdb-add-index: No index was created for /builddir/build/BUILDROOT/xyz -gdb-add-index: [Was there no debuginfo? Was there already an index?] -symlinked /usr/lib/debug/usr/lib64/libcpupower.so.0.0.1.debug to /usr/lib/debug/usr/lib64/libcpupower.so.debug -symlinked /usr/lib/debug/usr/lib64/libcpupower.so.0.0.1.debug to /usr/lib/debug/usr/lib64/libcpupower.so.0.debug -cpio: binutils-2.30/bfd: Cannot stat: No such file or directory -cpio: binutils-2.30/bfd/aout-target.h: Cannot stat: No such file or directory -cpio: binutils-2.30/bfd/aoutx.h: Cannot stat: No such file or directory -cpio: binutils-2.30/bfd/archive.c: Cannot stat: No such file or directory -cpio: binutils-2.30/bfd/archive64.c: Cannot stat: No such file or directory -... -775655 blocks -+ /usr/lib/rpm/check-buildroot -+ /usr/lib/rpm/redhat/brp-ldconfig -... - -The reader is left confused. "What these cpio errors are about? -Why those sources are not found?" (Well, because not every source -name extracted by 'debugedit -l' has to exist, but this requires -considerable digging aroung to understand). - -We can give a few messages explaining what general steps we go through: - - Extracting debug info from N files - DWARF-compressing N files - Creating .debug symlinks for symlinks to ELF files - Copying sources found by 'debugedit -l' - -This is also useful to get a feeling which steps are time consuming. -Kernel builds often need to investigate this aspect. To help a bit more, -add "find-debuginfo: starting" and "find-debuginfo: done" messages too. - -This patch adds these messages. -The -q options suppress these messages too. - -It also adds a --verbose flag to print per file messages. -Those per file messages are now suppressed by default and -only the general step messages are show. Unless -q is given, -which suppresses all non-error output. - -Signed-off-by: Denys Vlasenko -Signed-off-by: Mark Wielaard ---- - scripts/find-debuginfo.in | 36 +++++++++++++++++++++++++++--------- - 1 file changed, 27 insertions(+), 9 deletions(-) - -diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in -index f87b777..5613f69 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] [-q] -+[--strict-build-id] [-g] [-r] [-m] [-i] [-n] [-q] [-v] - [--keep-section SECTION] [--remove-section SECTION] - [--g-libs] - [-j N] [--jobs N] -@@ -94,7 +94,9 @@ 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. -+The -q or --quiet flag silences all non-error output from the script. -+The -v or --verbose flag add more output for all files processed. -+When neither -q or -v is given then only output for each pass is given. - - All file names in switches are relative to builddir ('.' if not given). - EOF -@@ -150,9 +152,12 @@ n_jobs=1 - # exit early on --version or --help - done=false - --# silence non-error output -+# silence all output - quiet=false - -+# add more non-error output -+verbose=false -+ - BUILDDIR=. - out=debugfiles.list - srcout= -@@ -248,6 +253,11 @@ while [ $# -gt 0 ]; do - ;; - -q|--quiet) - quiet=true -+ verbose=false -+ ;; -+ -v|--verbose) -+ quiet=false -+ verbose=true - ;; - --version) - echo "find-debuginfo @VERSION@" -@@ -291,6 +301,8 @@ if [ "$strip_g" = "true" ] && [ "$strip_glibs" = "true" ]; then - exit 2 - fi - -+$quiet || echo "find-debuginfo: starting" 2>&1 -+ - i=0 - while ((i < nout)); do - outs[$i]="$BUILDDIR/${outs[$i]}" -@@ -447,7 +459,7 @@ do_file() - get_debugfn "$f" - [ -f "${debugfn}" ] && return - -- $quiet || echo "extracting debug info from $f" -+ $verbose && 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" -@@ -523,7 +535,7 @@ do_file() - grep "^$inum " "$temp/linked" | while read inum linked; do - link=$debugfn - get_debugfn "$linked" -- $quiet || echo "hard linked $link to $debugfn" -+ $verbose && echo "hard linked $link to $debugfn" - mkdir -p "$(dirname "$debugfn")" && ln -nf "$link" "$debugfn" - done - fi -@@ -551,6 +563,7 @@ run_job() - } - - n_files=$(wc -l <"$temp/primary") -+$quiet || echo "Extracting debug info from $n_files files" 2>&1 - if [ $n_jobs -gt $n_files ]; then - n_jobs=$n_files - fi -@@ -589,7 +602,8 @@ 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 -- $quiet || size_before=$(du -sk ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1) -+ $quiet || echo "DWARF-compressing ${#dwz_files[@]} files" 2>&1 -+ $verbose && 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 -@@ -613,8 +627,8 @@ if $run_dwz \ - echo >&2 "*** ERROR: DWARF compression requested, but no dwz installed" - exit 2 - fi -- $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" -+ $verbose && size_after=$(du -sk ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1) -+ $verbose && 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 - -@@ -627,6 +641,7 @@ fi - - # For each symlink whose target has a .debug file, - # make a .debug symlink to that file. -+$quiet || echo "Creating .debug symlinks for symlinks to ELF files" 2>&1 - find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*" -type l -print | - while read f - do -@@ -634,7 +649,7 @@ do - f=${f#$RPM_BUILD_ROOT} - t=${t#$RPM_BUILD_ROOT} - if [ -f "$debugdir$t" ]; then -- $quiet || echo "symlinked /usr/lib/debug$t to /usr/lib/debug${f}.debug" -+ $verbose && echo "symlinked /usr/lib/debug$t to /usr/lib/debug${f}.debug" - debug_link "/usr/lib/debug$t" "${f}.debug" - fi - done -@@ -648,6 +663,7 @@ if [ -s "$SOURCEFILE" ]; then - debug_dest_name="/usr/src/debug/${unique_debug_src_base}" - fi - -+ $quiet || echo "Copying sources found by 'debugedit -l' to ${debug_dest_name}" 2>&1 - mkdir -p "${RPM_BUILD_ROOT}${debug_dest_name}" - # Filter out anything compiler generated which isn't a source file. - # e.g. , , <__thread_local_inner macros>. -@@ -763,3 +779,5 @@ if ((nout > 0)); then - cat "$LISTFILE" >> "${LISTFILE}.new" - mv "${LISTFILE}.new" "$LISTFILE" - fi -+ -+$quiet || echo "find-debuginfo: done" 2>&1 --- -2.39.3 - diff --git a/0001-find-debuginfo-Pass-j-down-to-dwz.patch b/0001-find-debuginfo-Pass-j-down-to-dwz.patch deleted file mode 100644 index 75be261..0000000 --- a/0001-find-debuginfo-Pass-j-down-to-dwz.patch +++ /dev/null @@ -1,86 +0,0 @@ -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-find-debuginfo-Prefix-install_dir-to-PATH.patch b/0001-find-debuginfo-Prefix-install_dir-to-PATH.patch deleted file mode 100644 index bbf6aff..0000000 --- a/0001-find-debuginfo-Prefix-install_dir-to-PATH.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 7f8e83cad517db081e1e0369b758d0279e0a6e1b Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Thu, 29 Jun 2023 14:26:39 +0200 -Subject: [PATCH] find-debuginfo: Prefix install_dir to PATH - -Some distros install a symlink to find-debuginfo[.sh] under the -old /usr/lib/rpm/ path. But don't have symlinks there for other -helper tools like debugedit and sepdebugcrcfix. So those tools -are then not under the install_dir as find-debuginfo calculates -it. So instead of invoking those helper tools with a full install -dir path, prefix the install dir to the PATH so the tools can be -found there (or anywhere else on the PATH). - -Signed-off-by: Mark Wielaard ---- - scripts/find-debuginfo.in | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in -index e7ac095..f87b777 100755 ---- a/scripts/find-debuginfo.in -+++ b/scripts/find-debuginfo.in -@@ -101,7 +101,9 @@ EOF - } - - # Figure out where we are installed so we can call other helper scripts. -+# Prefix to PATH to prefer tools from install dir. - install_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -+PATH=${install_dir}:$PATH - - # With -g arg, pass it to strip on libraries or executables. - strip_g=false -@@ -457,7 +459,7 @@ do_file() - if [ "$no_recompute_build_id" = "true" ]; then - no_recompute="-n" - fi -- id=$(${install_dir}/debugedit -b "$debug_base_name" -d "$debug_dest_name" \ -+ id=$(debugedit -b "$debug_base_name" -d "$debug_dest_name" \ - $no_recompute -i \ - ${build_id_seed:+--build-id-seed="$build_id_seed"} \ - -l "$SOURCEFILE" "$f") || exit -@@ -619,7 +621,7 @@ if $run_dwz \ - # dwz invalidates .gnu_debuglink CRC32 in the main files. - cat "$ELFBINSFILE" | - (cd "$RPM_BUILD_ROOT"; \ -- tr '\n' '\0' | xargs -0 ${install_dir}/sepdebugcrcfix usr/lib/debug) -+ tr '\n' '\0' | xargs -0 sepdebugcrcfix usr/lib/debug) - fi - fi - --- -2.40.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 deleted file mode 100644 index 2c3041c..0000000 --- a/0001-tests-Handle-zero-directory-entry-in-.debug_line-DWA.patch +++ /dev/null @@ -1,130 +0,0 @@ -From ae27211cbbfb63a0ad3c141cd1310d7f583ec40e Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Fri, 30 Jul 2021 18:09:46 +0200 -Subject: [PATCH] tests: Handle zero directory entry in .debug_line DWARF5 - debugedit.at - -We were skipping the zero directory entry, because it was always -the same as the directory entry at position one. But that isn't -true anymore with gcc 11.2.1. There the zero dir entry is unique. -Fix the debugedit.at .debug_line testcases using DWARF5 to also -include dir entry zero. - -Signed-off-by: Mark Wielaard ---- - configure.ac | 14 ++++++++++++++ - tests/atlocal.in | 1 + - tests/debugedit.at | 18 ++++++++++++------ - 3 files changed, 27 insertions(+), 6 deletions(-) - -diff --git a/configure.ac b/configure.ac -index e5c9230..6a53365 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -87,6 +87,20 @@ CFLAGS="$save_CFLAGS" - GDWARF_5_FLAG=$ac_cv_gdwarf_5 - AC_SUBST([GDWARF_5_FLAG]) - -+AC_CACHE_CHECK([whether -gdwarf-5 produced DWARF5 .debug_line], ac_cv_dwarf_5_debugline, [dnl -+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 | \ -+ 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], -+ ac_cv_dwarf_5_debugline=no) -+CFLAGS="$save_CFLAGS" -+]) -+DWARF_5_DEBUGLINE=$ac_cv_dwarf_5_debugline -+AC_SUBST([DWARF_5_DEBUGLINE]) -+ - AC_CACHE_CHECK([whether gcc supports -gz=none], ac_cv_gz_none, [dnl - save_CFLAGS="$CFLAGS" - CFLAGS="-gz=none" -diff --git a/tests/atlocal.in b/tests/atlocal.in -index 8399f8d..d916301 100644 ---- a/tests/atlocal.in -+++ b/tests/atlocal.in -@@ -13,3 +13,4 @@ READELF="@READELF@" - - GDWARF_5_FLAG=@GDWARF_5_FLAG@ - GZ_NONE_FLAG=@GZ_NONE_FLAG@ -+DWARF_5_DEBUGLINE=@DWARF_5_DEBUGLINE@ -diff --git a/tests/debugedit.at b/tests/debugedit.at -index 0311d26..725e68e 100644 ---- a/tests/debugedit.at -+++ b/tests/debugedit.at -@@ -488,10 +488,12 @@ AT_CLEANUP - AT_SETUP([debugedit .debug_line objects DWARF5]) - AT_KEYWORDS([debuginfo] [debugedit]) - AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) -+AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"]) - DEBUGEDIT_SETUP([-gdwarf-5]) - - AT_DATA([expout], - [foo/bar/baz -+foo/bar/baz/subdir_bar - foo/bar/baz/subdir_headers - ]) - -@@ -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 \ -- | grep -A5 "The Directory Table" | grep "^ [123]" \ -- | cut -f2- -d/ | grep ^foo/ | sort -+ | grep -A5 "The Directory Table" | grep "^ [0123]" \ -+ | cut -f2- -d/ | grep ^foo/ | sort -u - ]],[0],[expout]) - - AT_CLEANUP -@@ -535,18 +537,20 @@ AT_CLEANUP - AT_SETUP([debugedit .debug_line partial DWARF5]) - AT_KEYWORDS([debuginfo] [debugedit]) - AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) -+AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"]) - DEBUGEDIT_SETUP([-gdwarf-5]) - - AT_DATA([expout], - [foo/bar/baz -+foo/bar/baz/subdir_bar - 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 \ -- | grep -A5 "The Directory Table" | grep "^ [123]" \ -- | cut -f2- -d/ | grep ^foo/ | sort -+ | grep -A5 "The Directory Table" | grep "^ [0123]" \ -+ | cut -f2- -d/ | grep ^foo/ | sort -u - ]],[0],[expout]) - - AT_CLEANUP -@@ -580,18 +584,20 @@ AT_CLEANUP - AT_SETUP([debugedit .debug_line exe DWARF5]) - AT_KEYWORDS([debuginfo] [debugedit]) - AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) -+AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"]) - DEBUGEDIT_SETUP([-gdwarf-5]) - - AT_DATA([expout], - [foo/bar/baz -+foo/bar/baz/subdir_bar - foo/bar/baz/subdir_headers - ]) - - AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]]) - AT_CHECK([[ - $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]" \ -+ | cut -f2- -d/ | grep ^foo/ | sort -u - ]],[0],[expout]) - - AT_CLEANUP --- -2.39.1 - diff --git a/0001-use-READELF-not-readelf.patch b/0001-use-READELF-not-readelf.patch deleted file mode 100644 index 9e7f255..0000000 --- a/0001-use-READELF-not-readelf.patch +++ /dev/null @@ -1,330 +0,0 @@ -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 deleted file mode 100644 index 5d6b74d..0000000 --- a/0002-configure.ac-Use-AC_LINK_IFELSE-for-gz-none-check.patch +++ /dev/null @@ -1,33 +0,0 @@ -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 deleted file mode 100644 index cdfbb4b..0000000 --- a/0003-configure.ac-Use-AC_LANG_PROGRAM-for-AC_LINK_IFELSE-.patch +++ /dev/null @@ -1,32 +0,0 @@ -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 deleted file mode 100644 index 0e56d14..0000000 --- a/0004-scripts-find-debuginfo.in-Add-q-quiet.patch +++ /dev/null @@ -1,116 +0,0 @@ -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 74dcf8f..8293a29 100644 --- a/debugedit.spec +++ b/debugedit.spec @@ -1,7 +1,7 @@ Name: debugedit -Version: 5.0 -Release: 16%{?dist} -Summary: Tools for debuginfo creation +Version: 5.1 +Release: 1%{?dist} +Summary: Tools and scripts for creating debuginfo and source file distributions, collect build-ids and rewrite source paths in DWARF data for debugging, tracing and profiling. License: GPL-3.0-or-later AND GPL-2.0-or-later AND LGPL-2.0-or-later URL: https://sourceware.org/debugedit/ Source0: https://sourceware.org/pub/debugedit/%{version}/%{name}-%{version}.tar.xz @@ -17,6 +17,9 @@ BuildRequires: gnupg2 # For configure checking -j support BuildRequires: dwz +# For debugedit build-id recomputation +BuildRequires: xxhash-devel + # For the testsuite. BuildRequires: autoconf BuildRequires: automake @@ -41,16 +44,6 @@ Requires: grep %global _hardened_build 1 -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 -Patch7: 0001-find-debuginfo-Prefix-install_dir-to-PATH.patch -Patch8: 0001-find-debuginfo-Add-v-verbose-for-per-file-messages.patch -Patch9: 0001-debugedit-Add-support-for-.debug_str_offsets-DW_FORM.patch - %description The debugedit project provides programs and scripts for creating debuginfo and source file distributions, collect build-ids and rewrite @@ -91,6 +84,10 @@ make check %{?_smp_mflags} %{_mandir}/man1/find-debuginfo.1* %changelog +* Tue Oct 29 2024 Mark Wielaard - 5.1-1 +- New upstream 5.1 release +- Drop all local patches + * Tue Oct 29 2024 Troy Dawson - 5.0-16 - Bump release for October 2024 mass rebuild: Resolves: RHEL-64018 diff --git a/sources b/sources index 3a4c062..14db3d8 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (debugedit-5.0.tar.xz) = 7e7f529eafe41b53f0b5bfc58282fdbfa0dfa93ed7908b70e81942d6d2b6f80fc9c6bff2ed9674fd98947e5750b615f4c8b222544989e2900c5f8ff5ae0efb92 -SHA512 (debugedit-5.0.tar.xz.sig) = 2223841eb6c63616dc24028e8076ab9d82579e8d6efa4bba45e5dbd0eb181c947feae6f944136f3504a78678569ae96dc6c4a0dd4e7012bd9aa522b0f7525dc9 +SHA512 (debugedit-5.1.tar.xz) = 72f4dcc0fba223a85d261aa38400e229f04c7c96adafe455919a8f702d3d7d9cdfb991b403d53f2ac4948ca19eeb43d3d49c0ea2616065657c120647a30575d3 +SHA512 (debugedit-5.1.tar.xz.sig) = 8fc5072f05df2df630994844bd758dece9479c5f68182c10fd7ba4bc1c9a9601f6e399a2ad3146e58cdef75aa36871b642b64cb53c42cedfb05b310773994e5f