From 0ba7476d36100c015c35c744e871c4e64d52154a Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 15 Sep 2020 15:43:10 +0200 Subject: [PATCH] debuginfod-find: Support compressed (kernel) ELF images. By using dwelf_elf_begin instead of elf_begin we automatically get support for determining the build-id of compressed (kernel) images. https://sourceware.org/bugzilla/show_bug.cgi?id=26599 Signed-off-by: Mark Wielaard --- debuginfod/ChangeLog | 4 ++++ debuginfod/debuginfod-find.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index db8a76a76..41897a3aa 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,7 @@ +2020-09-15 Mark Wielaard + + * debuginfod-find.c (main): Use dwelf_elf_begin. + 2020-07-03 Alice Zhang * debuginfod-client.c (debuginfod_query_server): Use strncasecmp diff --git a/debuginfod/debuginfod-find.c b/debuginfod/debuginfod-find.c index 83a43ce4b..214256da3 100644 --- a/debuginfod/debuginfod-find.c +++ b/debuginfod/debuginfod-find.c @@ -138,9 +138,10 @@ main(int argc, char** argv) } if (fd >= 0) { - elf = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, NULL); + elf = dwelf_elf_begin (fd); if (elf == NULL) - fprintf (stderr, "Cannot elf_begin %s: %s\n", build_id, elf_errmsg(-1)); + fprintf (stderr, "Cannot open as ELF file %s: %s\n", build_id, + elf_errmsg (-1)); } if (elf != NULL) { -- 2.47.2