[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
Wed Apr 10 19:17:57 PDT 2019
MaskRay added a comment.
> Any idea why this problem hasn't been much of an issue until now/recently (both your change here, and the LLD change being reviewed)?
These `.debug_info` sections associated with garbage collected sections have low_pc/high_pc pairs in this form: `[0, high_pc)` (their `DW_AT_low_pc` relocations resolve to zero).
ld.bfd sets default image base to 0x400000 for x86_64, thus the first good CU will have `DW_AT_low_pc` slightly larger than 0x400000. That bad CU needs to have `DW_AT_high_pc` larger than 0x400000 (4MiB) to overlap with a good CU. I think it is not common to have a >4MiB text section with `-ffunction-sections -fdata-sections -Wl,--gc-sections`.
lld has a different section layout. Its default image base is 0x200000 (2MiB) but it places potentially large sections `.dynsym` `.rodata` `.eh_frame` before `.text`. If the application is complex enough to have >2MiB `.text.*`, I'm fairly confident it should have sufficient large `.rodata` to move `.text` far away from the bad CU.
[12] .rodata PROGBITS 000000000020b950 00b950 006118 00 AMS 0 0 16
...
[15] .eh_frame PROGBITS 0000000000222330 022330 01a494 00 A 0 0 8
[16] .text PROGBITS 000000000023d000 03d000 0f6339 00 AX 0 0 16
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