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 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: 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: 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,