mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Revert "Revert "Look up runtime libraries in SDK""
This commit is contained in:
committed by
GitHub
parent
8221c6735c
commit
1e81ced48d
@@ -102,28 +102,26 @@ toolchains::Windows::constructInvocation(const DynamicLinkJobAction &job,
|
||||
// driver rather than the `clang-cl` driver.
|
||||
Arguments.push_back("-nostartfiles");
|
||||
|
||||
SmallString<128> SharedRuntimeLibPath;
|
||||
getRuntimeLibraryPath(SharedRuntimeLibPath, context.Args,
|
||||
/*Shared=*/true);
|
||||
bool wantsStaticStdlib =
|
||||
context.Args.hasFlag(options::OPT_static_stdlib,
|
||||
options::OPT_no_static_stdlib, false);
|
||||
|
||||
// Link the standard library.
|
||||
Arguments.push_back("-L");
|
||||
if (context.Args.hasFlag(options::OPT_static_stdlib,
|
||||
options::OPT_no_static_stdlib, false)) {
|
||||
SmallString<128> StaticRuntimeLibPath;
|
||||
getRuntimeLibraryPath(StaticRuntimeLibPath, context.Args,
|
||||
/*Shared=*/false);
|
||||
SmallVector<std::string, 4> RuntimeLibPaths;
|
||||
getRuntimeLibraryPaths(RuntimeLibPaths, context.Args, context.OI.SDKPath,
|
||||
/*Shared=*/!wantsStaticStdlib);
|
||||
|
||||
for (auto path : RuntimeLibPaths) {
|
||||
Arguments.push_back("-L");
|
||||
// Since Windows has separate libraries per architecture, link against the
|
||||
// architecture specific version of the static library.
|
||||
Arguments.push_back(context.Args.MakeArgString(StaticRuntimeLibPath + "/" +
|
||||
getTriple().getArchName()));
|
||||
} else {
|
||||
Arguments.push_back(context.Args.MakeArgString(SharedRuntimeLibPath + "/" +
|
||||
Arguments.push_back(context.Args.MakeArgString(path + "/" +
|
||||
getTriple().getArchName()));
|
||||
}
|
||||
|
||||
SmallString<128> swiftrtPath = SharedRuntimeLibPath;
|
||||
SmallString<128> SharedResourceDirPath;
|
||||
getResourceDirPath(SharedResourceDirPath, context.Args, /*Shared=*/true);
|
||||
|
||||
SmallString<128> swiftrtPath = SharedResourceDirPath;
|
||||
llvm::sys::path::append(swiftrtPath,
|
||||
swift::getMajorArchitectureName(getTriple()));
|
||||
llvm::sys::path::append(swiftrtPath, "swiftrt.obj");
|
||||
@@ -158,7 +156,7 @@ toolchains::Windows::constructInvocation(const DynamicLinkJobAction &job,
|
||||
}
|
||||
|
||||
if (context.Args.hasArg(options::OPT_profile_generate)) {
|
||||
SmallString<128> LibProfile(SharedRuntimeLibPath);
|
||||
SmallString<128> LibProfile(SharedResourceDirPath);
|
||||
llvm::sys::path::remove_filename(LibProfile); // remove platform name
|
||||
llvm::sys::path::append(LibProfile, "clang", "lib");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user