diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-09-03 09:05:50 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-09-03 09:05:50 +0000 |
commit | 1d01afe4d5883d7ec538b739aa7922d7de46f192 (patch) | |
tree | 5477b43c428dc6c5850bb5aa9e3586373578e0fb /lib/Driver/ToolChains.cpp | |
parent | 7065c52fc53ec3106a97b7c8d373df431f3bd4f3 (diff) |
Android standalone toolchain support.
This change adds detection of C++ headers and libraries paths when
building with the standalone toolchain from Android NDK. They are in a
slightly unusual place.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163109 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains.cpp')
-rw-r--r-- | lib/Driver/ToolChains.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 5648951396..8876d95d80 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -2124,6 +2124,11 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) addPathIfExists(LibPath + "/" + MultiarchTriple, Paths); addPathIfExists(LibPath + "/../" + Multilib, Paths); } + // On Android, libraries in the parent prefix of the GCC installation are + // preferred to the ones under sysroot. + if (IsAndroid) { + addPathIfExists(LibPath + "/../" + GCCTriple.str() + "/lib", Paths); + } } addPathIfExists(SysRoot + "/lib/" + MultiarchTriple, Paths); addPathIfExists(SysRoot + "/lib/../" + Multilib, Paths); @@ -2342,16 +2347,22 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, StringRef LibDir = GCCInstallation.getParentLibPath(); StringRef InstallDir = GCCInstallation.getInstallPath(); StringRef Version = GCCInstallation.getVersion().Text; - if (!addLibStdCXXIncludePaths(LibDir + "/../include/c++/" + Version, - (GCCInstallation.getTriple().str() + - GCCInstallation.getMultiarchSuffix()), - DriverArgs, CC1Args)) { + StringRef TripleStr = GCCInstallation.getTriple().str(); + + const std::string IncludePathCandidates[] = { + LibDir.str() + "/../include/c++/" + Version.str(), // Gentoo is weird and places its headers inside the GCC install, so if the // first attempt to find the headers fails, try this pattern. - addLibStdCXXIncludePaths(InstallDir + "/include/g++-v4", - (GCCInstallation.getTriple().str() + - GCCInstallation.getMultiarchSuffix()), - DriverArgs, CC1Args); + InstallDir.str() + "/include/g++-v4", + // Android standalone toolchain has C++ headers in yet another place. + LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.str(), + }; + + for (unsigned i = 0; i < llvm::array_lengthof(IncludePathCandidates); ++i) { + if (addLibStdCXXIncludePaths(IncludePathCandidates[i], (TripleStr + + GCCInstallation.getMultiarchSuffix()), + DriverArgs, CC1Args)) + break; } } |