Skip to content

Commit 660ec19

Browse files
committed
[flang-rt] Pass the whole path of libflang_rt.runtime.a to linker on AIX.
1 parent 5929de8 commit 660ec19

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
@@ -1345,7 +1345,16 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
13451345
if (AsNeeded)
13461346
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/false);
13471347
}
1348-
CmdArgs.push_back("-lflang_rt.runtime");
1348+
if (TC.getTriple().isOSAIX()) {
1349+
// On AIX, pass the whole path of flang_rt.runtime.a to be consistent
1350+
// with clang.
1351+
std::string CRTBasename = "libflang_rt.runtime.a";
1352+
SmallString<128> Path(TC.getCompilerRTPath());
1353+
llvm::sys::path::append(Path, CRTBasename);
1354+
if (TC.getVFS().exists(Path))
1355+
CmdArgs.push_back(Args.MakeArgString(std::string(Path)));
1356+
} else
1357+
CmdArgs.push_back("-lflang_rt.runtime");
13491358
addArchSpecificRPath(TC, Args, CmdArgs);
13501359

13511360
// needs libexecinfo for backtrace functions

0 commit comments

Comments
 (0)