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

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 5 02:03:14 PDT 2019


jhenderson added a comment.

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. The logic for -2 is simpler, because it is almost never the case that something will appear in memory at that location, so any logic required is much simpler. In those cases where there already is special handling, it is not much harder for -2 to be added as special and will work FAR more often than 0 will, whilst it keeps logic in tools that don't have 0 special-case handling simpler.



================
Comment at: lld/test/ELF/gc-sections-debuginfo.s:41
+# CHECK-NEXT: )
+
----------------
Nit: looks like there's a double blank line at EOF here?


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

https://reviews.llvm.org/D59553





More information about the llvm-commits mailing list