diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index dc49530242df..89c12c64206a 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -289,7 +289,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) { Config->Demangle = !Args.hasArg(OPT_no_demangle); Config->DisableVerify = Args.hasArg(OPT_disable_verify); Config->DiscardAll = Args.hasArg(OPT_discard_all); - Config->DiscardValueNames = Args.hasArg(OPT_lto_discard_value_names); + Config->DiscardValueNames = !Args.hasArg(OPT_lto_no_discard_value_names); Config->DiscardLocals = Args.hasArg(OPT_discard_locals); Config->DiscardNone = Args.hasArg(OPT_discard_none); Config->EhFrameHdr = Args.hasArg(OPT_eh_frame_hdr); diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td index 8205de8e43ff..cbc83cd57ebe 100644 --- a/lld/ELF/Options.td +++ b/lld/ELF/Options.td @@ -238,7 +238,7 @@ def G : Separate<["-"], "G">; def alias_version_script_version_script : Joined<["--"], "version-script=">, Alias; // LTO-related options. -def lto_discard_value_names : Flag<["-"], "lto-discard-value-names">; +def lto_no_discard_value_names : Flag<["-"], "lto-no-discard-value-names">; def lto_jobs : Joined<["--"], "lto-jobs=">, HelpText<"Number of threads to run codegen">; def disable_verify : Flag<["-"], "disable-verify">; diff --git a/lld/test/ELF/lto/discard-value-names.ll b/lld/test/ELF/lto/discard-value-names.ll index a7674018a53b..dd40e75c9df1 100644 --- a/lld/test/ELF/lto/discard-value-names.ll +++ b/lld/test/ELF/lto/discard-value-names.ll @@ -1,9 +1,9 @@ ; RUN: llvm-as %s -o %t.o -; RUN: ld.lld -m elf_x86_64 -shared -save-temps %t.o -o %t2.o +; RUN: ld.lld -m elf_x86_64 -lto-no-discard-value-names -shared -save-temps %t.o -o %t2.o ; RUN: llvm-dis < %t2.o.lto.bc | FileCheck %s -; RUN: ld.lld -m elf_x86_64 -lto-discard-value-names -shared -save-temps %t.o -o %t2.o +; RUN: ld.lld -m elf_x86_64 -shared -save-temps %t.o -o %t2.o ; RUN: llvm-dis < %t2.o.lto.bc | FileCheck --check-prefix=NONAME %s ; CHECK: @GlobalValueName diff --git a/lld/test/ELF/lto/type-merge2.ll b/lld/test/ELF/lto/type-merge2.ll index f0931ddc9d5e..31d5974a0530 100644 --- a/lld/test/ELF/lto/type-merge2.ll +++ b/lld/test/ELF/lto/type-merge2.ll @@ -1,6 +1,6 @@ ; RUN: llvm-as %s -o %t.o ; RUN: llvm-as %p/Inputs/type-merge2.ll -o %t2.o -; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t.so -shared -save-temps +; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t.so -shared -save-temps -lto-no-discard-value-names ; RUN: llvm-dis %t.so.lto.bc -o - | FileCheck %s target triple = "x86_64-unknown-linux-gnu"