[PATCH] D60470: [DWARF] Prefer larger DW_AT_low_pc when constructing aranges
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 9 19:13:11 PDT 2019
MaskRay added a comment.
> What does addr2line (or any other symbolizers, not that I know of others) do in these cases?
addr2line doesn't use binary search. It iterates all ELF sections, finds the first section containing the address, then iterates DWARF CUs and finds the associated line table. That approach has more accurate results but is computationally expensive (linear search).
> How's this compare/contrast with the lld change that's being made to achieve similar results? (does this remove the need for the lld change?)
This patch drops one minor space optimization, and changes the arbitrary `*ValidCUs.begin()` (prefer smallest CUOffset) to `LiveCUs.rbegin()` (prefer largest LowPC). It thus fixes an issue similar to D54747 <https://reviews.llvm.org/D54747>. After this patch, for an address in a non-discarded CU, it will not be incorrectly attributed to the discarded CU if the discarded CU also contains that address.
The D54747 <https://reviews.llvm.org/D54747> lld change will resolve a relocation to a discarded `DW_AT_low_pc` to -2. It will make the `DW_AT_low_pc=0` scenario not happen for lld-linked executables/DSOs (note, ld.bfd and gold still use zero `DW_AT_low_pc`). It won't affect other overlapping CU scenarios. We still need a rule defensively and I think (largest LowPC) is probably better than (smallest CUOffset).
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60470/new/
https://reviews.llvm.org/D60470
More information about the llvm-commits
mailing list