Author: cem
Date: Wed Dec  7 18:33:40 2016
New Revision: 309679
URL: https://svnweb.freebsd.org/changeset/base/309679

Log:
  readelf(1) -S: Include zero index and match binutils' no-name
  
  Include the SHN_UNDEF (zero) index special section in extended-attribute
  ELF files, like GNU binutils' readelf.
  
  Additionally, print "<no-name>" for sections without names, like GNU
  binutils.
  
  Reviewed by:  kaiw@
  Sponsored by: Dell EMC Isilon
  Differential Revision:        https://reviews.freebsd.org/D8707

Modified:
  head/contrib/elftoolchain/readelf/readelf.c

Modified: head/contrib/elftoolchain/readelf/readelf.c
==============================================================================
--- head/contrib/elftoolchain/readelf/readelf.c Wed Dec  7 16:12:27 2016        
(r309678)
+++ head/contrib/elftoolchain/readelf/readelf.c Wed Dec  7 18:33:40 2016        
(r309679)
@@ -6557,13 +6557,14 @@ load_sections(struct readelf *re)
                }
                if ((name = elf_strptr(re->elf, shstrndx, sh.sh_name)) == NULL) 
{
                        (void) elf_errno();
-                       name = "ERROR";
+                       name = "<no-name>";
                }
                if ((ndx = elf_ndxscn(scn)) == SHN_UNDEF) {
-                       if ((elferr = elf_errno()) != 0)
+                       if ((elferr = elf_errno()) != 0) {
                                warnx("elf_ndxscn failed: %s",
                                    elf_errmsg(elferr));
-                       continue;
+                               continue;
+                       }
                }
                if (ndx >= re->shnum) {
                        warnx("section index of '%s' out of range", name);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to