*** empty log message ***
[binutils-gdb.git] / gold / merge.cc
index 25ecc40c0e17c14b7ef6605a98ad6c3f7065912a..3d9692124a0cb3a90123b01ff51faa4e9107d8a9 100644 (file)
@@ -204,6 +204,12 @@ Object_merge_map::initialize_input_to_output_map(
   Input_merge_map* map = this->get_input_merge_map(shndx);
   gold_assert(map != NULL);
 
+  gold_assert(initialize_map->empty());
+  // We know how many entries we are going to add.
+  // reserve_unordered_map takes an expected count of buckets, not a
+  // count of elements, so double it to try to reduce collisions.
+  reserve_unordered_map(initialize_map, map->entries.size() * 2);
+
   for (Input_merge_map::Entries::const_iterator p = map->entries.begin();
        p != map->entries.end();
        ++p)