From patchwork Tue Sep 14 09:48:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [LTO] Improve ELF diagnostics Date: Mon, 13 Sep 2010 23:48:34 -0000 From: Gerald Pfeifer X-Patchwork-Id: 64686 Message-Id: To: gcc-patches@gcc.gnu.org I coughed up the patch below while debugging an LTO failure. "Sadly" this magically disappeared but I figured the patch may be generally useful. Disclaimer: a bit above that code we have the following which, however, did not trigger in this case: elf_file->fd = open (fname, writable ? O_WRONLY|O_CREAT|O_BINARY : O_RDONLY|O_BINARY, 0666); if (elf_file->fd == -1) { error ("could not open file %s", fname); goto fail; } Bootstrapped and regression tested on i386-unknown-freebsd8.1. Okay? Gerald 2010-09-14 Gerald Pfeifer * lto-elf.c (lto_obj_file_open): Also provide filename when elf_begin fails. Index: lto/lto-elf.c =================================================================== --- lto/lto-elf.c (revision 164225) +++ lto/lto-elf.c (working copy) @@ -698,7 +698,7 @@ NULL); if (!elf_file->elf) { - error ("could not open ELF file: %s", elf_errmsg (0)); + error ("could not open %s as an ELF file: %s", fname, elf_errmsg (0)); goto fail; }