aboutsummaryrefslogtreecommitdiff
path: root/gold/archive.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2010-12-07 15:47:47 +0000
committerIan Lance Taylor <ian@airs.com>2010-12-07 15:47:47 +0000
commitc20cbc067b6fa714b4dc3e6d4025d5b11d605c80 (patch)
tree56209c4157142e4fa2aa54984629c6cb43ab7852 /gold/archive.cc
parentee6352bb1936b0a2319c6ba6d801082ebb67cda6 (diff)
downloadgdb-c20cbc067b6fa714b4dc3e6d4025d5b11d605c80.zip
gdb-c20cbc067b6fa714b4dc3e6d4025d5b11d605c80.tar.gz
gdb-c20cbc067b6fa714b4dc3e6d4025d5b11d605c80.tar.bz2
* archive.cc (Archive::get_elf_object_for_member): Permit
punconfigured to be NULL. (Archive::read_symbols): Pass NULL to get_elf_object_for_member. (Archive::include_member): Pass NULL to get_elf_object_for_member if we searched for the archive and this is the first included object.
Diffstat (limited to 'gold/archive.cc')
-rw-r--r--gold/archive.cc37
1 files changed, 21 insertions, 16 deletions
diff --git a/gold/archive.cc b/gold/archive.cc
index a289e5e..16153b4 100644
--- a/gold/archive.cc
+++ b/gold/archive.cc
@@ -527,14 +527,16 @@ Archive::get_file_and_offset(off_t off, Input_file** input_file, off_t* memoff,
return true;
}
-// Return an ELF object for the member at offset OFF. If the ELF
-// object has an unsupported target type, set *PUNCONFIGURED to true
-// and return NULL.
+// Return an ELF object for the member at offset OFF. If
+// PUNCONFIGURED is not NULL, then if the ELF object has an
+// unsupported target type, set *PUNCONFIGURED to true and return
+// NULL.
Object*
Archive::get_elf_object_for_member(off_t off, bool* punconfigured)
{
- *punconfigured = false;
+ if (punconfigured != NULL)
+ *punconfigured = false;
Input_file* input_file;
off_t memoff;
@@ -593,9 +595,7 @@ Archive::read_all_symbols()
void
Archive::read_symbols(off_t off)
{
- bool dummy;
- Object* obj = this->get_elf_object_for_member(off, &dummy);
-
+ Object* obj = this->get_elf_object_for_member(off, NULL);
if (obj == NULL)
return;
@@ -863,17 +863,22 @@ Archive::include_member(Symbol_table* symtab, Layout* layout,
return true;
}
- bool unconfigured;
- Object* obj = this->get_elf_object_for_member(off, &unconfigured);
-
- if (!this->included_member_
- && this->searched_for()
- && obj == NULL
- && unconfigured)
- return false;
+ // If this is the first object we are including from this archive,
+ // and we searched for this archive, most likely because it was
+ // found via a -l option, then if the target is incompatible we want
+ // to move on to the next archive found in the search path.
+ bool unconfigured = false;
+ bool* punconfigured = NULL;
+ if (!this->included_member_ && this->searched_for())
+ punconfigured = &unconfigured;
+ Object* obj = this->get_elf_object_for_member(off, punconfigured);
if (obj == NULL)
- return true;
+ {
+ // Return false to search for another archive, true if we found
+ // an error.
+ return unconfigured ? false : true;
+ }
if (mapfile != NULL)
mapfile->report_include_archive_member(obj->name(), sym, why);