This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, LTO] Improve ELF diagnostics
- From: Gerald Pfeifer <gerald at pfeifer dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 14 Sep 2010 11:48:34 +0200 (CEST)
- Subject: [PATCH, LTO] Improve ELF diagnostics
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 <gerald@pfeifer.com>
* 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;
}