[clang] [Driver] Handle Flang in same manner between Gnu and *BSD/Solaris ToolChain (PR #70429)

Brad Smith via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 28 02:46:52 PDT 2023


https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/70429

>From 8e3e053c7b8048387efb39808429cef9802ea68f Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Fri, 27 Oct 2023 04:53:19 -0400
Subject: [PATCH] [Driver] Handle Flang in same manner between Gnu and
 *BSD/Solaris ToolChain

---
 clang/lib/Driver/ToolChains/Gnu.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 5237951f84cce03..f19107f2374ce9e 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -574,7 +574,9 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
   // to generate executables. As Fortran runtime depends on the C runtime,
   // these dependencies need to be listed before the C runtime below (i.e.
   // AddRunTimeLibs).
-  if (D.IsFlangMode()) {
+  if (D.IsFlangMode() &&
+      !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs,
+                   options::OPT_r)) {
     addFortranRuntimeLibraryPath(ToolChain, Args, CmdArgs);
     addFortranRuntimeLibs(ToolChain, CmdArgs);
     CmdArgs.push_back("-lm");



More information about the cfe-commits mailing list