[flang-commits] [flang] [clang] [flang][driver] Add -fno-fortran-main (link time) option to remove Fortran_main from link line (PR #74139)

Michael Klemm via flang-commits flang-commits at lists.llvm.org
Mon Dec 11 02:42:05 PST 2023


https://github.com/mjklemm updated https://github.com/llvm/llvm-project/pull/74139

>From e0784bd3a6103fe6852ecc67fb01a4a8da1cf59a Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Fri, 1 Dec 2023 21:41:44 +0100
Subject: [PATCH 1/9] Add -fno-fortran-main driver option

---
 clang/include/clang/Driver/Options.td | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index b959fd20fe413..057f1f4b90955 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -6354,6 +6354,10 @@ def J : JoinedOrSeparate<["-"], "J">,
   Group<gfortran_Group>,
   Alias<module_dir>;
 
+def no_fortran_main : Flag<["-"], "fno-fortran-main">,
+  Visibility<[FlangOption]>, Group<f_Group>,
+  HelpText<"Don't link in Fortran main">;
+
 //===----------------------------------------------------------------------===//
 // FC1 Options
 //===----------------------------------------------------------------------===//

>From 5c2f898be0d16fdecd44fbcf94cb0513e9a75bb2 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Fri, 1 Dec 2023 21:42:09 +0100
Subject: [PATCH 2/9] Skip linking Fortran_main.a if -fno-fortran-main is
 present

---
 clang/lib/Driver/ToolChains/CommonArgs.cpp | 46 ++++++++++++----------
 1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 51b336216c565..82ed3e53d9960 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1116,33 +1116,37 @@ bool tools::addOpenMPRuntime(ArgStringList &CmdArgs, const ToolChain &TC,
   return true;
 }
 
+// TODO: add -fno-fortran-main option and check it in this function.
 void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
                                   llvm::opt::ArgStringList &CmdArgs) {
   // These are handled earlier on Windows by telling the frontend driver to add
   // the correct libraries to link against as dependents in the object file.
   if (!TC.getTriple().isKnownWindowsMSVCEnvironment()) {
-    // The --whole-archive option needs to be part of the link line to
-    // make sure that the main() function from Fortran_main.a is pulled
-    // in by the linker.  Determine if --whole-archive is active when
-    // flang will try to link Fortran_main.a.  If it is, don't add the
-    // --whole-archive flag to the link line.  If it's not, add a proper
-    // --whole-archive/--no-whole-archive bracket to the link line.
-    bool WholeArchiveActive = false;
-    for (auto *Arg : Args.filtered(options::OPT_Wl_COMMA))
-      if (Arg)
-        for (StringRef ArgValue : Arg->getValues()) {
-          if (ArgValue == "--whole-archive")
-            WholeArchiveActive = true;
-          if (ArgValue == "--no-whole-archive")
-            WholeArchiveActive = false;
-        }
-
-    if (!WholeArchiveActive)
-      CmdArgs.push_back("--whole-archive");
-    CmdArgs.push_back("-lFortran_main");
-    if (!WholeArchiveActive)
-      CmdArgs.push_back("--no-whole-archive");
+    // if -fno-fortran-main has been passed, skip linking Fortran_main.a
+    bool DontLinkFortranMain = Args.getLastArg(options::OPT_no_fortran_main) != nullptr;
+    if (!DontLinkFortranMain) {
+      // The --whole-archive option needs to be part of the link line to
+      // make sure that the main() function from Fortran_main.a is pulled
+      // in by the linker.  Determine if --whole-archive is active when
+      // flang will try to link Fortran_main.a.  If it is, don't add the
+      // --whole-archive flag to the link line.  If it's not, add a proper
+      // --whole-archive/--no-whole-archive bracket to the link line.
+      bool WholeArchiveActive = false;
+      for (auto *Arg : Args.filtered(options::OPT_Wl_COMMA))
+        if (Arg)
+          for (StringRef ArgValue : Arg->getValues()) {
+            if (ArgValue == "--whole-archive")
+              WholeArchiveActive = true;
+            if (ArgValue == "--no-whole-archive")
+              WholeArchiveActive = false;
+          }
 
+      if (!WholeArchiveActive)
+        CmdArgs.push_back("--whole-archive");
+      CmdArgs.push_back("-lFortran_main");
+      if (!WholeArchiveActive)
+        CmdArgs.push_back("--no-whole-archive");
+    }
     // Perform regular linkage of the remaining runtime libraries.
     CmdArgs.push_back("-lFortranRuntime");
     CmdArgs.push_back("-lFortranDecimal");

>From a87bdd40e2f4e707a47a185b49a93ae84c809bda Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Fri, 1 Dec 2023 15:10:29 -0600
Subject: [PATCH 3/9] Cleanup and simplify the code a bit

---
 clang/lib/Driver/ToolChains/CommonArgs.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 82ed3e53d9960..93877b75beaf7 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1116,14 +1116,13 @@ bool tools::addOpenMPRuntime(ArgStringList &CmdArgs, const ToolChain &TC,
   return true;
 }
 
-// TODO: add -fno-fortran-main option and check it in this function.
 void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
                                   llvm::opt::ArgStringList &CmdArgs) {
   // These are handled earlier on Windows by telling the frontend driver to add
   // the correct libraries to link against as dependents in the object file.
   if (!TC.getTriple().isKnownWindowsMSVCEnvironment()) {
     // if -fno-fortran-main has been passed, skip linking Fortran_main.a
-    bool DontLinkFortranMain = Args.getLastArg(options::OPT_no_fortran_main) != nullptr;
+    bool DontLinkFortranMain = Args.hasArg(options::OPT_no_fortran_main);
     if (!DontLinkFortranMain) {
       // The --whole-archive option needs to be part of the link line to
       // make sure that the main() function from Fortran_main.a is pulled

>From 179563c769b9255c063af806b1f60326f3f3b06f Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Fri, 1 Dec 2023 22:13:25 +0100
Subject: [PATCH 4/9] Update test to reflect positive outcome for
 -fno-fortran-main

---
 flang/test/Driver/no-duplicate-main.f90 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/flang/test/Driver/no-duplicate-main.f90 b/flang/test/Driver/no-duplicate-main.f90
index 4e33f4f2aeba3..12d5e46247bad 100644
--- a/flang/test/Driver/no-duplicate-main.f90
+++ b/flang/test/Driver/no-duplicate-main.f90
@@ -4,6 +4,8 @@
 ! RUN: %flang -o %t -c %s
 ! RUN: not %flang -o %t.exe %t %t.c-object 2>&1
 
+! RUN: %flang -fno-fortran-main -o %t.exe %t %t.c-object 2>&1
+
 ! TODO: potentially add further checks to ensure that proper
 !       linker error messages are detected and checked via
 !       FileCheck.

>From 0f40a515e81fd83391a61821d19c39dcf48fbce9 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael at dontknow.de>
Date: Mon, 4 Dec 2023 13:48:27 +0100
Subject: [PATCH 5/9] Respect -fno-fortran-main also for MSVC

---
 clang/lib/Driver/ToolChains/CommonArgs.cpp | 53 ++++++++++++----------
 clang/lib/Driver/ToolChains/Flang.cpp      | 14 ++++--
 2 files changed, 38 insertions(+), 29 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 93877b75beaf7..31e7d68161ff1 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1120,10 +1120,11 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
                                   llvm::opt::ArgStringList &CmdArgs) {
   // These are handled earlier on Windows by telling the frontend driver to add
   // the correct libraries to link against as dependents in the object file.
+
+  // if -fno-fortran-main has been passed, skip linking Fortran_main.a
+  bool LinkFortranMain = !Args.hasArg(options::OPT_no_fortran_main);
   if (!TC.getTriple().isKnownWindowsMSVCEnvironment()) {
-    // if -fno-fortran-main has been passed, skip linking Fortran_main.a
-    bool DontLinkFortranMain = Args.hasArg(options::OPT_no_fortran_main);
-    if (!DontLinkFortranMain) {
+    if (LinkFortranMain) {
       // The --whole-archive option needs to be part of the link line to
       // make sure that the main() function from Fortran_main.a is pulled
       // in by the linker.  Determine if --whole-archive is active when
@@ -1150,28 +1151,30 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
     CmdArgs.push_back("-lFortranRuntime");
     CmdArgs.push_back("-lFortranDecimal");
   } else {
-    unsigned RTOptionID = options::OPT__SLASH_MT;
-    if (auto *rtl = Args.getLastArg(options::OPT_fms_runtime_lib_EQ)) {
-      RTOptionID = llvm::StringSwitch<unsigned>(rtl->getValue())
-                       .Case("static", options::OPT__SLASH_MT)
-                       .Case("static_dbg", options::OPT__SLASH_MTd)
-                       .Case("dll", options::OPT__SLASH_MD)
-                       .Case("dll_dbg", options::OPT__SLASH_MDd)
-                       .Default(options::OPT__SLASH_MT);
-    }
-    switch (RTOptionID) {
-    case options::OPT__SLASH_MT:
-      CmdArgs.push_back("/WHOLEARCHIVE:Fortran_main.static.lib");
-      break;
-    case options::OPT__SLASH_MTd:
-      CmdArgs.push_back("/WHOLEARCHIVE:Fortran_main.static_dbg.lib");
-      break;
-    case options::OPT__SLASH_MD:
-      CmdArgs.push_back("/WHOLEARCHIVE:Fortran_main.dynamic.lib");
-      break;
-    case options::OPT__SLASH_MDd:
-      CmdArgs.push_back("/WHOLEARCHIVE:Fortran_main.dynamic_dbg.lib");
-      break;
+    if (LinkFortranMain) {
+      unsigned RTOptionID = options::OPT__SLASH_MT;
+      if (auto *rtl = Args.getLastArg(options::OPT_fms_runtime_lib_EQ)) {
+        RTOptionID = llvm::StringSwitch<unsigned>(rtl->getValue())
+                         .Case("static", options::OPT__SLASH_MT)
+                         .Case("static_dbg", options::OPT__SLASH_MTd)
+                         .Case("dll", options::OPT__SLASH_MD)
+                         .Case("dll_dbg", options::OPT__SLASH_MDd)
+                         .Default(options::OPT__SLASH_MT);
+      }
+      switch (RTOptionID) {
+      case options::OPT__SLASH_MT:
+        CmdArgs.push_back("/WHOLEARCHIVE:Fortran_main.static.lib");
+        break;
+      case options::OPT__SLASH_MTd:
+        CmdArgs.push_back("/WHOLEARCHIVE:Fortran_main.static_dbg.lib");
+        break;
+      case options::OPT__SLASH_MD:
+        CmdArgs.push_back("/WHOLEARCHIVE:Fortran_main.dynamic.lib");
+        break;
+      case options::OPT__SLASH_MDd:
+        CmdArgs.push_back("/WHOLEARCHIVE:Fortran_main.dynamic_dbg.lib");
+        break;
+      }
     }
   }
 }
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp
index 9b21fe952af7a..502b9f17a06c5 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -231,6 +231,8 @@ static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args,
                                     ArgStringList &CmdArgs) {
   assert(TC.getTriple().isKnownWindowsMSVCEnvironment() &&
          "can only add VS runtime library on Windows!");
+  // if -fno-fortran-main has been passed, skip linking Fortran_main.a
+  bool LinkFortranMain = !Args.hasArg(options::OPT_no_fortran_main);
   if (TC.getTriple().isKnownWindowsMSVCEnvironment()) {
     CmdArgs.push_back(Args.MakeArgString(
         "--dependent-lib=" + TC.getCompilerRTBasename(Args, "builtins")));
@@ -248,7 +250,8 @@ static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args,
   case options::OPT__SLASH_MT:
     CmdArgs.push_back("-D_MT");
     CmdArgs.push_back("--dependent-lib=libcmt");
-    CmdArgs.push_back("--dependent-lib=Fortran_main.static.lib");
+    if (LinkFortranMain)
+      CmdArgs.push_back("--dependent-lib=Fortran_main.static.lib");
     CmdArgs.push_back("--dependent-lib=FortranRuntime.static.lib");
     CmdArgs.push_back("--dependent-lib=FortranDecimal.static.lib");
     break;
@@ -256,7 +259,8 @@ static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args,
     CmdArgs.push_back("-D_MT");
     CmdArgs.push_back("-D_DEBUG");
     CmdArgs.push_back("--dependent-lib=libcmtd");
-    CmdArgs.push_back("--dependent-lib=Fortran_main.static_dbg.lib");
+    if (LinkFortranMain)
+      CmdArgs.push_back("--dependent-lib=Fortran_main.static_dbg.lib");
     CmdArgs.push_back("--dependent-lib=FortranRuntime.static_dbg.lib");
     CmdArgs.push_back("--dependent-lib=FortranDecimal.static_dbg.lib");
     break;
@@ -264,7 +268,8 @@ static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args,
     CmdArgs.push_back("-D_MT");
     CmdArgs.push_back("-D_DLL");
     CmdArgs.push_back("--dependent-lib=msvcrt");
-    CmdArgs.push_back("--dependent-lib=Fortran_main.dynamic.lib");
+    if (LinkFortranMain)
+      CmdArgs.push_back("--dependent-lib=Fortran_main.dynamic.lib");
     CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic.lib");
     CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic.lib");
     break;
@@ -273,7 +278,8 @@ static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args,
     CmdArgs.push_back("-D_DEBUG");
     CmdArgs.push_back("-D_DLL");
     CmdArgs.push_back("--dependent-lib=msvcrtd");
-    CmdArgs.push_back("--dependent-lib=Fortran_main.dynamic_dbg.lib");
+    if (LinkFortranMain)
+      CmdArgs.push_back("--dependent-lib=Fortran_main.dynamic_dbg.lib");
     CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic_dbg.lib");
     CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic_dbg.lib");
     break;

>From f6d0d23253ecafa07b79d3ec49399a46274ce2eb Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Mon, 4 Dec 2023 19:27:37 +0100
Subject: [PATCH 6/9] Add new -fno-fortran-main to test for help message

---
 flang/test/Driver/driver-help-hidden.f90 | 1 +
 flang/test/Driver/driver-help.f90        | 1 +
 2 files changed, 2 insertions(+)

diff --git a/flang/test/Driver/driver-help-hidden.f90 b/flang/test/Driver/driver-help-hidden.f90
index 8cb8b54d59412..89bb754fadaae 100644
--- a/flang/test/Driver/driver-help-hidden.f90
+++ b/flang/test/Driver/driver-help-hidden.f90
@@ -64,6 +64,7 @@
 ! CHECK-NEXT:                         Select Windows run-time library
 ! CHECK-NEXT: -fno-automatic          Implies the SAVE attribute for non-automatic local objects in subprograms unless RECURSIVE
 ! CHECK-NEXT: -fno-color-diagnostics  Disable colors in diagnostics
+! CHECK-NEXT: -fno-fortran-main       Don't link in Fortran main
 ! CHECK-NEXT: -fno-integrated-as      Disable the integrated assembler
 ! CHECK-NEXT: -fno-lto                Disable LTO mode (default)
 ! CHECK-NEXT: -fno-ppc-native-vector-element-order
diff --git a/flang/test/Driver/driver-help.f90 b/flang/test/Driver/driver-help.f90
index 0607ffde23789..a55ea78a66114 100644
--- a/flang/test/Driver/driver-help.f90
+++ b/flang/test/Driver/driver-help.f90
@@ -54,6 +54,7 @@
 ! HELP-NEXT:                         Select Windows run-time library
 ! HELP-NEXT: -fno-automatic          Implies the SAVE attribute for non-automatic local objects in subprograms unless RECURSIVE
 ! HELP-NEXT: -fno-color-diagnostics  Disable colors in diagnostics
+! HELP-NEXT: -fno-fortran-main       Don't link in Fortran main
 ! HELP-NEXT: -fno-integrated-as      Disable the integrated assembler
 ! HELP-NEXT: -fno-lto                Disable LTO mode (default)
 ! HELP-NEXT: -fno-ppc-native-vector-element-order

>From da30a4b98ba21e3cda0aca6db0f1207a142e6185 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Thu, 7 Dec 2023 18:00:00 +0100
Subject: [PATCH 7/9] Update clang/include/clang/Driver/Options.td by
 @banach-space
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Andrzej WarzyƄski <andrzej.warzynski at gmail.com>
---
 clang/include/clang/Driver/Options.td | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 057f1f4b90955..21e0e9d86df78 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -6354,10 +6354,21 @@ def J : JoinedOrSeparate<["-"], "J">,
   Group<gfortran_Group>,
   Alias<module_dir>;
 
+def J : JoinedOrSeparate<["-"], "J">,
+  Flags<[RenderJoined]>, Visibility<[FlangOption, FC1Option]>,
+  Group<gfortran_Group>,
+  Alias<module_dir>;
+  
+} // let Visibility = [FC1Option, FlangOption]
+//===----------------------------------------------------------------------===//
+// FLang Options
+//===----------------------------------------------------------------------===//
+let Visibility = [FlangOption] in {
 def no_fortran_main : Flag<["-"], "fno-fortran-main">,
   Visibility<[FlangOption]>, Group<f_Group>,
   HelpText<"Don't link in Fortran main">;
-
+}
+} // let Visibility = [ FlangOption]
 //===----------------------------------------------------------------------===//
 // FC1 Options
 //===----------------------------------------------------------------------===//

>From 924877d61237c17ee351de30ecbabd355f6c2be6 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Thu, 7 Dec 2023 18:10:24 +0100
Subject: [PATCH 8/9] Revert "Update clang/include/clang/Driver/Options.td by
 @banach-space"

This reverts commit 52e19aa2d2f3702afb62c314f8696d2387d417f7.
---
 clang/include/clang/Driver/Options.td | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 21e0e9d86df78..057f1f4b90955 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -6354,21 +6354,10 @@ def J : JoinedOrSeparate<["-"], "J">,
   Group<gfortran_Group>,
   Alias<module_dir>;
 
-def J : JoinedOrSeparate<["-"], "J">,
-  Flags<[RenderJoined]>, Visibility<[FlangOption, FC1Option]>,
-  Group<gfortran_Group>,
-  Alias<module_dir>;
-  
-} // let Visibility = [FC1Option, FlangOption]
-//===----------------------------------------------------------------------===//
-// FLang Options
-//===----------------------------------------------------------------------===//
-let Visibility = [FlangOption] in {
 def no_fortran_main : Flag<["-"], "fno-fortran-main">,
   Visibility<[FlangOption]>, Group<f_Group>,
   HelpText<"Don't link in Fortran main">;
-}
-} // let Visibility = [ FlangOption]
+
 //===----------------------------------------------------------------------===//
 // FC1 Options
 //===----------------------------------------------------------------------===//

>From 437b4142058c3e9bd8be5ac7d5f971197670c77c Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Mon, 11 Dec 2023 09:41:21 +0100
Subject: [PATCH 9/9] Improve help message for -fno-fortran-main

---
 clang/include/clang/Driver/Options.td    | 4 +++-
 flang/test/Driver/driver-help-hidden.f90 | 2 +-
 flang/test/Driver/driver-help.f90        | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 057f1f4b90955..cf969cb0b318a 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -6354,9 +6354,11 @@ def J : JoinedOrSeparate<["-"], "J">,
   Group<gfortran_Group>,
   Alias<module_dir>;
 
+let Visibility = [FlangOption] in {
 def no_fortran_main : Flag<["-"], "fno-fortran-main">,
   Visibility<[FlangOption]>, Group<f_Group>,
-  HelpText<"Don't link in Fortran main">;
+  HelpText<"Do not include Fortran_main.a (provided by Flang) when linking">;
+} // let Visibility = [ FlangOption ]
 
 //===----------------------------------------------------------------------===//
 // FC1 Options
diff --git a/flang/test/Driver/driver-help-hidden.f90 b/flang/test/Driver/driver-help-hidden.f90
index 89bb754fadaae..9a11a7a571ffc 100644
--- a/flang/test/Driver/driver-help-hidden.f90
+++ b/flang/test/Driver/driver-help-hidden.f90
@@ -64,7 +64,7 @@
 ! CHECK-NEXT:                         Select Windows run-time library
 ! CHECK-NEXT: -fno-automatic          Implies the SAVE attribute for non-automatic local objects in subprograms unless RECURSIVE
 ! CHECK-NEXT: -fno-color-diagnostics  Disable colors in diagnostics
-! CHECK-NEXT: -fno-fortran-main       Don't link in Fortran main
+! CHECK-NEXT: -fno-fortran-main       Do not include Fortran_main.a (provided by Flang) when linking
 ! CHECK-NEXT: -fno-integrated-as      Disable the integrated assembler
 ! CHECK-NEXT: -fno-lto                Disable LTO mode (default)
 ! CHECK-NEXT: -fno-ppc-native-vector-element-order
diff --git a/flang/test/Driver/driver-help.f90 b/flang/test/Driver/driver-help.f90
index a55ea78a66114..e0e74dc56f331 100644
--- a/flang/test/Driver/driver-help.f90
+++ b/flang/test/Driver/driver-help.f90
@@ -54,7 +54,7 @@
 ! HELP-NEXT:                         Select Windows run-time library
 ! HELP-NEXT: -fno-automatic          Implies the SAVE attribute for non-automatic local objects in subprograms unless RECURSIVE
 ! HELP-NEXT: -fno-color-diagnostics  Disable colors in diagnostics
-! HELP-NEXT: -fno-fortran-main       Don't link in Fortran main
+! HELP-NEXT: -fno-fortran-main       Do not include Fortran_main.a (provided by Flang) when linking
 ! HELP-NEXT: -fno-integrated-as      Disable the integrated assembler
 ! HELP-NEXT: -fno-lto                Disable LTO mode (default)
 ! HELP-NEXT: -fno-ppc-native-vector-element-order



More information about the flang-commits mailing list