This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [PATCH] Also find CFI in sections of type SHT_X86_64_UNWIND
Found another issue while testing with a gcc 8.1 and gold setup I
noticed some self-tests failed because elflint doesn't know about
SHT_X86_64_UNWIND section type and cannot match the PT_GNU_EH_FRAME
segment. The attached patch fixes it.
>From ad11949bbd22aadd8d0e950ff7defbad7cc271f2 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Sat, 10 Nov 2018 23:33:03 +0100
Subject: [PATCH] elflint: Allow PT_GNU_EH_FRAME segment to match
SHT_X86_64_UNWIND section.
The gold linker might generate an .eh_frame_hdr with a SHT_X86_64_UNWIND
type instead of a SHT_PROGBITS type.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
src/ChangeLog | 5 +++++
src/elflint.c | 6 ++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index f1a35798..fc6d414f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-10 Mark Wielaard <mark@klomp.org>
+
+ * elflint.c (check_program_header): Allow PT_GNU_EH_FRAME segment
+ to be matched against SHT_X86_64_UNWIND section.
+
2018-10-20 Mark Wielaard <mark@klomp.org>
* readelf.c (process_elf_file): Use dwelf_elf_begin to open pure_elf.
diff --git a/src/elflint.c b/src/elflint.c
index fa3af4c5..658f2ae2 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -4605,8 +4605,10 @@ program header offset in ELF header and PHDR entry do not match"));
any = true;
shdr = gelf_getshdr (scn, &shdr_mem);
if (shdr != NULL
- && shdr->sh_type == (is_debuginfo
- ? SHT_NOBITS : SHT_PROGBITS)
+ && ((is_debuginfo && shdr->sh_type == SHT_NOBITS)
+ || (! is_debuginfo
+ && (shdr->sh_type == SHT_PROGBITS
+ || shdr->sh_type == SHT_X86_64_UNWIND)))
&& elf_strptr (ebl->elf, shstrndx, shdr->sh_name) != NULL
&& ! strcmp (".eh_frame_hdr",
elf_strptr (ebl->elf, shstrndx, shdr->sh_name)))
--
2.19.1