Skip to content

Commit aecfa9e

Browse files
committed
[flang-rt] Pass the whole path of libflang_rt.runtime.a to linker on AIX.
1 parent 7dce16a commit aecfa9e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,16 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
13581358
if (AsNeeded)
13591359
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/false);
13601360
}
1361-
CmdArgs.push_back("-lflang_rt.runtime");
1361+
if (TC.getTriple().isOSAIX()) {
1362+
// On AIX, pass the whole path of flang_rt.runtime.a to be consistent
1363+
// with clang.
1364+
std::string CRTBasename = "libflang_rt.runtime.a";
1365+
SmallString<128> Path(TC.getCompilerRTPath());
1366+
llvm::sys::path::append(Path, CRTBasename);
1367+
if (TC.getVFS().exists(Path))
1368+
CmdArgs.push_back(Args.MakeArgString(std::string(Path)));
1369+
} else
1370+
CmdArgs.push_back("-lflang_rt.runtime");
13621371
addArchSpecificRPath(TC, Args, CmdArgs);
13631372

13641373
// needs libexecinfo for backtrace functions

0 commit comments

Comments
 (0)