Index: lld/trunk/test/wasm/driver.ll =================================================================== --- lld/trunk/test/wasm/driver.ll +++ lld/trunk/test/wasm/driver.ll @@ -0,0 +1,18 @@ +; RUN: llc -filetype=obj %s -o %t.o + +target triple = "wasm32-unknown-unknown-wasm" + +define hidden void @entry() local_unnamed_addr #0 { +entry: + ret void +} + +; RUN: not wasm-ld -o %t.exe 2>&1 | FileCheck -check-prefix=IN %s +; IN: error: no input files + +; RUN: not wasm-ld %t.o 2>&1 | FileCheck -check-prefix=OUT %s +; OUT: error: no output file specified + +; RUN: not wasm-ld 2>&1 | FileCheck -check-prefix=BOTH %s +; BOTH: error: no input files +; BOTH-NOT: error: no output file specified Index: lld/trunk/wasm/Driver.cpp =================================================================== --- lld/trunk/wasm/Driver.cpp +++ lld/trunk/wasm/Driver.cpp @@ -211,9 +211,6 @@ break; } } - - if (Files.empty()) - error("no input files"); } static StringRef getEntry(opt::InputArgList &Args, StringRef Default) { @@ -280,12 +277,14 @@ if (auto *Arg = Args.getLastArg(OPT_allow_undefined_file)) readImportFile(Arg->getValue()); + if (!Args.hasArg(OPT_INPUT)) { + error("no input files"); + return; + } + if (Config->OutputFile.empty()) error("no output file specified"); - if (!Args.hasArg(OPT_INPUT)) - error("no input files"); - if (Config->Relocatable) { if (!Config->Entry.empty()) error("entry point specified for relocatable output file");