[PATCH] D42652: [WebAssembly] Make function signature checks into warning
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 29 11:26:58 PST 2018
sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff, jfb.
Also add --fatal-warnings to match the ELF and COFF backend
behaviour.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D42652
Files:
test/wasm/fatal-warnings.ll
test/wasm/signature-mismatch.ll
wasm/Driver.cpp
wasm/SymbolTable.cpp
Index: wasm/SymbolTable.cpp
===================================================================
--- wasm/SymbolTable.cpp
+++ wasm/SymbolTable.cpp
@@ -113,10 +113,10 @@
if (*NewSig == OldSig)
return;
- error("function signature mismatch: " + Existing.getName() +
- "\n>>> defined as " + toString(OldSig) + " in " +
- toString(Existing.getFile()) + "\n>>> defined as " + toString(*NewSig) +
- " in " + F.getName());
+ warn("function signature mismatch: " + Existing.getName() +
+ "\n>>> defined as " + toString(OldSig) + " in " +
+ toString(Existing.getFile()) + "\n>>> defined as " + toString(*NewSig) +
+ " in " + F.getName());
}
static void checkSymbolTypes(const Symbol &Existing, const InputFile &F,
Index: wasm/Driver.cpp
===================================================================
--- wasm/Driver.cpp
+++ wasm/Driver.cpp
@@ -250,6 +250,8 @@
Config->CheckSignatures =
Args.hasFlag(OPT_check_signatures, OPT_no_check_signatures, false);
Config->Entry = getEntry(Args, Args.hasArg(OPT_relocatable) ? "" : "_start");
+ errorHandler().FatalWarnings =
+ Args.hasFlag(OPT_fatal_warnings, OPT_no_fatal_warnings, false);
Config->ImportMemory = Args.hasArg(OPT_import_memory);
Config->OutputFile = Args.getLastArgValue(OPT_o);
Config->Relocatable = Args.hasArg(OPT_relocatable);
Index: test/wasm/signature-mismatch.ll
===================================================================
--- test/wasm/signature-mismatch.ll
+++ test/wasm/signature-mismatch.ll
@@ -1,6 +1,6 @@
; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
; RUN: llc -filetype=obj %s -o %t.main.o
-; RUN: not lld -flavor wasm --check-signatures -o %t.wasm %t.main.o %t.ret32.o 2>&1 | FileCheck %s
+; RUN: not lld -flavor wasm --check-signatures --fatal-warnings -o %t.wasm %t.main.o %t.ret32.o 2>&1 | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
Index: test/wasm/fatal-warnings.ll
===================================================================
--- /dev/null
+++ test/wasm/fatal-warnings.ll
@@ -0,0 +1,15 @@
+; RUN: llc -filetype=obj %s -o %t.main.o
+; RUN: lld -flavor wasm --check-signatures -o %t.wasm %t.main.o 2>&1 | FileCheck %s
+
+target triple = "wasm32-unknown-unknown-wasm"
+
+define hidden i32 @_start(i32 %arg) local_unnamed_addr {
+entry:
+ ret i32 %arg
+}
+
+; CHECK: warning: function signature mismatch: _start
+
+; RUN: not lld -flavor wasm --check-signatures --fatal-warnings -o %t.wasm %t.main.o 2>&1 | FileCheck %s -check-prefix=CHECK-FATAL
+
+; CHECK-FATAL: error: function signature mismatch: _start
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42652.131832.patch
Type: text/x-patch
Size: 2610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180129/dc9be027/attachment.bin>
More information about the llvm-commits
mailing list