From 9b80314d79b91546b8fca9842007185567ca4caf Mon Sep 17 00:00:00 2001 From: Renato Golin Date: Fri, 31 Jan 2014 11:47:28 +0000 Subject: [PATCH] ARM RT libs with generic name git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200538 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Tools.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 002bc2247e..0be232f15c 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1726,6 +1726,14 @@ static void CollectArgsForIntegratedAssembler(Compilation &C, } } +// Until ARM libraries are build separately, we have them all in one library +static StringRef getArchNameForCompilerRTLib(const ToolChain &TC) { + if (TC.getArch() == llvm::Triple::arm) + return "arm"; + else + return TC.getArchName(); +} + static void addProfileRTLinux( const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs) { if (!(Args.hasArg(options::OPT_fprofile_arcs) || @@ -1740,7 +1748,7 @@ static void addProfileRTLinux( SmallString<128> LibProfile(TC.getDriver().ResourceDir); llvm::sys::path::append( LibProfile, "lib", "linux", - Twine("libclang_rt.profile-") + TC.getArchName() + ".a"); + Twine("libclang_rt.profile-") + getArchNameForCompilerRTLib(TC) + ".a"); CmdArgs.push_back(Args.MakeArgString(LibProfile)); } @@ -1754,7 +1762,8 @@ static void addSanitizerRTLinkFlagsLinux( SmallString<128> LibSanitizer(TC.getDriver().ResourceDir); llvm::sys::path::append( LibSanitizer, "lib", "linux", - (Twine("libclang_rt.") + Sanitizer + "-" + TC.getArchName() + ".a")); + (Twine("libclang_rt.") + Sanitizer + "-" + + getArchNameForCompilerRTLib(TC) + ".a")); // Sanitizer runtime may need to come before -lstdc++ (or -lc++, libstdc++.a, // etc.) so that the linker picks custom versions of the global 'operator @@ -1795,7 +1804,7 @@ static void addAsanRTLinux(const ToolChain &TC, const ArgList &Args, SmallString<128> LibAsan(TC.getDriver().ResourceDir); llvm::sys::path::append(LibAsan, "lib", "linux", (Twine("libclang_rt.asan-") + - TC.getArchName() + "-android.so")); + getArchNameForCompilerRTLib(TC) + "-android.so")); CmdArgs.insert(CmdArgs.begin(), Args.MakeArgString(LibAsan)); } else { if (!Args.hasArg(options::OPT_shared)) -- 2.40.0