diff options
author | Rafael Ávila de Espíndola <rafael.espindola@gmail.com> | 2015-03-27 09:50:23 -0400 |
---|---|---|
committer | Rafael Ávila de Espíndola <rafael.espindola@gmail.com> | 2015-03-27 09:51:15 -0400 |
commit | 0916f9e741d6fd9dab4b0602bef034d01fa71650 (patch) | |
tree | e9211650540fe6ea80b55f581e26159d2776e30c /gold/object.cc | |
parent | ce9c0ca18fe50e1e5a87b135032e4aeba415e2ab (diff) | |
download | gdb-0916f9e741d6fd9dab4b0602bef034d01fa71650.zip gdb-0916f9e741d6fd9dab4b0602bef034d01fa71650.tar.gz gdb-0916f9e741d6fd9dab4b0602bef034d01fa71650.tar.bz2 |
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.
Diffstat (limited to 'gold/object.cc')
-rw-r--r-- | gold/object.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gold/object.cc b/gold/object.cc index cbe73ca..f28305b 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -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 |