[PATCH] D88226: Add debug option to wasm-ld to enable LLVM style debug info

Paulo Matos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 06:43:00 PDT 2020


pmatos created this revision.
Herald added subscribers: llvm-commits, dang, sunfish, sbc100.
Herald added a project: LLVM.
pmatos requested review of this revision.
Herald added a subscriber: aheejin.

Adds -debug flag to wasm-ld to enable LLVM debug information.
Also adds test.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88226

Files:
  lld/test/wasm/debug.test
  lld/wasm/Driver.cpp
  lld/wasm/Options.td


Index: lld/wasm/Options.td
===================================================================
--- lld/wasm/Options.td
+++ 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">;
 
Index: lld/wasm/Driver.cpp
===================================================================
--- lld/wasm/Driver.cpp
+++ 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(),
Index: lld/test/wasm/debug.test
===================================================================
--- /dev/null
+++ 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
+


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88226.294042.patch
Type: text/x-patch
Size: 1225 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200924/172d5002/attachment.bin>


More information about the llvm-commits mailing list