[clang] [flang-rt] Pass the whole path of libflang_rt.runtime.a to linker on AIX (PR #131041)

Michael Kruse via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 12 16:58:01 PDT 2025


================
@@ -1345,7 +1345,16 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
       if (AsNeeded)
         addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/false);
     }
-    CmdArgs.push_back("-lflang_rt.runtime");
+    if (TC.getTriple().isOSAIX()) {
+      // On AIX, pass the whole path of flang_rt.runtime.a to be consistent
+      // with clang.
+      std::string CRTBasename = "libflang_rt.runtime.a";
+      SmallString<128> Path(TC.getCompilerRTPath());
+      llvm::sys::path::append(Path, CRTBasename);
+      if (TC.getVFS().exists(Path))
+        CmdArgs.push_back(Args.MakeArgString(std::string(Path)));
----------------
Meinersbur wrote:

IMHO just doing nothing if the file does exist is a very confusing behavior.

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


More information about the cfe-commits mailing list