Author: cbieneman Date: Thu Nov 19 18:19:21 2015 New Revision: 253625 URL: http://llvm.org/viewvc/llvm-project?rev=253625&view=rev Log: 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 Modified: cfe/trunk/lib/Driver/ToolChains.cpp Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=253625&r1=253624&r2=253625&view=diff ============================================================================== --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Nov 19 18:19:21 2015 @@ -323,21 +323,35 @@ void Darwin::addProfileRTLibs(const ArgL 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; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits