[PATCH] D67015: [lld][WebAssembly] Fix spurious signature mismatch warnings
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 30 12:51:17 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL370509: [lld][WebAssembly] Fix spurious signature mismatch warnings (authored by sbc, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D67015?vs=218139&id=218155#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67015/new/
https://reviews.llvm.org/D67015
Files:
lld/trunk/test/wasm/signature-mismatch-unknown.ll
lld/trunk/wasm/SymbolTable.cpp
Index: lld/trunk/wasm/SymbolTable.cpp
===================================================================
--- lld/trunk/wasm/SymbolTable.cpp
+++ lld/trunk/wasm/SymbolTable.cpp
@@ -425,9 +425,16 @@
}
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;
Index: lld/trunk/test/wasm/signature-mismatch-unknown.ll
===================================================================
--- lld/trunk/test/wasm/signature-mismatch-unknown.ll
+++ lld/trunk/test/wasm/signature-mismatch-unknown.ll
@@ -3,6 +3,14 @@
; RUN: wasm-ld --fatal-warnings -o %t.wasm %t.ret32.o %t.main.o
; RUN: wasm-ld --fatal-warnings -o %t.wasm %t.main.o %t.ret32.o
+; Also test the case where there are two different object files that contains
+; referneces ret32:
+; %t.main.o: Does not call ret32 directly; used the wrong signature.
+; %t.call-ret32.o: Calls ret32 directly; uses the correct signature.
+; RUN: llc -filetype=obj %p/Inputs/call-ret32.ll -o %t.call-ret32.o
+; RUN: wasm-ld --export=call_ret32 --fatal-warnings -o %t.wasm %t.main.o %t.call-ret32.o %t.ret32.o
+; RUN: wasm-ld --export=call_ret32 --fatal-warnings -o %t.wasm %t.call-ret32.o %t.main.o %t.ret32.o
+
target triple = "wasm32-unknown-unknown"
; Function declartion with incorrect signature.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67015.218155.patch
Type: text/x-patch
Size: 1988 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190830/46e9057c/attachment.bin>
More information about the llvm-commits
mailing list