]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf -l: Don't print section mapping when no sections.
authorRoland McGrath <roland@redhat.com>
Fri, 23 Jan 2009 03:55:00 +0000 (19:55 -0800)
committerRoland McGrath <roland@redhat.com>
Fri, 23 Jan 2009 03:55:00 +0000 (19:55 -0800)
src/ChangeLog
src/readelf.c

index 4bd36618b578c1a344a155c0128c7f5c48582dcc..da35a66876c7760f6f5e3ac2273195795e6aec52 100644 (file)
@@ -1,5 +1,7 @@
 2009-01-22  Roland McGrath  <roland@redhat.com>
 
+       * readelf.c (print_phdr): Don't print section mapping when no sections.
+
        * Makefile.am (AM_CFLAGS): Pass -Wno-format for *_no_Wformat.
 
        * readelf.c (print_debug_frame_section): Initialize IS_SIGNED to false
index fc2abfc3dbb652dc7b32fe48295a67bd5e705e72..d5a3b8d4582c2a02e3ae6c8359be7d68d04a5d24 100644 (file)
@@ -976,6 +976,10 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr)
        }
     }
 
+  if (ehdr->e_shnum == 0)
+    /* No sections in the file.  Punt.  */
+    return;
+
   /* Get the section header string table index.  */
   size_t shstrndx;
   if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))