When constructing debug aranges, if ranges overlap, we currently pick
the CU with the smallest CUOffset. This patch changes the rule to the
largest (LowPC, CUOffset).
--gc-sections and comdat may discard sections. The associated compile
units may be kept and have zero DW_AT_low_pc. If the DW_AT_high_pc is
sufficiently large, it may overlap with a good one.
llvm-symbolizer may resolve an address in the good CU to the discarded
CU. By giving priority to the largest (LowPC, CUOffset), the good one
will win. Some incorrect resolution will be fixed.
This patch also drops the Aranges.back().setHighPC(E.Address);
optimization because that is not very useful. N CUs can have at most
In practice, overlapping only happens with such [0,high_pc) sections.
This optimization saves no more than M ranges where M is the number of
garbage collected CUs that overlap with a good CU.