* 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.
This commit is contained in:
Ian Lance Taylor 2010-12-07 15:47:47 +00:00
parent ee6352bb19
commit c20cbc067b
2 changed files with 30 additions and 16 deletions

View File

@ -1,3 +1,12 @@
2010-12-07 Ian Lance Taylor <iant@google.com>
* 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.
2010-12-01 Ian Lance Taylor <iant@google.com> 2010-12-01 Ian Lance Taylor <iant@google.com>
* dwarf_reader.h (class Sized_dwarf_line_info): Add * dwarf_reader.h (class Sized_dwarf_line_info): Add

View File

@ -527,13 +527,15 @@ Archive::get_file_and_offset(off_t off, Input_file** input_file, off_t* memoff,
return true; return true;
} }
// Return an ELF object for the member at offset OFF. If the ELF // Return an ELF object for the member at offset OFF. If
// object has an unsupported target type, set *PUNCONFIGURED to true // PUNCONFIGURED is not NULL, then if the ELF object has an
// and return NULL. // unsupported target type, set *PUNCONFIGURED to true and return
// NULL.
Object* Object*
Archive::get_elf_object_for_member(off_t off, bool* punconfigured) Archive::get_elf_object_for_member(off_t off, bool* punconfigured)
{ {
if (punconfigured != NULL)
*punconfigured = false; *punconfigured = false;
Input_file* input_file; Input_file* input_file;
@ -593,9 +595,7 @@ Archive::read_all_symbols()
void void
Archive::read_symbols(off_t off) Archive::read_symbols(off_t off)
{ {
bool dummy; Object* obj = this->get_elf_object_for_member(off, NULL);
Object* obj = this->get_elf_object_for_member(off, &dummy);
if (obj == NULL) if (obj == NULL)
return; return;
@ -863,17 +863,22 @@ Archive::include_member(Symbol_table* symtab, Layout* layout,
return true; return true;
} }
bool unconfigured; // If this is the first object we are including from this archive,
Object* obj = this->get_elf_object_for_member(off, &unconfigured); // and we searched for this archive, most likely because it was
// found via a -l option, then if the target is incompatible we want
if (!this->included_member_ // to move on to the next archive found in the search path.
&& this->searched_for() bool unconfigured = false;
&& obj == NULL bool* punconfigured = NULL;
&& unconfigured) if (!this->included_member_ && this->searched_for())
return false; punconfigured = &unconfigured;
Object* obj = this->get_elf_object_for_member(off, punconfigured);
if (obj == NULL) 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) if (mapfile != NULL)
mapfile->report_include_archive_member(obj->name(), sym, why); mapfile->report_include_archive_member(obj->name(), sym, why);