dcavalca / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone

Blame SOURCES/0002-Support-build-id-generation-from-compressed-ELF-file.patch

f6faf3
From d48981ad7e36abb3500161d823acf92345c94f5d Mon Sep 17 00:00:00 2001
f6faf3
Message-Id: <d48981ad7e36abb3500161d823acf92345c94f5d.1571917458.git.pmatilai@redhat.com>
f6faf3
In-Reply-To: <68d383c39cef8d58b80940b13dd132d3f41a03f0.1571917458.git.pmatilai@redhat.com>
f6faf3
References: <68d383c39cef8d58b80940b13dd132d3f41a03f0.1571917458.git.pmatilai@redhat.com>
f6faf3
From: Panu Matilainen <pmatilai@redhat.com>
f6faf3
Date: Tue, 2 Apr 2019 16:07:56 +0300
f6faf3
Subject: [PATCH 2/2] Support build-id generation from compressed ELF files
f6faf3
 (elfutils >= 0.175)
f6faf3
f6faf3
Use dwelf_elf_begin() for reading ELF files for build-id generation on
f6faf3
versions that have it to support compressed ELF files such as kernel
f6faf3
modules (RhBug:1650072,1650074). Note that debugedit still cannot handle
f6faf3
compressed files, this is only for build-id generation.
f6faf3
---
f6faf3
 build/files.c | 4 ++++
f6faf3
 configure.ac  | 4 ++++
f6faf3
 2 files changed, 8 insertions(+)
f6faf3
f6faf3
diff --git a/build/files.c b/build/files.c
f6faf3
index 3822be3d3..f72a7c866 100644
f6faf3
--- a/build/files.c
f6faf3
+++ b/build/files.c
f6faf3
@@ -1828,7 +1828,11 @@ static int generateBuildIDs(FileList fl, ARGV_t *files)
f6faf3
 		   kernel modules (ET_REL files with .modinfo section)
f6faf3
 		   should have build-ids. */
f6faf3
 		GElf_Ehdr ehdr;
f6faf3
+#if HAVE_DWELF_ELF_BEGIN
f6faf3
+		Elf *elf = dwelf_elf_begin(fd);
f6faf3
+#else
f6faf3
 		Elf *elf = elf_begin (fd, ELF_C_READ, NULL);
f6faf3
+#endif
f6faf3
 		if (elf != NULL && elf_kind(elf) == ELF_K_ELF
f6faf3
 		    && gelf_getehdr(elf, &ehdr) != NULL
f6faf3
 		    && (ehdr.e_type == ET_EXEC || ehdr.e_type == ET_DYN
f6faf3
diff --git a/configure.ac b/configure.ac
f6faf3
index 99ce7df32..b2d7ed806 100644
f6faf3
--- a/configure.ac
f6faf3
+++ b/configure.ac
f6faf3
@@ -487,6 +487,10 @@ AS_IF([test "$WITH_LIBELF" = yes],[
f6faf3
       # If possible we also want the strtab functions from elfutils 0.167.
f6faf3
       # But we can fall back on the (unsupported) ebl alternatives if not.
f6faf3
       AC_CHECK_LIB(dw, dwelf_strtab_init, [HAVE_LIBDW_STRTAB=yes])
f6faf3
+      # whether libdw supports compressed ELF objects
f6faf3
+      AC_CHECK_LIB(dw, dwelf_elf_begin, [
f6faf3
+                   AC_DEFINE(HAVE_DWELF_ELF_BEGIN, 1, [Have dwelf_elf_begin?])
f6faf3
+      ])
f6faf3
     ])
f6faf3
   ])
f6faf3
 ])
f6faf3
-- 
f6faf3
2.21.0
f6faf3