From: Milian Wolff Date: Mon, 29 Oct 2018 15:21:26 +0000 (+0100) Subject: Also find CFI in sections of type SHT_X86_64_UNWIND X-Git-Tag: elfutils-0.175~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=825e48c4e942e3cbdab1b75c04b8c014867d66ab;p=thirdparty%2Felfutils.git Also find CFI in sections of type SHT_X86_64_UNWIND On my system with g++ (GCC) 8.2.1 20180831 with GNU gold (GNU Binutils 2.31.1) 1.16, the .eh_frame section does not have type PROGBITS but rather is using X86_64_UNWIND nowadays: ``` $ echo "int main(){ return 0; }" > test.c $ gcc test.c $ readelf --sections a.out | grep .eh_frame [14] .eh_frame X86_64_UNWIND 0000000000000670 00000670 [15] .eh_frame_hdr X86_64_UNWIND 0000000000000724 00000724 ``` Without this patch, libdw refuses to use the available unwind information, leading to broken backtraces while unwinding. With the patch applied, unwinding works once more in such situations. Signed-off-by: Milian Wolff Signed-off-by: Mark Wielaard Tested-by: Milian Wolff --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index ebe002cdc..627fddebe 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,7 @@ +2018-10-29 Milian Wolff + + * dwarf_getcfi_elf.c (getcfi_shdr): Check sh_type != SHT_NOBITS. + 2018-09-13 Mark Wielaard * dwarf_begin_elf.c (check_section): Drop ehdr argument, add and diff --git a/libdw/dwarf_getcfi_elf.c b/libdw/dwarf_getcfi_elf.c index 315cc02f6..adcaea03c 100644 --- a/libdw/dwarf_getcfi_elf.c +++ b/libdw/dwarf_getcfi_elf.c @@ -298,7 +298,7 @@ getcfi_shdr (Elf *elf, const GElf_Ehdr *ehdr) } else if (!strcmp (name, ".eh_frame")) { - if (shdr->sh_type == SHT_PROGBITS) + if (shdr->sh_type != SHT_NOBITS) return getcfi_scn_eh_frame (elf, ehdr, scn, shdr, hdr_scn, hdr_vaddr); else