[PATCH 03/12] objdump, readelf: Report errors from CTF archive iteration
Alan Modra
amodra@gmail.com
Tue Nov 17 22:28:54 GMT 2020
On Sun, Oct 25, 2020 at 02:14:04PM +0000, Nick Alcock via Binutils wrote:
> 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-10-23 Nick Alcock <nick.alcock@oracle.com>
>
> * objdump.c (dump_ctf): Report errors from ctf_archive_iter.
> * readelf.c (dump_section_as_ctf): Likewise.
OK, with one minor fix.
> --- 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);
> + fatal (_("CTF archive member open failure: %s"), ctf_errmsg (err));
> + bfd_fatal (bfd_get_filename (abfd));
fatal calls xexit, which makes bfd_fatal here dead code.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list