aboutsummaryrefslogtreecommitdiff
path: root/gold/merge.h
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <rafael.espindola@gmail.com>2015-03-27 09:50:23 -0400
committerRafael Ávila de Espíndola <rafael.espindola@gmail.com>2015-03-27 09:51:15 -0400
commit0916f9e741d6fd9dab4b0602bef034d01fa71650 (patch)
treee9211650540fe6ea80b55f581e26159d2776e30c /gold/merge.h
parentce9c0ca18fe50e1e5a87b135032e4aeba415e2ab (diff)
downloadgdb-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/merge.h')
-rw-r--r--gold/merge.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/gold/merge.h b/gold/merge.h
index 62efa13..54caed8 100644
--- a/gold/merge.h
+++ b/gold/merge.h
@@ -85,7 +85,6 @@ class Object_merge_map
Unordered_map<section_offset_type,
typename elfcpp::Elf_types<size>::Elf_Addr>*);
- private:
// Map input section offsets to a length and an output section
// offset. An output section offset of -1 means that this part of
// the input section is being discarded.
@@ -99,17 +98,12 @@ class Object_merge_map
section_offset_type output_offset;
};
- // A less-than comparison routine for Input_merge_entry.
- struct Input_merge_compare
- {
- bool
- operator()(const Input_merge_entry& i1, const Input_merge_entry& i2) const
- { return i1.input_offset < i2.input_offset; }
- };
-
// A list of entries for a particular input section.
struct Input_merge_map
{
+ void add_mapping(section_offset_type input_offset, section_size_type length,
+ section_offset_type output_offset);
+
typedef std::vector<Input_merge_entry> Entries;
// We store these with the Relobj, and we look them up by input
@@ -142,6 +136,21 @@ class Object_merge_map
{ }
};
+ // Get or make the Input_merge_map to use for the section SHNDX
+ // with MERGE_MAP.
+ Input_merge_map*
+ get_or_make_input_merge_map(const Output_section_data* merge_map,
+ unsigned int shndx);
+
+ private:
+ // A less-than comparison routine for Input_merge_entry.
+ struct Input_merge_compare
+ {
+ bool
+ operator()(const Input_merge_entry& i1, const Input_merge_entry& i2) const
+ { return i1.input_offset < i2.input_offset; }
+ };
+
// Map input section indices to merge maps.
typedef std::map<unsigned int, Input_merge_map*> Section_merge_maps;
@@ -156,12 +165,6 @@ class Object_merge_map
this)->get_input_merge_map(shndx));
}
- // Get or make the Input_merge_map to use for the section SHNDX
- // with MERGE_MAP.
- Input_merge_map*
- get_or_make_input_merge_map(const Output_section_data* merge_map,
- unsigned int shndx);
-
// Any given object file will normally only have a couple of input
// sections with mergeable contents. So we keep the first two input
// section numbers inline, and push any further ones into a map. A