aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2020-07-20 18:22:38 +0000
committerMark Johnston <markj@FreeBSD.org>2020-07-20 18:22:38 +0000
commitf690eff983f926f3f2660f6c205cfdd8cc9bdaf2 (patch)
tree179a16006aec79caa3e540307e49b96af5bd85c9
parente1a82b35bf70d9d72f54f0549e6b57e34167931e (diff)
downloadsrc-f690eff983f926f3f2660f6c205cfdd8cc9bdaf2.tar.gz
src-f690eff983f926f3f2660f6c205cfdd8cc9bdaf2.zip
libdwarf: Hide SHT_NOBITS sections.
gnu_debuglink external debug files will contain an .eh_frame section of type SHT_NOBITS. libdwarf does not handle such sections (or rather, it expects all debug sections to not have type SHT_NOBITS). Avoid loading SHT_NOBITS sections, to be consistent with SGI libdwarf's handling of this case. PR: 239516 Diagnosed by: Paco Pascal <me@pacopascal.com> Reviewed by: emaste (previous version) Event: July 2020 Bugathon MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25626
Notes
Notes: svn path=/head/; revision=363375
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_elf_init.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c b/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c
index bd68afc09373..e304ef164157 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c
@@ -260,6 +260,9 @@ _dwarf_elf_init(Dwarf_Debug dbg, Elf *elf, Dwarf_Error *error)
goto fail_cleanup;
}
+ if (sh.sh_type == SHT_NOBITS)
+ continue;
+
if ((name = elf_strptr(elf, e->eo_strndx, sh.sh_name)) ==
NULL) {
DWARF_SET_ELF_ERROR(dbg, error);
@@ -313,6 +316,9 @@ _dwarf_elf_init(Dwarf_Debug dbg, Elf *elf, Dwarf_Error *error)
goto fail_cleanup;
}
+ if (sh.sh_type == SHT_NOBITS)
+ continue;
+
memcpy(&e->eo_shdr[j], &sh, sizeof(sh));
if ((name = elf_strptr(elf, e->eo_strndx, sh.sh_name)) ==