[lld] r327390 - [WebAssembly] Add missing --demangle arg

Nicholas Wilson via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 13 06:12:03 PDT 2018


Author: ncw
Date: Tue Mar 13 06:12:03 2018
New Revision: 327390

URL: http://llvm.org/viewvc/llvm-project?rev=327390&view=rev
Log:
[WebAssembly] Add missing --demangle arg

Previously, Config->Demangle was uninitialised (not hooked up to
commandline handling)

Differential Revision: https://reviews.llvm.org/D44301

Added:
    lld/trunk/test/wasm/demangle.ll
Modified:
    lld/trunk/wasm/Driver.cpp
    lld/trunk/wasm/Options.td

Added: lld/trunk/test/wasm/demangle.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/demangle.ll?rev=327390&view=auto
==============================================================================
--- lld/trunk/test/wasm/demangle.ll (added)
+++ lld/trunk/test/wasm/demangle.ll Tue Mar 13 06:12:03 2018
@@ -0,0 +1,17 @@
+; RUN: llc -filetype=obj %s -o %t.o
+; RUN: not wasm-ld --check-signatures --undefined _Z3fooi \
+; RUN:     -o %t.wasm %t.o 2>&1 | FileCheck %s
+
+; CHECK: error: undefined symbol: foo(int)
+
+; RUN: not wasm-ld --check-signatures --no-demangle --undefined _Z3fooi \
+; RUN:     -o %t.wasm %t.o 2>&1 |  FileCheck -check-prefix=CHECK-NODEMANGLE %s
+
+; CHECK-NODEMANGLE: error: undefined symbol: _Z3fooi
+
+target triple = "wasm32-unknown-unknown-wasm"
+
+define hidden void @_start() local_unnamed_addr {
+entry:
+    ret void
+}

Modified: lld/trunk/wasm/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Driver.cpp?rev=327390&r1=327389&r2=327390&view=diff
==============================================================================
--- lld/trunk/wasm/Driver.cpp (original)
+++ lld/trunk/wasm/Driver.cpp Tue Mar 13 06:12:03 2018
@@ -280,6 +280,7 @@ void LinkerDriver::link(ArrayRef<const c
   Config->AllowUndefined = Args.hasArg(OPT_allow_undefined);
   Config->CheckSignatures =
       Args.hasFlag(OPT_check_signatures, OPT_no_check_signatures, false);
+  Config->Demangle = Args.hasFlag(OPT_demangle, OPT_no_demangle, true);
   Config->Entry = getEntry(Args, Args.hasArg(OPT_relocatable) ? "" : "_start");
   Config->ImportMemory = Args.hasArg(OPT_import_memory);
   Config->OutputFile = Args.getLastArgValue(OPT_o);

Modified: lld/trunk/wasm/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Options.td?rev=327390&r1=327389&r2=327390&view=diff
==============================================================================
--- lld/trunk/wasm/Options.td (original)
+++ lld/trunk/wasm/Options.td Tue Mar 13 06:12:03 2018
@@ -11,6 +11,11 @@ multiclass Eq<string name> {
   def _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>;
 }
 
+multiclass B<string name, string help1, string help2> {
+  def NAME: Flag<["--", "-"], name>, HelpText<help1>;
+  def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>;
+}
+
 // The follow flags are shared with the ELF linker
 def color_diagnostics: F<"color-diagnostics">,
   HelpText<"Use colors in diagnostics">;
@@ -18,6 +23,10 @@ def color_diagnostics: F<"color-diagnost
 def color_diagnostics_eq: J<"color-diagnostics=">,
   HelpText<"Use colors in diagnostics">;
 
+defm demangle: B<"demangle",
+    "Demangle symbol names",
+    "Do not demangle symbol names">;
+
 def entry: S<"entry">, MetaVarName<"<entry>">,
   HelpText<"Name of entry point symbol">;
 




More information about the llvm-commits mailing list