From patchwork Tue Sep 14 09:48:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerald Pfeifer X-Patchwork-Id: 64686 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 21E14B6F11 for ; Tue, 14 Sep 2010 19:48:44 +1000 (EST) Received: (qmail 19268 invoked by alias); 14 Sep 2010 09:48:42 -0000 Received: (qmail 19255 invoked by uid 22791); 14 Sep 2010 09:48:41 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from vexpert.dbai.tuwien.ac.at (HELO vexpert.dbai.tuwien.ac.at) (128.131.111.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Sep 2010 09:48:36 +0000 Received: from acrux.dbai.tuwien.ac.at (acrux.dbai.tuwien.ac.at [128.131.111.60]) by vexpert.dbai.tuwien.ac.at (Postfix) with ESMTP id A2B5D1E07E for ; Tue, 14 Sep 2010 11:48:33 +0200 (CEST) Date: Tue, 14 Sep 2010 11:48:34 +0200 (CEST) From: Gerald Pfeifer To: gcc-patches@gcc.gnu.org Subject: [PATCH, LTO] Improve ELF diagnostics Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list 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; }