this->input_file_, memoff, ehdr_buf,
read_size);
- input_objects->add_object(obj);
+ if (input_objects->add_object(obj))
+ {
+ Read_symbols_data sd;
+ obj->read_symbols(&sd);
+ obj->layout(symtab, layout, &sd);
+ obj->add_symbols(symtab, &sd);
+ }
+ else
+ {
+ // FIXME: We need to close the descriptor here.
+ delete obj;
+ }
- Read_symbols_data sd;
- obj->read_symbols(&sd);
- obj->layout(symtab, layout, &sd);
- obj->add_symbols(symtab, &sd);
}
// Add_archive_symbols methods.
bool
Input_objects::add_object(Object* obj)
{
+ Target* target = obj->target();
+ if (this->target_ == NULL)
+ this->target_ = target;
+ else if (this->target_ != target)
+ {
+ gold_error(_("%s: incompatible target"), obj->name().c_str());
+ return false;
+ }
+
if (!obj->is_dynamic())
this->relobj_list_.push_back(static_cast<Relobj*>(obj));
else
this->dynobj_list_.push_back(dynobj);
}
- Target* target = obj->target();
- if (this->target_ == NULL)
- this->target_ = target;
- else if (this->target_ != target)
- {
- gold_error(_("%s: incompatible target"), obj->name().c_str());
- return false;
- }
-
set_parameters_size_and_endianness(target->get_size(),
target->is_big_endian());