diff --git a/lld/test/wasm/driver.s b/lld/test/wasm/driver.s --- a/lld/test/wasm/driver.s +++ b/lld/test/wasm/driver.s @@ -5,6 +5,9 @@ .functype _start () -> () end_function +# RUN: not wasm-ld %t -o 2>&1 | FileCheck --check-prefix=NO_O_VAL %s +# NO_O_VAL: error: -o: missing argument + # RUN: not wasm-ld -o %t.exe 2>&1 | FileCheck -check-prefix=IN %s # IN: error: no input files diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp --- a/lld/wasm/Driver.cpp +++ b/lld/wasm/Driver.cpp @@ -184,6 +184,9 @@ args = this->ParseArgs(vec, missingIndex, missingCount); handleColorDiagnostics(args); + if (missingCount) + error(Twine(args.getArgString(missingIndex)) + ": missing argument"); + for (auto *arg : args.filtered(OPT_UNKNOWN)) error("unknown argument: " + arg->getAsString(args)); return args;