diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 73e260073da0c2..a4863d6717efb4 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -1269,7 +1269,7 @@ static void readConfigs(opt::InputArgList &args) { config->dynamicLinker = getDynamicLinker(args); config->ehFrameHdr = args.hasFlag(OPT_eh_frame_hdr, OPT_no_eh_frame_hdr, false); - config->emitLLVM = args.hasArg(OPT_plugin_opt_emit_llvm, false); + config->emitLLVM = args.hasArg(OPT_lto_emit_llvm); config->emitRelocs = args.hasArg(OPT_emit_relocs); config->enableNewDtags = args.hasFlag(OPT_enable_new_dtags, OPT_disable_new_dtags, true); diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td index 7d91b02b510790..74733efb28ff5e 100644 --- a/lld/ELF/Options.td +++ b/lld/ELF/Options.td @@ -614,6 +614,8 @@ def lto_debug_pass_manager: FF<"lto-debug-pass-manager">, HelpText<"Debug new pass manager">; def lto_emit_asm: FF<"lto-emit-asm">, HelpText<"Emit assembly code">; +def lto_emit_llvm: FF<"lto-emit-llvm">, + HelpText<"Emit LLVM-IR bitcode">; def lto_newpm_passes: JJ<"lto-newpm-passes=">, HelpText<"Passes to run during LTO">; def lto_O: JJ<"lto-O">, MetaVarName<"">, @@ -695,7 +697,8 @@ def plugin_opt_dwo_dir_eq: J<"plugin-opt=dwo_dir=">, HelpText<"Directory to store .dwo files when LTO and debug fission are used">; def plugin_opt_emit_asm: F<"plugin-opt=emit-asm">, Alias, HelpText<"Alias for --lto-emit-asm">; -def plugin_opt_emit_llvm: F<"plugin-opt=emit-llvm">; +def plugin_opt_emit_llvm: F<"plugin-opt=emit-llvm">, + Alias, HelpText<"Alias for --lto-emit-llvm">; def: J<"plugin-opt=jobs=">, Alias, HelpText<"Alias for --thinlto-jobs=">; def: J<"plugin-opt=lto-partitions=">, Alias, HelpText<"Alias for --lto-partitions">; def plugin_opt_mcpu_eq: J<"plugin-opt=mcpu=">; diff --git a/lld/test/ELF/lto/emit-llvm.ll b/lld/test/ELF/lto/emit-llvm.ll index e80ef570b4e819..01f5a056e0c0d7 100644 --- a/lld/test/ELF/lto/emit-llvm.ll +++ b/lld/test/ELF/lto/emit-llvm.ll @@ -7,6 +7,7 @@ ;; Regression test for D112297: bitcode writer used to crash when ;; --plugin-opt=emit-llvmis enabled and the output is /dev/null. ; RUN: ld.lld --plugin-opt=emit-llvm -mllvm -bitcode-flush-threshold=0 -o /dev/null %t.o +; RUN: ld.lld --lto-emit-llvm -mllvm -bitcode-flush-threshold=0 -o /dev/null %t.o ; CHECK: define internal void @main()