[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
Fri Jul 5 02:23:31 PDT 2019


MaskRay added a comment.

In D59553#1571137 <https://reviews.llvm.org/D59553#1571137>, @jhenderson wrote:

> In D59553#1571050 <https://reviews.llvm.org/D59553#1571050>, @avl wrote:
>
> > In D59553#1570937 <https://reviews.llvm.org/D59553#1570937>, @MaskRay wrote:
> >
> > > > error: Invalid address range [0xfffffffffffffffe, 0x0000000000000004)
> > >
> > > DW_AT_low_pc DW_AT_high_pc pairs like these are less ideal. Before, tools have learned 0 address is special. They may or may not need a special case to handle this. Now, -2 is introduced (whatever value we choose here, GNU linkers still either relocate these to 0 or use their CB_PRETEND logic). They need to learn one more rule.  I still believe, teaching the symbolizers (addr2line, llvm-symbolizer D60470 <https://reviews.llvm.org/D60470>) is the way forward.
> >
> >
> > the point is in that tools should NOT learn one more rule. There should not be done any additional logic for UINT64_MAX-1 in tools. the fact that llvm-dwarfdump --verify displays error message is probably normal. Because debug info references not existed address range. llvm-dwarfdump --verify dislays errors for current solution also.  The proper way to fix llvm-dwarfdump --verify is to remove broken debug info.
>
>
> I agree. As things stand, some tools have special case behaviour for 0, but many do not, and consequently get it wrong. Furthermore, there are some cases where it is impossible to determine whether 0 is special or not. For example for PIE output, 0 can be a valid address (not all linker scripts place the headers in memory), meaning the tools can't distinguish between a function at address 0, or a dead piece of debug information.


I disagree. For PIE output, 0 (__ehdr_start) points to the ELF header. It cannot be a valid code address. Note, the discussion is really about code addresses (DW_AT_low_pc, DW_AT_ranges, DW_AT_entry_pc, etc), not an unconstrained relocated file offset.


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

https://reviews.llvm.org/D59553





More information about the llvm-commits mailing list