diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2019-04-02 16:07:56 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2020-03-26 11:57:58 +0200 |
commit | 506fcaf8f931afae5a3b9f2587e8c1ec30cce8b6 (patch) | |
tree | 795fbba49ad175dcf6148858a44d5e724953263f | |
parent | 1a60222fb9ac7341ad6d5019d97dd546e50df136 (diff) | |
download | rpm-506fcaf8f931afae5a3b9f2587e8c1ec30cce8b6.tar.gz |
Support build-id generation from compressed ELF files (elfutils >= 0.175)
Use dwelf_elf_begin() for reading ELF files for build-id generation on
versions that have it to support compressed ELF files such as kernel
modules (RhBug:1650072,1650074). Note that debugedit still cannot handle
compressed files, this is only for build-id generation.
(cherry picked from commit d48981ad7e36abb3500161d823acf92345c94f5d)
-rw-r--r-- | build/files.c | 4 | ||||
-rw-r--r-- | configure.ac | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/build/files.c b/build/files.c index 711dc38e7..14ba8d072 100644 --- a/build/files.c +++ b/build/files.c @@ -1826,7 +1826,11 @@ static int generateBuildIDs(FileList fl, ARGV_t *files) kernel modules (ET_REL files with .modinfo section) should have build-ids. */ GElf_Ehdr ehdr; +#if HAVE_DWELF_ELF_BEGIN + Elf *elf = dwelf_elf_begin(fd); +#else Elf *elf = elf_begin (fd, ELF_C_READ, NULL); +#endif if (elf != NULL && elf_kind(elf) == ELF_K_ELF && gelf_getehdr(elf, &ehdr) != NULL && (ehdr.e_type == ET_EXEC || ehdr.e_type == ET_DYN diff --git a/configure.ac b/configure.ac index 34ea85f9f..14fb33277 100644 --- a/configure.ac +++ b/configure.ac @@ -501,6 +501,10 @@ AS_IF([test "$WITH_LIBELF" = yes],[ # If possible we also want the strtab functions from elfutils 0.167. # But we can fall back on the (unsupported) ebl alternatives if not. AC_CHECK_LIB(dw, dwelf_strtab_init, [HAVE_LIBDW_STRTAB=yes]) + # whether libdw supports compressed ELF objects + AC_CHECK_LIB(dw, dwelf_elf_begin, [ + AC_DEFINE(HAVE_DWELF_ELF_BEGIN, 1, [Have dwelf_elf_begin?]) + ]) ]) ]) ]) |