From: Roland McGrath Date: Fri, 23 Jan 2009 03:55:00 +0000 (-0800) Subject: readelf -l: Don't print section mapping when no sections. X-Git-Tag: elfutils-0.139~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9a847e148b6aa52aae172b9bbf354ae89df8e0d3;p=thirdparty%2Felfutils.git readelf -l: Don't print section mapping when no sections. --- diff --git a/src/ChangeLog b/src/ChangeLog index 4bd36618b..da35a6687 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2009-01-22 Roland McGrath + * 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 diff --git a/src/readelf.c b/src/readelf.c index fc2abfc3d..d5a3b8d45 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -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))