[lld] [lld][WebAssembly] Fix spurious signature mismatch under LTO (PR #136197)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 14:23:00 PDT 2025


================
@@ -108,9 +108,10 @@ BitcodeCompiler::~BitcodeCompiler() = default;
 
 static void undefine(Symbol *s) {
   if (auto f = dyn_cast<DefinedFunction>(s))
+    // If the signature is null, there were no calls from non-bitcode objects.
     replaceSymbol<UndefinedFunction>(f, f->getName(), std::nullopt,
                                      std::nullopt, 0, f->getFile(),
-                                     f->signature);
+                                     f->signature, f->signature != nullptr);
----------------
sbc100 wrote:

I wonder if we should instead make SymbolTable.cpp assume that the null signature is a placeholder?  i.e. today we do `checkSig = ud->isCalledDirectly;` but we could do `checkSig = ud->isCalledDirectly && ud->signature;`?

I don't feel strongly though and this approach certainly works.

https://github.com/llvm/llvm-project/pull/136197


More information about the llvm-commits mailing list