summaryrefslogtreecommitdiffstats
path: root/contrib/elftoolchain
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2017-05-03 02:19:45 +0000
committeremaste <emaste@FreeBSD.org>2017-05-03 02:19:45 +0000
commit4d40019791ca3c1c38a469e82d1c36d6e74ac917 (patch)
treec7b6c54340c87875c6ed012fd79c172640031e5a /contrib/elftoolchain
parent70611214bf60c5c9a76f77f04700165ae98f9ee1 (diff)
downloadFreeBSD-src-4d40019791ca3c1c38a469e82d1c36d6e74ac917.zip
FreeBSD-src-4d40019791ca3c1c38a469e82d1c36d6e74ac917.tar.gz
MFC r309679 (cem): readelf -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.
Diffstat (limited to 'contrib/elftoolchain')
-rw-r--r--contrib/elftoolchain/readelf/readelf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c
index 5491e9e..3562c6a 100644
--- a/contrib/elftoolchain/readelf/readelf.c
+++ b/contrib/elftoolchain/readelf/readelf.c
@@ -6643,13 +6643,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);
OpenPOWER on IntegriCloud