@@ -746,7 +746,8 @@ std::string ToolChain::buildCompilerRTBasename(const llvm::opt::ArgList &Args,
746
746
case ToolChain::FT_Shared:
747
747
Suffix = TT.isOSWindows ()
748
748
? (TT.isWindowsGNUEnvironment () ? " .dll.a" : " .lib" )
749
- : " .so" ;
749
+ : TT.isOSAIX () ? " .a"
750
+ : " .so" ;
750
751
break ;
751
752
}
752
753
@@ -852,17 +853,14 @@ void ToolChain::addFortranRuntimeLibraryPath(const llvm::opt::ArgList &Args,
852
853
void ToolChain::addFlangRTLibPath (const ArgList &Args,
853
854
llvm::opt::ArgStringList &CmdArgs) const {
854
855
// Link static flang_rt.runtime.a or shared flang_rt.runtime.so
855
- const char *Path;
856
- if (getVFS ().exists (Twine (Path = getCompilerRTArgString (
857
- Args, " runtime" , ToolChain::FT_Static, true ))))
858
- CmdArgs.push_back (Path);
856
+ // On AIX, default to static flang-rt
857
+ if (Args.hasFlag (options::OPT_static_libflangrt,
858
+ options::OPT_shared_libflangrt, getTriple ().isOSAIX ()))
859
+ CmdArgs.push_back (
860
+ getCompilerRTArgString (Args, " runtime" , ToolChain::FT_Static, true ));
859
861
else {
860
- if (getVFS ().exists (
861
- Twine (Path = getCompilerRTArgString (Args, " runtime" ,
862
- ToolChain::FT_Shared, true ))))
863
- CmdArgs.push_back (Path);
864
- else
865
- CmdArgs.push_back (" -lflang_rt.runtime" );
862
+ CmdArgs.push_back (
863
+ getCompilerRTArgString (Args, " runtime" , ToolChain::FT_Shared, true ));
866
864
addArchSpecificRPath (*this , Args, CmdArgs);
867
865
}
868
866
}
0 commit comments