aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/ToolChain.cpp
diff options
context:
space:
mode:
authorMarkus Böck <markus.boeck02@gmail.com>2021-02-24 23:39:55 +0100
committerMarkus Böck <markus.boeck02@gmail.com>2021-02-24 23:40:20 +0100
commit9f1b832331e350426f7f2f8cc30ab8ba991f5884 (patch)
treec5f4d6f310e35d847d3f63602daa01abd882276b /clang/lib/Driver/ToolChain.cpp
parent341889ee9e03e73b313263c516b3d1fd33d4c4ba (diff)
downloadllvm-9f1b832331e350426f7f2f8cc30ab8ba991f5884.zip
llvm-9f1b832331e350426f7f2f8cc30ab8ba991f5884.tar.gz
llvm-9f1b832331e350426f7f2f8cc30ab8ba991f5884.tar.bz2
Reland "[Driver][Windows] Support per-target runtimes dir layout for profile instr generate"
This relands commit rG7f9d5d6e444c which was reverted in rGab5b00ada9e7 Differential Revision: https://reviews.llvm.org/D96638
Diffstat (limited to 'clang/lib/Driver/ToolChain.cpp')
-rw-r--r--clang/lib/Driver/ToolChain.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 372be61..3f50061 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -414,8 +414,16 @@ std::string ToolChain::getCompilerRTPath() const {
}
std::string ToolChain::getCompilerRTBasename(const ArgList &Args,
- StringRef Component, FileType Type,
- bool AddArch) const {
+ StringRef Component,
+ FileType Type) const {
+ std::string CRTAbsolutePath = getCompilerRT(Args, Component, Type);
+ return llvm::sys::path::filename(CRTAbsolutePath).str();
+}
+
+std::string ToolChain::buildCompilerRTBasename(const llvm::opt::ArgList &Args,
+ StringRef Component,
+ FileType Type,
+ bool AddArch) const {
const llvm::Triple &TT = getTriple();
bool IsITANMSVCWindows =
TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment();
@@ -431,8 +439,8 @@ std::string ToolChain::getCompilerRTBasename(const ArgList &Args,
Suffix = IsITANMSVCWindows ? ".lib" : ".a";
break;
case ToolChain::FT_Shared:
- Suffix = Triple.isOSWindows()
- ? (Triple.isWindowsGNUEnvironment() ? ".dll.a" : ".lib")
+ Suffix = TT.isOSWindows()
+ ? (TT.isWindowsGNUEnvironment() ? ".dll.a" : ".lib")
: ".so";
break;
}
@@ -450,7 +458,7 @@ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
FileType Type) const {
// Check for runtime files in the new layout without the architecture first.
std::string CRTBasename =
- getCompilerRTBasename(Args, Component, Type, /*AddArch=*/false);
+ buildCompilerRTBasename(Args, Component, Type, /*AddArch=*/false);
for (const auto &LibPath : getLibraryPaths()) {
SmallString<128> P(LibPath);
llvm::sys::path::append(P, CRTBasename);
@@ -460,7 +468,8 @@ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
// Fall back to the old expected compiler-rt name if the new one does not
// exist.
- CRTBasename = getCompilerRTBasename(Args, Component, Type, /*AddArch=*/true);
+ CRTBasename =
+ buildCompilerRTBasename(Args, Component, Type, /*AddArch=*/true);
SmallString<128> Path(getCompilerRTPath());
llvm::sys::path::append(Path, CRTBasename);
return std::string(Path.str());