Changeset View
Changeset View
Standalone View
Standalone View
contrib/elftoolchain/readelf/readelf.c
Show First 20 Lines • Show All 6,551 Lines • ▼ Show 20 Lines | load_sections(struct readelf *re) | ||||
do { | do { | ||||
if (gelf_getshdr(scn, &sh) == NULL) { | if (gelf_getshdr(scn, &sh) == NULL) { | ||||
warnx("gelf_getshdr failed: %s", elf_errmsg(-1)); | warnx("gelf_getshdr failed: %s", elf_errmsg(-1)); | ||||
(void) elf_errno(); | (void) elf_errno(); | ||||
continue; | continue; | ||||
} | } | ||||
if ((name = elf_strptr(re->elf, shstrndx, sh.sh_name)) == NULL) { | if ((name = elf_strptr(re->elf, shstrndx, sh.sh_name)) == NULL) { | ||||
(void) elf_errno(); | (void) elf_errno(); | ||||
name = "ERROR"; | name = "<no-name>"; | ||||
cem: For parity with binutils. | |||||
} | } | ||||
if ((ndx = elf_ndxscn(scn)) == SHN_UNDEF) { | if ((ndx = elf_ndxscn(scn)) == SHN_UNDEF) { | ||||
if ((elferr = elf_errno()) != 0) | if ((elferr = elf_errno()) != 0) { | ||||
warnx("elf_ndxscn failed: %s", | warnx("elf_ndxscn failed: %s", | ||||
elf_errmsg(elferr)); | elf_errmsg(elferr)); | ||||
continue; | continue; | ||||
cemAuthorUnsubmitted Not Done Inline Actions(Only skip sections if there was actually an error — it's valid for ELF files to have a SHN_UNDEX index section.) cem: (Only skip sections if there was actually an error — it's valid for ELF files to have a… | |||||
} | |||||
} | } | ||||
if (ndx >= re->shnum) { | if (ndx >= re->shnum) { | ||||
warnx("section index of '%s' out of range", name); | warnx("section index of '%s' out of range", name); | ||||
continue; | continue; | ||||
} | } | ||||
if (sh.sh_link >= re->shnum) | if (sh.sh_link >= re->shnum) | ||||
warnx("section link %llu of '%s' out of range", | warnx("section link %llu of '%s' out of range", | ||||
(unsigned long long)sh.sh_link, name); | (unsigned long long)sh.sh_link, name); | ||||
▲ Show 20 Lines • Show All 726 Lines • Show Last 20 Lines |
For parity with binutils.