[patch][gold] Remove empty Merge_map class

Rafael Espíndola rafael.espindola@gmail.com
Fri Feb 6 23:32:00 GMT 2015


When looking at the constant merging code to see if the
mapping could be reused for gc, the most confusing part for
me was the empty Merge_map class.

It is only used as a key to implement is_merge_section_for (which is
only used by find_starting_output_address).

Since it is just a key, we can use the Output_section_data as a key
instead. This patch does that. IMHO removing the indirection makes
things a bit easier to understand. It also removes the need for the
virtual do_is_merge_section_for.

Last but not least, it makes some inefficiencies easier to spot. For
example,  Output_merge_data::do_add_input_section handles only one
input section and therefore only one merge map, but it does

 object->add_merge_mapping(this, shndx, i, entsize, k);

in a loop. It could extract Input_merge_map* before the loop.

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: text/x-patch
Size: 24206 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150206/6dff63a8/attachment.bin>


More information about the Binutils mailing list