[lld] [lld] Add `--lto-emit-asm` and alias `--plugin-opt=emit-llvm` to it (PR #97469)
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 2 13:13:54 PDT 2024
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/97469
>From 08c8e12b5f6f19a83810ba60bf85f4087f1dc572 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Tue, 2 Jul 2024 14:44:04 -0500
Subject: [PATCH 1/2] [lld] Make `--lto-emit-llvm` to be more consistent with
`--lto-emit-asm`
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.
---
lld/ELF/Driver.cpp | 2 +-
lld/ELF/Options.td | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 73e260073da0c..a4863d6717efb 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 7d91b02b51079..74733efb28ff5 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<"<opt-level>">,
@@ -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<lto_emit_asm>, 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<lto_emit_llvm>, HelpText<"Alias for --lto-emit-llvm">;
def: J<"plugin-opt=jobs=">, Alias<thinlto_jobs_eq>, HelpText<"Alias for --thinlto-jobs=">;
def: J<"plugin-opt=lto-partitions=">, Alias<lto_partitions>, HelpText<"Alias for --lto-partitions">;
def plugin_opt_mcpu_eq: J<"plugin-opt=mcpu=">;
>From b91158e7f66841678fa13c764df253b2daf4358c Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Tue, 2 Jul 2024 15:13:41 -0500
Subject: [PATCH 2/2] Add test
---
lld/test/ELF/lto/emit-llvm.ll | 1 +
1 file changed, 1 insertion(+)
diff --git a/lld/test/ELF/lto/emit-llvm.ll b/lld/test/ELF/lto/emit-llvm.ll
index e80ef570b4e81..01f5a056e0c0d 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()
More information about the llvm-commits
mailing list