Skip to content

Commit 2080334

Browse files
authored
[flang-rt] Pass the whole path of libflang_rt.runtime.a to linker on AIX and LoP (#131041)
This PR is to improve the driver code to build `flang-rt` path by re-using the logic and code of `compiler-rt`. 1. Moved `addFortranRuntimeLibraryPath` and `addFortranRuntimeLibs` to `ToolChain.h` and made them virtual so that they can be overridden if customization is needed. The current implementation of those two procedures is moved to `ToolChain.cpp` as the base implementation to default to. 2. Both AIX and PPCLinux now override `addFortranRuntimeLibs`. The overriding function of `addFortranRuntimeLibs` for both AIX and PPCLinux calls `getCompilerRTArgString` => `getCompilerRT` => `buildCompilerRTBasename` to get the path to `flang-rt`. This code handles `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR` setting. As shown in `PPCLinux.cpp`, `FT_static` is the default. If not found, it will search and build for `FT_shared`. To differentiate `flang-rt` from `clang-rt`, a boolean flag `IsFortran` is passed to the chain of functions in order to reach `buildCompilerRTBasename`.
1 parent f23bb53 commit 2080334

File tree

31 files changed

+206
-130
lines changed

31 files changed

+206
-130
lines changed

clang/include/clang/Driver/ToolChain.h

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ class ToolChain {
216216

217217
virtual std::string buildCompilerRTBasename(const llvm::opt::ArgList &Args,
218218
StringRef Component,
219-
FileType Type,
220-
bool AddArch) const;
219+
FileType Type, bool AddArch,
220+
bool IsFortran = false) const;
221221

222222
/// Find the target-specific subdirectory for the current target triple under
223223
/// \p BaseDir, doing fallback triple searches as necessary.
@@ -509,11 +509,22 @@ class ToolChain {
509509

510510
virtual std::string getCompilerRT(const llvm::opt::ArgList &Args,
511511
StringRef Component,
512-
FileType Type = ToolChain::FT_Static) const;
512+
FileType Type = ToolChain::FT_Static,
513+
bool IsFortran = false) const;
514+
515+
/// Adds Fortran runtime libraries to \p CmdArgs.
516+
virtual void addFortranRuntimeLibs(const llvm::opt::ArgList &Args,
517+
llvm::opt::ArgStringList &CmdArgs) const;
518+
519+
/// Adds the path for the Fortran runtime libraries to \p CmdArgs.
520+
virtual void
521+
addFortranRuntimeLibraryPath(const llvm::opt::ArgList &Args,
522+
llvm::opt::ArgStringList &CmdArgs) const;
513523

514-
const char *
515-
getCompilerRTArgString(const llvm::opt::ArgList &Args, StringRef Component,
516-
FileType Type = ToolChain::FT_Static) const;
524+
const char *getCompilerRTArgString(const llvm::opt::ArgList &Args,
525+
StringRef Component,
526+
FileType Type = ToolChain::FT_Static,
527+
bool IsFortran = false) const;
517528

518529
std::string getCompilerRTBasename(const llvm::opt::ArgList &Args,
519530
StringRef Component,

clang/lib/Driver/ToolChain.cpp

Lines changed: 66 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,8 @@ std::string ToolChain::getCompilerRTBasename(const ArgList &Args,
727727

728728
std::string ToolChain::buildCompilerRTBasename(const llvm::opt::ArgList &Args,
729729
StringRef Component,
730-
FileType Type,
731-
bool AddArch) const {
730+
FileType Type, bool AddArch,
731+
bool IsFortran) const {
732732
const llvm::Triple &TT = getTriple();
733733
bool IsITANMSVCWindows =
734734
TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment();
@@ -756,14 +756,16 @@ std::string ToolChain::buildCompilerRTBasename(const llvm::opt::ArgList &Args,
756756
const char *Env = TT.isAndroid() ? "-android" : "";
757757
ArchAndEnv = ("-" + Arch + Env).str();
758758
}
759-
return (Prefix + Twine("clang_rt.") + Component + ArchAndEnv + Suffix).str();
759+
760+
std::string LibName = IsFortran ? "flang_rt." : "clang_rt.";
761+
return (Prefix + Twine(LibName) + Component + ArchAndEnv + Suffix).str();
760762
}
761763

762764
std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
763-
FileType Type) const {
765+
FileType Type, bool IsFortran) const {
764766
// Check for runtime files in the new layout without the architecture first.
765-
std::string CRTBasename =
766-
buildCompilerRTBasename(Args, Component, Type, /*AddArch=*/false);
767+
std::string CRTBasename = buildCompilerRTBasename(
768+
Args, Component, Type, /*AddArch=*/false, IsFortran);
767769
SmallString<128> Path;
768770
for (const auto &LibPath : getLibraryPaths()) {
769771
SmallString<128> P(LibPath);
@@ -775,8 +777,8 @@ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
775777
}
776778

777779
// Check the filename for the old layout if the new one does not exist.
778-
CRTBasename =
779-
buildCompilerRTBasename(Args, Component, Type, /*AddArch=*/true);
780+
CRTBasename = buildCompilerRTBasename(Args, Component, Type,
781+
/*AddArch=*/!IsFortran, IsFortran);
780782
SmallString<128> OldPath(getCompilerRTPath());
781783
llvm::sys::path::append(OldPath, CRTBasename);
782784
if (Path.empty() || getVFS().exists(OldPath))
@@ -790,8 +792,62 @@ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
790792

791793
const char *ToolChain::getCompilerRTArgString(const llvm::opt::ArgList &Args,
792794
StringRef Component,
793-
FileType Type) const {
794-
return Args.MakeArgString(getCompilerRT(Args, Component, Type));
795+
FileType Type,
796+
bool isFortran) const {
797+
return Args.MakeArgString(getCompilerRT(Args, Component, Type, isFortran));
798+
}
799+
800+
/// Add Fortran runtime libs
801+
void ToolChain::addFortranRuntimeLibs(const ArgList &Args,
802+
llvm::opt::ArgStringList &CmdArgs) const {
803+
// Link flang_rt.runtime
804+
// These are handled earlier on Windows by telling the frontend driver to
805+
// add the correct libraries to link against as dependents in the object
806+
// file.
807+
if (!getTriple().isKnownWindowsMSVCEnvironment()) {
808+
StringRef F128LibName = getDriver().getFlangF128MathLibrary();
809+
F128LibName.consume_front_insensitive("lib");
810+
if (!F128LibName.empty()) {
811+
bool AsNeeded = !getTriple().isOSAIX();
812+
CmdArgs.push_back("-lflang_rt.quadmath");
813+
if (AsNeeded)
814+
addAsNeededOption(*this, Args, CmdArgs, /*as_needed=*/true);
815+
CmdArgs.push_back(Args.MakeArgString("-l" + F128LibName));
816+
if (AsNeeded)
817+
addAsNeededOption(*this, Args, CmdArgs, /*as_needed=*/false);
818+
}
819+
CmdArgs.push_back("-lflang_rt.runtime");
820+
addArchSpecificRPath(*this, Args, CmdArgs);
821+
822+
// needs libexecinfo for backtrace functions
823+
if (getTriple().isOSFreeBSD() || getTriple().isOSNetBSD() ||
824+
getTriple().isOSOpenBSD() || getTriple().isOSDragonFly())
825+
CmdArgs.push_back("-lexecinfo");
826+
}
827+
828+
// libomp needs libatomic for atomic operations if using libgcc
829+
if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
830+
options::OPT_fno_openmp, false)) {
831+
Driver::OpenMPRuntimeKind OMPRuntime = getDriver().getOpenMPRuntime(Args);
832+
ToolChain::RuntimeLibType RuntimeLib = GetRuntimeLibType(Args);
833+
if (OMPRuntime == Driver::OMPRT_OMP && RuntimeLib == ToolChain::RLT_Libgcc)
834+
CmdArgs.push_back("-latomic");
835+
}
836+
}
837+
838+
void ToolChain::addFortranRuntimeLibraryPath(const llvm::opt::ArgList &Args,
839+
ArgStringList &CmdArgs) const {
840+
// Default to the <driver-path>/../lib directory. This works fine on the
841+
// platforms that we have tested so far. We will probably have to re-fine
842+
// this in the future. In particular, on some platforms, we may need to use
843+
// lib64 instead of lib.
844+
SmallString<256> DefaultLibPath =
845+
llvm::sys::path::parent_path(getDriver().Dir);
846+
llvm::sys::path::append(DefaultLibPath, "lib");
847+
if (getTriple().isKnownWindowsMSVCEnvironment())
848+
CmdArgs.push_back(Args.MakeArgString("-libpath:" + DefaultLibPath));
849+
else
850+
CmdArgs.push_back(Args.MakeArgString("-L" + DefaultLibPath));
795851
}
796852

797853
// Android target triples contain a target version. If we don't have libraries

clang/lib/Driver/ToolChains/AIX.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
358358

359359
if (D.IsFlangMode() &&
360360
!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
361-
addFortranRuntimeLibraryPath(ToolChain, Args, CmdArgs);
362-
addFortranRuntimeLibs(ToolChain, Args, CmdArgs);
361+
ToolChain.addFortranRuntimeLibraryPath(Args, CmdArgs);
362+
ToolChain.addFortranRuntimeLibs(Args, CmdArgs);
363363
CmdArgs.push_back("-lm");
364364
CmdArgs.push_back("-lpthread");
365365
}
@@ -608,6 +608,14 @@ void AIX::addProfileRTLibs(const llvm::opt::ArgList &Args,
608608
ToolChain::addProfileRTLibs(Args, CmdArgs);
609609
}
610610

611+
void AIX::addFortranRuntimeLibs(const ArgList &Args,
612+
llvm::opt::ArgStringList &CmdArgs) const {
613+
// Link flang_rt.runtime.a. On AIX, the static and shared library are all
614+
// named .a
615+
CmdArgs.push_back(
616+
getCompilerRTArgString(Args, "runtime", ToolChain::FT_Static, true));
617+
}
618+
611619
ToolChain::CXXStdlibType AIX::GetDefaultCXXStdlibType() const {
612620
return ToolChain::CST_Libcxx;
613621
}

clang/lib/Driver/ToolChains/AIX.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ class LLVM_LIBRARY_VISIBILITY AIX : public ToolChain {
8787
void addProfileRTLibs(const llvm::opt::ArgList &Args,
8888
llvm::opt::ArgStringList &CmdArgs) const override;
8989

90+
void addFortranRuntimeLibs(const llvm::opt::ArgList &Args,
91+
llvm::opt::ArgStringList &CmdArgs) const override;
92+
9093
CXXStdlibType GetDefaultCXXStdlibType() const override;
9194

9295
RuntimeLibType GetDefaultRuntimeLibType() const override;

clang/lib/Driver/ToolChains/AVR.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,10 @@ Tool *AVRToolChain::buildLinker() const {
424424
return new tools::AVR::Linker(getTriple(), *this);
425425
}
426426

427-
std::string
428-
AVRToolChain::getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
429-
FileType Type = ToolChain::FT_Static) const {
427+
std::string AVRToolChain::getCompilerRT(const llvm::opt::ArgList &Args,
428+
StringRef Component,
429+
FileType Type = ToolChain::FT_Static,
430+
bool IsFortran) const {
430431
assert(Type == ToolChain::FT_Static && "AVR only supports static libraries");
431432
// Since AVR can never be a host environment, its compiler-rt library files
432433
// should always have ".a" suffix, even on windows.

clang/lib/Driver/ToolChains/AVR.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ class LLVM_LIBRARY_VISIBILITY AVRToolChain : public Generic_ELF {
3434
std::optional<std::string> findAVRLibcInstallation() const;
3535
StringRef getGCCInstallPath() const { return GCCInstallPath; }
3636
std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
37-
FileType Type) const override;
37+
FileType Type,
38+
bool IsFortran = false) const override;
3839

3940
bool HasNativeLLVMSupport() const override { return true; }
4041

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,61 +1339,6 @@ void tools::addOpenMPHostOffloadingArgs(const Compilation &C,
13391339
Args.MakeArgString(Twine(Targets) + llvm::join(Triples, ",")));
13401340
}
13411341

1342-
/// Add Fortran runtime libs
1343-
void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
1344-
llvm::opt::ArgStringList &CmdArgs) {
1345-
// Link flang_rt.runtime
1346-
// These are handled earlier on Windows by telling the frontend driver to
1347-
// add the correct libraries to link against as dependents in the object
1348-
// file.
1349-
if (!TC.getTriple().isKnownWindowsMSVCEnvironment()) {
1350-
StringRef F128LibName = TC.getDriver().getFlangF128MathLibrary();
1351-
F128LibName.consume_front_insensitive("lib");
1352-
if (!F128LibName.empty()) {
1353-
bool AsNeeded = !TC.getTriple().isOSAIX();
1354-
CmdArgs.push_back("-lflang_rt.quadmath");
1355-
if (AsNeeded)
1356-
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/true);
1357-
CmdArgs.push_back(Args.MakeArgString("-l" + F128LibName));
1358-
if (AsNeeded)
1359-
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/false);
1360-
}
1361-
CmdArgs.push_back("-lflang_rt.runtime");
1362-
addArchSpecificRPath(TC, Args, CmdArgs);
1363-
1364-
// needs libexecinfo for backtrace functions
1365-
if (TC.getTriple().isOSFreeBSD() || TC.getTriple().isOSNetBSD() ||
1366-
TC.getTriple().isOSOpenBSD() || TC.getTriple().isOSDragonFly())
1367-
CmdArgs.push_back("-lexecinfo");
1368-
}
1369-
1370-
// libomp needs libatomic for atomic operations if using libgcc
1371-
if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
1372-
options::OPT_fno_openmp, false)) {
1373-
Driver::OpenMPRuntimeKind OMPRuntime =
1374-
TC.getDriver().getOpenMPRuntime(Args);
1375-
ToolChain::RuntimeLibType RuntimeLib = TC.GetRuntimeLibType(Args);
1376-
if (OMPRuntime == Driver::OMPRT_OMP && RuntimeLib == ToolChain::RLT_Libgcc)
1377-
CmdArgs.push_back("-latomic");
1378-
}
1379-
}
1380-
1381-
void tools::addFortranRuntimeLibraryPath(const ToolChain &TC,
1382-
const llvm::opt::ArgList &Args,
1383-
ArgStringList &CmdArgs) {
1384-
// Default to the <driver-path>/../lib directory. This works fine on the
1385-
// platforms that we have tested so far. We will probably have to re-fine
1386-
// this in the future. In particular, on some platforms, we may need to use
1387-
// lib64 instead of lib.
1388-
SmallString<256> DefaultLibPath =
1389-
llvm::sys::path::parent_path(TC.getDriver().Dir);
1390-
llvm::sys::path::append(DefaultLibPath, "lib");
1391-
if (TC.getTriple().isKnownWindowsMSVCEnvironment())
1392-
CmdArgs.push_back(Args.MakeArgString("-libpath:" + DefaultLibPath));
1393-
else
1394-
CmdArgs.push_back(Args.MakeArgString("-L" + DefaultLibPath));
1395-
}
1396-
13971342
static void addSanitizerRuntime(const ToolChain &TC, const ArgList &Args,
13981343
ArgStringList &CmdArgs, StringRef Sanitizer,
13991344
bool IsShared, bool IsWhole) {

clang/lib/Driver/ToolChains/CommonArgs.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,6 @@ void addOpenMPHostOffloadingArgs(const Compilation &C, const JobAction &JA,
121121
const llvm::opt::ArgList &Args,
122122
llvm::opt::ArgStringList &CmdArgs);
123123

124-
/// Adds Fortran runtime libraries to \p CmdArgs.
125-
void addFortranRuntimeLibs(const ToolChain &TC, const llvm::opt::ArgList &Args,
126-
llvm::opt::ArgStringList &CmdArgs);
127-
128-
/// Adds the path for the Fortran runtime libraries to \p CmdArgs.
129-
void addFortranRuntimeLibraryPath(const ToolChain &TC,
130-
const llvm::opt::ArgList &Args,
131-
llvm::opt::ArgStringList &CmdArgs);
132-
133124
void addHIPRuntimeLibArgs(const ToolChain &TC, Compilation &C,
134125
const llvm::opt::ArgList &Args,
135126
llvm::opt::ArgStringList &CmdArgs);

clang/lib/Driver/ToolChains/Darwin.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,8 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
706706
// to generate executables.
707707
if (getToolChain().getDriver().IsFlangMode() &&
708708
!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
709-
addFortranRuntimeLibraryPath(getToolChain(), Args, CmdArgs);
710-
addFortranRuntimeLibs(getToolChain(), Args, CmdArgs);
709+
getToolChain().addFortranRuntimeLibraryPath(Args, CmdArgs);
710+
getToolChain().addFortranRuntimeLibs(Args, CmdArgs);
711711
}
712712

713713
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs))
@@ -1348,7 +1348,7 @@ void MachO::AddLinkRuntimeLib(const ArgList &Args, ArgStringList &CmdArgs,
13481348
}
13491349

13501350
std::string MachO::getCompilerRT(const ArgList &, StringRef Component,
1351-
FileType Type) const {
1351+
FileType Type, bool IsFortran) const {
13521352
assert(Type != ToolChain::FT_Object &&
13531353
"it doesn't make sense to ask for the compiler-rt library name as an "
13541354
"object file");
@@ -1367,7 +1367,7 @@ std::string MachO::getCompilerRT(const ArgList &, StringRef Component,
13671367
}
13681368

13691369
std::string Darwin::getCompilerRT(const ArgList &, StringRef Component,
1370-
FileType Type) const {
1370+
FileType Type, bool IsFortran) const {
13711371
assert(Type != ToolChain::FT_Object &&
13721372
"it doesn't make sense to ask for the compiler-rt library name as an "
13731373
"object file");

clang/lib/Driver/ToolChains/Darwin.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,9 @@ class LLVM_LIBRARY_VISIBILITY MachO : public ToolChain {
232232
// Return the full path of the compiler-rt library on a non-Darwin MachO
233233
// system. Those are under
234234
// <resourcedir>/lib/darwin/macho_embedded/<...>(.dylib|.a).
235-
std::string
236-
getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
237-
FileType Type = ToolChain::FT_Static) const override;
235+
std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
236+
FileType Type = ToolChain::FT_Static,
237+
bool IsFortran = false) const override;
238238

239239
/// }
240240
/// @name ToolChain Implementation
@@ -412,9 +412,9 @@ class LLVM_LIBRARY_VISIBILITY Darwin : public AppleMachO {
412412

413413
// Return the full path of the compiler-rt library on a Darwin MachO system.
414414
// Those are under <resourcedir>/lib/darwin/<...>(.dylib|.a).
415-
std::string
416-
getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
417-
FileType Type = ToolChain::FT_Static) const override;
415+
std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
416+
FileType Type = ToolChain::FT_Static,
417+
bool IsFortran = false) const override;
418418

419419
protected:
420420
/// }

clang/lib/Driver/ToolChains/DragonFly.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ void dragonfly::Linker::ConstructJob(Compilation &C, const JobAction &JA,
153153
// AddRunTimeLibs).
154154
if (D.IsFlangMode() &&
155155
!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
156-
addFortranRuntimeLibraryPath(ToolChain, Args, CmdArgs);
157-
addFortranRuntimeLibs(ToolChain, Args, CmdArgs);
156+
ToolChain.addFortranRuntimeLibraryPath(Args, CmdArgs);
157+
ToolChain.addFortranRuntimeLibs(Args, CmdArgs);
158158
CmdArgs.push_back("-lm");
159159
}
160160

clang/lib/Driver/ToolChains/FreeBSD.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
319319
// AddRunTimeLibs).
320320
if (D.IsFlangMode() &&
321321
!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
322-
addFortranRuntimeLibraryPath(ToolChain, Args, CmdArgs);
323-
addFortranRuntimeLibs(ToolChain, Args, CmdArgs);
322+
ToolChain.addFortranRuntimeLibraryPath(Args, CmdArgs);
323+
ToolChain.addFortranRuntimeLibs(Args, CmdArgs);
324324
if (Profiling)
325325
CmdArgs.push_back("-lm_p");
326326
else

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,8 +572,8 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
572572
// AddRunTimeLibs).
573573
if (D.IsFlangMode() &&
574574
!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
575-
addFortranRuntimeLibraryPath(ToolChain, Args, CmdArgs);
576-
addFortranRuntimeLibs(ToolChain, Args, CmdArgs);
575+
ToolChain.addFortranRuntimeLibraryPath(Args, CmdArgs);
576+
ToolChain.addFortranRuntimeLibs(Args, CmdArgs);
577577
CmdArgs.push_back("-lm");
578578
}
579579

clang/lib/Driver/ToolChains/Haiku.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ void haiku::Linker::ConstructJob(Compilation &C, const JobAction &JA,
123123
// AddRunTimeLibs).
124124
if (D.IsFlangMode() &&
125125
!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
126-
addFortranRuntimeLibraryPath(ToolChain, Args, CmdArgs);
127-
addFortranRuntimeLibs(ToolChain, Args, CmdArgs);
126+
ToolChain.addFortranRuntimeLibraryPath(Args, CmdArgs);
127+
ToolChain.addFortranRuntimeLibs(Args, CmdArgs);
128128
}
129129

130130
if (NeedsSanitizerDeps)

clang/lib/Driver/ToolChains/MSVC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
146146

147147
if (C.getDriver().IsFlangMode() &&
148148
!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
149-
addFortranRuntimeLibraryPath(TC, Args, CmdArgs);
150-
addFortranRuntimeLibs(TC, Args, CmdArgs);
149+
TC.addFortranRuntimeLibraryPath(Args, CmdArgs);
150+
TC.addFortranRuntimeLibs(Args, CmdArgs);
151151

152152
// Inform the MSVC linker that we're generating a console application, i.e.
153153
// one with `main` as the "user-defined" entry point. The `main` function is

0 commit comments

Comments
 (0)