From: Roland McGrath Date: Tue, 17 Nov 2009 04:38:17 +0000 (-0800) Subject: libdwfl: Skip relocation on empty or SHT_NOBITS sections. X-Git-Tag: elfutils-0.144~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15426bd14883fe3227bd1ffc3b60d57273a3bb17;p=thirdparty%2Felfutils.git libdwfl: Skip relocation on empty or SHT_NOBITS sections. --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index c210bcae2..2cac0deec 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,7 @@ +2009-11-16 Roland McGrath + + * relocate.c (relocate_section): Skip SHT_NOBITS or empty target scn. + 2009-11-12 Petr Machata * core-file.c (dwfl_elf_phdr_memory_callback): Only load ahead if diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c index a31fe152a..2e37c6413 100644 --- a/libdwfl/relocate.c +++ b/libdwfl/relocate.c @@ -302,6 +302,10 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr, if (tname == NULL) return DWFL_E_LIBELF; + if (unlikely (tshdr->sh_type == SHT_NOBITS) || unlikely (tshdr->sh_size == 0)) + /* No contents to relocate. */ + return DWFL_E_NOERROR; + if (debugscn && ! ebl_debugscn_p (mod->ebl, tname)) /* This relocation section is not for a debugging section. Nothing to do here. */