Avoid looking up Input_merge_map multiple times.

Avoid looking up Input_merge_map multiple times when we know were are
processing items from the same input section.
This commit is contained in:
Rafael Ávila de Espíndola
2015-03-27 09:50:23 -04:00
parent ce9c0ca18f
commit 0916f9e741
5 changed files with 67 additions and 29 deletions

View File

@@ -285,13 +285,8 @@ Relobj::add_merge_mapping(Output_section_data *output_data,
unsigned int shndx, section_offset_type offset,
section_size_type length,
section_offset_type output_offset) {
if (this->object_merge_map_ == NULL)
{
this->object_merge_map_ = new Object_merge_map();
}
this->object_merge_map_->add_mapping(output_data, shndx, offset, length,
output_offset);
Object_merge_map* object_merge_map = this->get_or_create_merge_map();
object_merge_map->add_mapping(output_data, shndx, offset, length, output_offset);
}
bool
@@ -411,6 +406,14 @@ Relobj::finalize_incremental_relocs(Layout* layout, bool clear_counts)
layout->incremental_inputs()->set_reloc_count(rindex);
}
Object_merge_map*
Relobj::get_or_create_merge_map()
{
if (!this->object_merge_map_)
this->object_merge_map_ = new Object_merge_map();
return this->object_merge_map_;
}
// Class Sized_relobj.
// Iterate over local symbols, calling a visitor class V for each GOT offset