[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
Fri Oct 27 01:57:10 PDT 2023


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

None

>From d8a4aecf5a22382fe57f654616fa59358477d9a4 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 2515f85432d7542..93785ca14eaf8bd 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.
   // AddRuntTimeLibs).
-  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