[patch][gold] Remove empty Merge_map class

Rafael Espíndola rafael.espindola@gmail.com
Mon Feb 9 16:30:00 GMT 2015


Turns out we can remove the key completely by using
find_merge_section in is_merge_section_for.

The attached patch does it.


On 6 February 2015 at 18:32, Rafael Espíndola
<rafael.espindola@gmail.com> wrote:
> 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: 25279 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150209/0f61c37b/attachment.bin>


More information about the Binutils mailing list