[PATCH] D59553: [LLD][ELF][DebugInfo] llvm-symbolizer shows incorrect source line info if --gc-sections used

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 12 23:44:38 PDT 2019


MaskRay added a comment.

> actually other DWARF consumers are not happy.

Example please.

> I checked behavior of addr2line and gdb -they are working correctly with this patch.

Can you check if gdb works without this patch?

> Could you confirm that solution suggested in D60470 <https://reviews.llvm.org/D60470> could not handle following situation correctly ?
> 
> Another piece of debug info references correct address range DW_AT_low_pc=0x0 DW_AT_high_pc=0x10000

D60470 <https://reviews.llvm.org/D60470> doesn't specialize case zero address, it changes priority. I suggest you actually take a look at that patch. The behavior of ld.bfd/gold will unlikely to change. D60470 <https://reviews.llvm.org/D60470> will also help them.

I want to see a concrete example where 0 is used as a valid DW_AT_low_pc.

I can change `vm.mmap_min_addr` to 0 on my Linux and mmap a fixed page at 0 freely, but that doesn't mean 0 can be a valid DW_AT_low_pc. The 0 page can be mapped but more likely used as file header, irq, etc but unlikely to be used as code.

> lld generated executable would have a problem. ld and gold generated would not.

You may check how the R and RW PT_LOAD segments are laid out in ld.bfd and gold linked modules.
You were also wrong with your understanding of image base (it was irrelevant in -shared/-pie) in your previous comments.
I just feel my explanation about how lld's layout largely mitigates the issue is kept being ignored.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59553/new/

https://reviews.llvm.org/D59553





More information about the llvm-commits mailing list