summaryrefslogtreecommitdiffstats
path: root/lld/wasm/SymbolTable.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2019-08-30 19:50:59 +0000
committerSam Clegg <sbc@chromium.org>2019-08-30 19:50:59 +0000
commitfecfc5920aeb163822ca0213206a34473109a86d (patch)
tree025eadb3109994f9d8b8d5824848e829986bdc8f /lld/wasm/SymbolTable.cpp
parent6ccd67320631e7ab26d6746bdc77eabfa03730e0 (diff)
downloadbcm5719-llvm-fecfc5920aeb163822ca0213206a34473109a86d.tar.gz
bcm5719-llvm-fecfc5920aeb163822ca0213206a34473109a86d.zip
[lld][WebAssembly] Fix spurious signature mismatch warnings
Summary: This a follow up on: https://reviews.llvm.org/D62153 Handle the case where there are multiple object files that contain undefined references to the same function. We only generate a function variant if the existing symbol is directly called. See: https://github.com/emscripten-core/emscripten/issues/8995 Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67015 llvm-svn: 370509
Diffstat (limited to 'lld/wasm/SymbolTable.cpp')
-rw-r--r--lld/wasm/SymbolTable.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp
index c46eec41146..44417b076c7 100644
--- a/lld/wasm/SymbolTable.cpp
+++ b/lld/wasm/SymbolTable.cpp
@@ -425,9 +425,16 @@ Symbol *SymbolTable::addUndefinedFunction(StringRef name, StringRef importName,
}
if (!existingFunction->signature && sig)
existingFunction->signature = sig;
- if (isCalledDirectly && !signatureMatches(existingFunction, sig))
- if (getFunctionVariant(s, sig, file, &s))
+ if (isCalledDirectly && !signatureMatches(existingFunction, sig)) {
+ auto* existingUndefined = dyn_cast<UndefinedFunction>(existingFunction);
+ // If the existing undefined functions is not called direcltly then let
+ // this one take precedence. Otherwise the existing function is either
+ // direclty called or defined, in which case we need a function variant.
+ if (existingUndefined && !existingUndefined->isCalledDirectly)
replaceSym();
+ else if (getFunctionVariant(s, sig, file, &s))
+ replaceSym();
+ }
}
return s;
OpenPOWER on IntegriCloud