debugedit: Add -n to avoid recomputing of build-id

Avoid `DWARF version 0 unhandled' for compressed ELFs in
find-debuginfo-files.

Based on 6e9fd97f6 ("debugedit: Add -n, --no-recompute-build-id.")
by Mark Wielaard <mark@klomp.org>.
This commit is contained in:
2020-06-26 16:09:36 +03:00
parent 5cc014bed6
commit 1f2ad272a1
2 changed files with 6 additions and 3 deletions

View File

@ -55,7 +55,7 @@ while read -r f; do
# Save canonical file name for later symlinks filtering. # Save canonical file name for later symlinks filtering.
readlink -ve "$debugf" >> .tmp/files-can readlink -ve "$debugf" >> .tmp/files-can
id=$(@RPMCONFIGDIR@/debugedit -i "$debugf") id=$(@RPMCONFIGDIR@/debugedit -n -i "$debugf")
[ -n "$id" ] || continue [ -n "$id" ] || continue
link=./usr/lib/debug/.build-id/${id:0:2}/${id:2} link=./usr/lib/debug/.build-id/${id:0:2}/${id:2}

View File

@ -51,6 +51,7 @@ char *dest_dir = NULL;
char *list_file = NULL; char *list_file = NULL;
int list_file_fd = -1; int list_file_fd = -1;
int do_build_id = 0; int do_build_id = 0;
int no_recompute_build_id = 0;
typedef struct typedef struct
{ {
@ -1290,6 +1291,8 @@ static struct poptOption optionsTable[] = {
{ "build-id", 'i', POPT_ARG_NONE, &do_build_id, 0, { "build-id", 'i', POPT_ARG_NONE, &do_build_id, 0,
"recompute build ID note and print ID on stdout", NULL }, "recompute build ID note and print ID on stdout", NULL },
POPT_AUTOHELP POPT_AUTOHELP
{ "no-recompute-build-id", 'n', POPT_ARG_NONE, &no_recompute_build_id, 0,
"do not recompute build ID note even when -i or -s are given", NULL },
{ NULL, 0, 0, NULL, 0, NULL, NULL } { NULL, 0, 0, NULL, 0, NULL, NULL }
}; };
@ -1388,7 +1391,7 @@ handle_build_id (DSO *dso, Elf_Data *build_id,
dso->filename, build_id_size); dso->filename, build_id_size);
} }
if (!dirty_elf) if (no_recompute_build_id || !dirty_elf)
goto print; goto print;
if (elf_update (dso->elf, ELF_C_NULL) < 0) if (elf_update (dso->elf, ELF_C_NULL) < 0)
@ -1598,7 +1601,7 @@ main (int argc, char *argv[])
error (0, 0, "%s: Stabs debuginfo is not supported", file); error (0, 0, "%s: Stabs debuginfo is not supported", file);
break; break;
} }
if (strcmp (name, ".debug_info") == 0) if (!no_recompute_build_id && strcmp (name, ".debug_info") == 0)
edit_dwarf2 (dso); edit_dwarf2 (dso);
break; break;