[flang-commits] [clang] [flang] [flang][Driver] Enables lto-partitions and fat-lto-object. (PR #158125)

Tarun Prabhu via flang-commits flang-commits at lists.llvm.org
Tue Sep 16 17:29:55 PDT 2025


================
@@ -182,6 +182,29 @@ void Flang::addCodegenOptions(const ArgList &Args,
     CmdArgs.push_back("-fcoarray");
 }
 
+void Flang::addLTOOptions(const ArgList &Args, ArgStringList &CmdArgs) const {
+  const ToolChain &TC = getToolChain();
+  const Driver &D = TC.getDriver();
+  DiagnosticsEngine &Diags = D.getDiags();
+  LTOKind LTOMode = D.getLTOMode();
+  // LTO mode is parsed by the Clang driver library.
+  assert(LTOMode != LTOK_Unknown && "Unknown LTO mode.");
+  if (LTOMode == LTOK_Full)
+    CmdArgs.push_back("-flto=full");
+  else if (LTOMode == LTOK_Thin) {
+    Diags.Report(
----------------
tarunprabhu wrote:

I know that this isn't part of this PR, but do you know what `flto=thin` does in `flang`? Does it do anything at all or do we just accept this option, then ignore it? This warning is not very informative, and I wonder if it is worth providing something different.

https://github.com/llvm/llvm-project/pull/158125


More information about the flang-commits mailing list