libdwfl: Skip relocation on empty or SHT_NOBITS sections.
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index c210bca..2cac0de 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,7 @@
+2009-11-16  Roland McGrath  <roland@redhat.com>
+
+	* relocate.c (relocate_section): Skip SHT_NOBITS or empty target scn.
+
 2009-11-12  Petr Machata  <pmachata@redhat.com>
 
 	* core-file.c (dwfl_elf_phdr_memory_callback): Only load ahead if
diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c
index a31fe15..2e37c64 100644
--- a/libdwfl/relocate.c
+++ b/libdwfl/relocate.c
@@ -302,6 +302,10 @@
   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.  */