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

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 20 03:02:22 PDT 2019


jhenderson added a comment.

Some time ago, I posted a query on the lldb-dev mailing list to discuss debugger behaviour for removed functions. It turned out that LLDB couldn't handle this either, due to the patching to zero:

http://lists.llvm.org/pipermail/lldb-dev/2017-March/012081.html

Tools could ignore the 0 address produced by LLD (I believe this is what some tools do, like gdb), but that doesn't work on platforms where 0 is a valid virtual address.

The most correct solutions would clearly be to rewrite the DWARF in the linker, or to fragment the DWARF into multiple sections, stored in groups (not necessarily COMDATs though, because function/data sections still need to have individual DWARF fragments associated with them) or linked by SHF_LINK_ORDER. Rewriting the DWARF seems a bit like the wrong thing to be doing in a linker (plus is probably not particularly fast), whilst fragmenting the DWARF isn't always possible with the current standard, and also results in significantly more section metadata to read in the linker, which also has the potential to impact performance.

Rather than picking an arbitrary value out of module scope, how about something more explicit, e.g. -1 (or -2)? It's very unlikely that this will ever be a valid address. Note that picking -1 has issues in .debug_ranges, due to it being a special value in that section, hence the -2 suggestion.


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

https://reviews.llvm.org/D59553





More information about the llvm-commits mailing list