[PATCH] D79756: [lld][WebAssembly] Fix for --relocatable and signature mismatches

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 11 17:50:58 PDT 2020


sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff.
Herald added a project: LLVM.
sbc100 added a comment.

I'm still working on trying to reproduce this in test case.


This is a followup to https://reviews.llvm.org/D78779.

When signatures mismatch we create set of variant symbols.  Some of
the fields in these symbols were not be initialized correct.
Specifically we were seeing isUsedInRegularObj not being set correctly,
leading to the symbol not getting included in the symbol table
and a crash writing relections in --reloctable mode.

There is larger refactor due here, but this is a minimal change the
fixes the bug at hand.

Fixes: PR45645


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79756

Files:
  lld/wasm/SymbolTable.cpp


Index: lld/wasm/SymbolTable.cpp
===================================================================
--- lld/wasm/SymbolTable.cpp
+++ lld/wasm/SymbolTable.cpp
@@ -113,6 +113,7 @@
   sym->isUsedInRegularObj = false;
   sym->canInline = true;
   sym->traced = trace;
+  sym->forceExport = false;
   symVector.emplace_back(sym);
   return {sym, true};
 }
@@ -598,6 +599,11 @@
     // Create a new variant;
     LLVM_DEBUG(dbgs() << "added new variant\n");
     variant = reinterpret_cast<Symbol *>(make<SymbolUnion>());
+    variant->isUsedInRegularObj =
+        !file || file->kind() == InputFile::ObjectKind;
+    variant->canInline = true;
+    variant->traced = false;
+    variant->forceExport = false;
     variants.push_back(variant);
   } else {
     LLVM_DEBUG(dbgs() << "variant already exists: " << toString(*variant) << "\n");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79756.263319.patch
Type: text/x-patch
Size: 836 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200512/4f6b2857/attachment.bin>


More information about the llvm-commits mailing list