Skip to content

Commit 8e94a94

Browse files
committed
[flang-rt] Pass the whole path of libflang_rt.runtime.a to linker on AIX.
1 parent 316bb89 commit 8e94a94

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
@@ -1356,7 +1356,16 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
13561356
if (AsNeeded)
13571357
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/false);
13581358
}
1359-
CmdArgs.push_back("-lflang_rt.runtime");
1359+
if (TC.getTriple().isOSAIX()) {
1360+
// On AIX, pass the whole path of flang_rt.runtime.a to be consistent
1361+
// with clang.
1362+
std::string CRTBasename = "libflang_rt.runtime.a";
1363+
SmallString<128> Path(TC.getCompilerRTPath());
1364+
llvm::sys::path::append(Path, CRTBasename);
1365+
if (TC.getVFS().exists(Path))
1366+
CmdArgs.push_back(Args.MakeArgString(std::string(Path)));
1367+
} else
1368+
CmdArgs.push_back("-lflang_rt.runtime");
13601369
addArchSpecificRPath(TC, Args, CmdArgs);
13611370

13621371
// needs libexecinfo for backtrace functions

0 commit comments

Comments
 (0)