diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2020-11-20 13:34:04 +0000 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2020-11-20 13:34:06 +0000 |
commit | 83d59285d549dab64d1be496408c0e62f30030b4 (patch) | |
tree | 161367211c8c409929664aea89e8f840183cecc0 /binutils | |
parent | ae41200ba807f4342ae7ea5334a29cd6f519b02c (diff) | |
download | fsf-binutils-gdb-83d59285d549dab64d1be496408c0e62f30030b4.zip fsf-binutils-gdb-83d59285d549dab64d1be496408c0e62f30030b4.tar.gz fsf-binutils-gdb-83d59285d549dab64d1be496408c0e62f30030b4.tar.bz2 |
objdump, readelf: Report errors from CTF archive iteration
We were failing to report errors from ctf_archive_iter, which results in
silent early termination if (for example) one CTF archive member in a
.ctf section is corrupted and cannot be opened. Report the error in the
usual fashion instead.
binutils/ChangeLog
2020-11-20 Nick Alcock <nick.alcock@oracle.com>
* objdump.c (dump_ctf): Report errors from ctf_archive_iter.
* readelf.c (dump_section_as_ctf): Likewise.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 5 | ||||
-rw-r--r-- | binutils/objdump.c | 7 | ||||
-rw-r--r-- | binutils/readelf.c | 8 |
3 files changed, 17 insertions, 3 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 8b7cba0..6555615 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,5 +1,10 @@ 2020-11-20 Nick Alcock <nick.alcock@oracle.com> + * objdump.c (dump_ctf): Report errors from ctf_archive_iter. + * readelf.c (dump_section_as_ctf): Likewise. + +2020-11-20 Nick Alcock <nick.alcock@oracle.com> + * objdump.c (dump_ctf): Use ctf_dict_open, not ctf_arc_open_by_name. * readelf.c (dump_section_as_ctf): Likewise. diff --git a/binutils/objdump.c b/binutils/objdump.c index bf82349..0d4092d 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -4203,7 +4203,12 @@ dump_ctf (bfd *abfd, const char *sect_name, const char *parent_name) printf (_("Contents of CTF section %s:\n"), sanitize_string (sect_name)); - ctf_archive_iter (ctfa, dump_ctf_archive_member, parent); + if ((err = ctf_archive_iter (ctfa, dump_ctf_archive_member, parent)) != 0) + { + dump_ctf_errs (NULL); + non_fatal (_("CTF archive member open failure: %s"), ctf_errmsg (err)); + bfd_fatal (bfd_get_filename (abfd)); + } ctf_dict_close (parent); ctf_close (ctfa); ctf_close (parenta); diff --git a/binutils/readelf.c b/binutils/readelf.c index a79f295..4d484db 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -14787,8 +14787,12 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata) printf (_("\nDump of CTF section '%s':\n"), printable_section_name (filedata, section)); - if (ctf_archive_iter (ctfa, dump_ctf_archive_member, parent) != 0) - ret = FALSE; + if ((err = ctf_archive_iter (ctfa, dump_ctf_archive_member, parent)) != 0) + { + dump_ctf_errs (NULL); + error (_("CTF member open failure: %s\n"), ctf_errmsg (err)); + ret = FALSE; + } fail: ctf_dict_close (parent); |