Skip to content

Commit 93e0ffa

Browse files
authored
[lld] Add --lto-emit-asm and alias --plugin-opt=emit-llvm to it (#97469)
Summary: The LTO pass currently supporting emitting LTO via the `--plugin-opt=emit-llvm` option. However, there is a very similar option called `--lto-emit-asm`. This patch just makes the usage more consistent and more obvious that emitting LLVM-IR is supported.
1 parent 59f4267 commit 93e0ffa

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lld/ELF/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,7 @@ static void readConfigs(opt::InputArgList &args) {
12691269
config->dynamicLinker = getDynamicLinker(args);
12701270
config->ehFrameHdr =
12711271
args.hasFlag(OPT_eh_frame_hdr, OPT_no_eh_frame_hdr, false);
1272-
config->emitLLVM = args.hasArg(OPT_plugin_opt_emit_llvm, false);
1272+
config->emitLLVM = args.hasArg(OPT_lto_emit_llvm);
12731273
config->emitRelocs = args.hasArg(OPT_emit_relocs);
12741274
config->enableNewDtags =
12751275
args.hasFlag(OPT_enable_new_dtags, OPT_disable_new_dtags, true);

lld/ELF/Options.td

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,8 @@ def lto_debug_pass_manager: FF<"lto-debug-pass-manager">,
614614
HelpText<"Debug new pass manager">;
615615
def lto_emit_asm: FF<"lto-emit-asm">,
616616
HelpText<"Emit assembly code">;
617+
def lto_emit_llvm: FF<"lto-emit-llvm">,
618+
HelpText<"Emit LLVM-IR bitcode">;
617619
def lto_newpm_passes: JJ<"lto-newpm-passes=">,
618620
HelpText<"Passes to run during LTO">;
619621
def lto_O: JJ<"lto-O">, MetaVarName<"<opt-level>">,
@@ -695,7 +697,8 @@ def plugin_opt_dwo_dir_eq: J<"plugin-opt=dwo_dir=">,
695697
HelpText<"Directory to store .dwo files when LTO and debug fission are used">;
696698
def plugin_opt_emit_asm: F<"plugin-opt=emit-asm">,
697699
Alias<lto_emit_asm>, HelpText<"Alias for --lto-emit-asm">;
698-
def plugin_opt_emit_llvm: F<"plugin-opt=emit-llvm">;
700+
def plugin_opt_emit_llvm: F<"plugin-opt=emit-llvm">,
701+
Alias<lto_emit_llvm>, HelpText<"Alias for --lto-emit-llvm">;
699702
def: J<"plugin-opt=jobs=">, Alias<thinlto_jobs_eq>, HelpText<"Alias for --thinlto-jobs=">;
700703
def: J<"plugin-opt=lto-partitions=">, Alias<lto_partitions>, HelpText<"Alias for --lto-partitions">;
701704
def plugin_opt_mcpu_eq: J<"plugin-opt=mcpu=">;

lld/test/ELF/lto/emit-llvm.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
;; Regression test for D112297: bitcode writer used to crash when
88
;; --plugin-opt=emit-llvmis enabled and the output is /dev/null.
99
; RUN: ld.lld --plugin-opt=emit-llvm -mllvm -bitcode-flush-threshold=0 -o /dev/null %t.o
10+
; RUN: ld.lld --lto-emit-llvm -mllvm -bitcode-flush-threshold=0 -o /dev/null %t.o
1011

1112
; CHECK: define internal void @main()
1213

0 commit comments

Comments
 (0)