diff --git a/lld/test/wasm/debug.test b/lld/test/wasm/debug.test new file mode 100644 --- /dev/null +++ b/lld/test/wasm/debug.test @@ -0,0 +1,7 @@ +RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.foo.o + +# Check -debug +RUN: wasm-ld %t.foo.o -o %t.t.out.wasm -debug 2>&1 | FileCheck %s +CHECK: Args: wasm-ld (LLVM option parsing) +CHECK: wasm-ld: writing MEMORY + diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp --- a/lld/wasm/Driver.cpp +++ b/lld/wasm/Driver.cpp @@ -743,6 +743,10 @@ WasmOptTable parser; opt::InputArgList args = parser.parse(argsArr.slice(1)); + // Handle -debug + if (args.hasArg(OPT_debug)) + DebugFlag = true; + // Handle --help if (args.hasArg(OPT_help)) { parser.PrintHelp(lld::outs(), diff --git a/lld/wasm/Options.td b/lld/wasm/Options.td --- a/lld/wasm/Options.td +++ b/lld/wasm/Options.td @@ -164,6 +164,9 @@ def max_memory: J<"max-memory=">, HelpText<"Maximum size of the linear memory">; +def debug: F<"debug">, + HelpText<"Enable LLVM style debug output">; + def no_entry: F<"no-entry">, HelpText<"Do not output any entry point">;