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
This commit is contained in:
Mark Johnston 2020-07-20 18:22:38 +00:00
parent e1a82b35bf
commit f690eff983
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363375

View file

@ -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)) ==