[PATCH] D91803: Use -1 as tombstone value for discarded code ranges

Eric Leese via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 09:28:12 PST 2020


Eric created this revision.
Eric added reviewers: MaskRay, labath, yurydelendik, dblaikie.
Herald added subscribers: llvm-commits, sbc100.
Herald added a project: LLVM.
Eric requested review of this revision.
Herald added a subscriber: aheejin.

Under existing behavior discarded functions are relocated to have the start pc 0. This causes problems when debugging as they typically overlap the first function and lldb symbol resolution frequently chooses a discarded function instead of the correct one. Using the value -1 is sufficient to prevent lldb from resolving to these symbols.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91803

Files:
  lld/wasm/InputFiles.cpp


Index: lld/wasm/InputFiles.cpp
===================================================================
--- lld/wasm/InputFiles.cpp
+++ lld/wasm/InputFiles.cpp
@@ -188,11 +188,11 @@
     sym = symbols[reloc.Index];
 
     // We can end up with relocations against non-live symbols.  For example
-    // in debug sections. We return reloc.Addend because always returning zero
-    // causes the generation of spurious range-list terminators in the
-    // .debug_ranges section.
+    // in debug sections. We return -1 as a tombstone value so this will not
+    // produce a valid range conflicting with ranges of actual code.
+
     if ((isa<FunctionSymbol>(sym) || isa<DataSymbol>(sym)) && !sym->isLive())
-      return reloc.Addend;
+      return -1;
   }
 
   switch (reloc.Type) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91803.306437.patch
Type: text/x-patch
Size: 780 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201119/01128b85/attachment.bin>


More information about the llvm-commits mailing list