coffread.c is the last spot (that I know of) that incorrectly calls
perror_with_name when a BFD function fails. The issue here is that
perror_with_name examines errno, but BFD failures do not set this.
This patch changes this to use error and bfd_errmsg.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31041
Approved-By: Simon Marchi <simon.marchi@efficios.com>
/* Position to read the symbol table. */
val = bfd_seek (objfile->obfd.get (), symtab_offset, 0);
if (val < 0)
- perror_with_name (objfile_name (objfile));
+ error (_("Error reading symbols from %s: %s"),
+ objfile_name (objfile), bfd_errmsg (bfd_get_error ()));
coffread_objfile = objfile;
nlist_bfd_global = objfile->obfd.get ();