summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChains.cpp
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2015-11-20 00:19:21 +0000
committerChris Bieneman <beanz@apple.com>2015-11-20 00:19:21 +0000
commit586d24bbf23ff9b29545952300f2fc70331f1f3d (patch)
treed13d9e34433e6bb6daa10cf26f9f9edd54cecbfc /clang/lib/Driver/ToolChains.cpp
parent49c9a6e802148ac3e3510cf3b69c8a0a0fc62b93 (diff)
downloadbcm5719-llvm-586d24bbf23ff9b29545952300f2fc70331f1f3d.tar.gz
bcm5719-llvm-586d24bbf23ff9b29545952300f2fc70331f1f3d.zip
Support CMake's clang_rt.profile library naming scheme
Summary: This code is a bit undesirable, but it gets clang to work with the autoconf and cmake-built libclang_rt.profile libraries. Reviewers: bogner Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D14847 llvm-svn: 253625
Diffstat (limited to 'clang/lib/Driver/ToolChains.cpp')
-rw-r--r--clang/lib/Driver/ToolChains.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index 8485d0fe945..5426abf60b8 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -323,21 +323,35 @@ void Darwin::addProfileRTLibs(const ArgList &Args,
ArgStringList &CmdArgs) const {
if (!needsProfileRT(Args)) return;
+ // TODO: Clean this up once autoconf is gone
+ SmallString<128> P(getDriver().ResourceDir);
+ llvm::sys::path::append(P, "lib", "darwin");
+ const char *Library = "libclang_rt.profile_osx.a";
+
// Select the appropriate runtime library for the target.
- if (isTargetWatchOSBased()) {
- AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.profile_watchos.a",
- /*AlwaysLink*/ true);
- } else if (isTargetTvOSBased()) {
- AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.profile_tvos.a",
- /*AlwaysLink*/ true);
- } else if (isTargetIOSBased()) {
- AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.profile_ios.a",
- /*AlwaysLink*/ true);
+ if (isTargetWatchOS()) {
+ Library = "libclang_rt.profile_watchos.a";
+ } else if (isTargetWatchOSSimulator()) {
+ llvm::sys::path::append(P, "libclang_rt.profile_watchossim.a");
+ Library = getVFS().exists(P) ? "libclang_rt.profile_watchossim.a"
+ : "libclang_rt.profile_watchos.a";
+ } else if (isTargetTvOS()) {
+ Library = "libclang_rt.profile_tvos.a";
+ } else if (isTargetTvOSSimulator()) {
+ llvm::sys::path::append(P, "libclang_rt.profile_tvossim.a");
+ Library = getVFS().exists(P) ? "libclang_rt.profile_tvossim.a"
+ : "libclang_rt.profile_tvos.a";
+ } else if (isTargetIPhoneOS()) {
+ Library = "libclang_rt.profile_ios.a";
+ } else if (isTargetIOSSimulator()) {
+ llvm::sys::path::append(P, "libclang_rt.profile_iossim.a");
+ Library = getVFS().exists(P) ? "libclang_rt.profile_iossim.a"
+ : "libclang_rt.profile_ios.a";
} else {
assert(isTargetMacOS() && "unexpected non MacOS platform");
- AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.profile_osx.a",
- /*AlwaysLink*/ true);
}
+ AddLinkRuntimeLib(Args, CmdArgs, Library,
+ /*AlwaysLink*/ true);
return;
}
OpenPOWER on IntegriCloud