[WebAssembly] Add missing --demangle arg

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

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

llvm-svn: 327390
This commit is contained in:
Nicholas Wilson 2018-03-13 13:12:03 +00:00
parent 844f22d3c3
commit 08cff61572
3 changed files with 27 additions and 0 deletions

17
lld/test/wasm/demangle.ll Normal file
View File

@ -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
}

View File

@ -280,6 +280,7 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
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);

View File

@ -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-diagnostics">,
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">;