This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] gold: Provide more failed archive member info in error message


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9da0a9988db7c9db92edaa3dc98f2a0648782b71

commit 9da0a9988db7c9db92edaa3dc98f2a0648782b71
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Dec 6 12:28:46 2018 -0800

    gold: Provide more failed archive member info in error message
    
    When gold fails to get an archive member, its error message doesn't
    have information for
    
    1. The failed archive member name.
    2. The cause of failure: non-ELF object vs non-IR object.
    
    This patch adds the failed archive member name and non-ELF/non-IR info
    to gold error message.
    
    	* archive.cc (Archive::get_elf_object_for_member): Also print
    	archive member and non-ELF/non-IR info on error.

Diff:
---
 gold/ChangeLog  |  5 +++++
 gold/archive.cc | 13 +++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/gold/ChangeLog b/gold/ChangeLog
index 2379536..5c5bca2 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,8 @@
+2018-12-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* archive.cc (Archive::get_elf_object_for_member): Also print
+	archive member and non-ELF/non-IR info on error.
+
 2018-12-05  Alan Modra  <amodra@gmail.com>
 
 	* symtab.h (Symbol::Symbol): Avoid -Wclass-memaccess warning.
diff --git a/gold/archive.cc b/gold/archive.cc
index 4df9e74..fe2a507 100644
--- a/gold/archive.cc
+++ b/gold/archive.cc
@@ -690,6 +690,7 @@ Archive::get_elf_object_for_member(off_t off, bool* punconfigured)
   int read_size;
   Object *obj = NULL;
   bool is_elf_obj = false;
+  bool unclaimed = false;
 
   if (is_elf_object(input_file, memoff, &ehdr, &read_size))
     {
@@ -716,12 +717,20 @@ Archive::get_elf_object_for_member(off_t off, bool* punconfigured)
 	    delete obj;
           return plugin_obj;
         }
+
+      unclaimed = true;
     }
 
   if (!is_elf_obj)
     {
-      gold_error(_("%s: member at %zu is not an ELF object"),
-		 this->name().c_str(), static_cast<size_t>(off));
+      if (unclaimed)
+	gold_error(_("%s: plugin failed to claim member %s at %zu"),
+		   this->name().c_str(), member_name.c_str(),
+		   static_cast<size_t>(off));
+      else
+	gold_error(_("%s: member %s at %zu is not an ELF object"),
+		   this->name().c_str(), member_name.c_str(),
+		   static_cast<size_t>(off));
       return NULL;
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]