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

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 20 11:17:48 PST 2020


sbc100 added a comment.

lgtm!..   I'll leave the final approval to @yurydelendik



================
Comment at: lld/wasm/InputChunks.cpp:408
 
+uint64_t InputSection::getTombstoneForSection(StringRef name) {
+  if (name.startswith(".debug_")) {
----------------
Maybe a comment here explaining why we do this?


================
Comment at: lld/wasm/InputChunks.h:230
   const WasmSection §ion;
+  const uint64_t tombstone_value;
 };
----------------
We use the lowerCamel style so I think this should be tombstoneValue?


================
Comment at: lld/wasm/InputFiles.cpp:196
+    if ((isa<FunctionSymbol>(sym) || isa<DataSymbol>(sym)) && !sym->isLive()) {
+      return tombstone ? tombstone : reloc.Addend;
+    }
----------------
So setting the `tombstone` to zero means we should include the `Addend` ?


================
Comment at: lld/wasm/InputFiles.h:106
   uint32_t calcNewIndex(const WasmRelocation &reloc) const;
-  uint64_t calcNewValue(const WasmRelocation &reloc) const;
+  uint64_t calcNewValue(const WasmRelocation &reloc, uint64_t tombstone = 0) const;
   uint64_t calcNewAddend(const WasmRelocation &reloc) const;
----------------
It seems like all of the callsites should probably include the tombstone no?

Perhaps remove the default and specify it at each call site?


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

https://reviews.llvm.org/D91803



More information about the llvm-commits mailing list