================ @@ -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))); ---------------- DanielCChen wrote:
> IMHO just doing nothing if the file does exist is a very confusing behavior. There are some similar usages in the Driver code. It adds the path to the linker arg list only if the path has been created. Otherwise, not adding it (i.e. do nothing). For example, if I didn't have `-DLLVM_ENABLE_RUNTIMES="flang-rt"` specified, I wouldn't have `build/lib/clang/21/lib/aix/libflang_rt.runtime.a`, so this code will check that and not adding that to the linker arg list. That being said, I totally understand your point. Just I don't have a good answer for it. https://github.com/llvm/llvm-project/pull/131041 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits