svn commit: r363375 - head/contrib/elftoolchain/libdwarf

Mark Johnston markj at FreeBSD.org
Mon Jul 20 18:22:39 UTC 2020


Author: markj
Date: Mon Jul 20 18:22:38 2020
New Revision: 363375
URL: https://svnweb.freebsd.org/changeset/base/363375

Log:
  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 at pacopascal.com>
  Reviewed by:	emaste (previous version)
  Event:		July 2020 Bugathon
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D25626

Modified:
  head/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c

Modified: head/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c
==============================================================================
--- head/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c	Mon Jul 20 17:44:13 2020	(r363374)
+++ head/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c	Mon Jul 20 18:22:38 2020	(r363375)
@@ -260,6 +260,9 @@ _dwarf_elf_init(Dwarf_Debug dbg, Elf *elf, Dwarf_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);
@@ -312,6 +315,9 @@ _dwarf_elf_init(Dwarf_Debug dbg, Elf *elf, Dwarf_Error
 			ret = DW_DLE_ELF;
 			goto fail_cleanup;
 		}
+
+		if (sh.sh_type == SHT_NOBITS)
+			continue;
 
 		memcpy(&e->eo_shdr[j], &sh, sizeof(sh));
 


More information about the svn-src-head mailing list