diff options
author | Simon Atanasyan <satanasyan@mips.com> | 2012-10-03 17:46:38 +0000 |
---|---|---|
committer | Simon Atanasyan <satanasyan@mips.com> | 2012-10-03 17:46:38 +0000 |
commit | f8d9bd546811a56ebb0b581ce4cc6043b51659a1 (patch) | |
tree | 2c2c137df03905aa16912c6c0f65cf58563420f2 /lib/Driver/ToolChains.cpp | |
parent | f2a2daebb4d76fe77b79c9bc1343a3f67a4b77d9 (diff) |
Implement Adnroid MIPS toolchain support:
1. Add mipsel-linux-android to the list of valid MIPS target triples.
2. Add <gcc install path>/mips-r2 to the list of toolchain specific path
prefixes if target is mipsel-linux-android.
The patch reviewed by Logan Chien.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165131 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains.cpp')
-rw-r--r-- | lib/Driver/ToolChains.cpp | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 81f388781a..27375de27d 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -1193,7 +1193,10 @@ Generic_GCC::GCCInstallationDetector::GCCInstallationDetector( static const char *const MIPSLibDirs[] = { "/lib" }; static const char *const MIPSTriples[] = { "mips-linux-gnu" }; static const char *const MIPSELLibDirs[] = { "/lib" }; - static const char *const MIPSELTriples[] = { "mipsel-linux-gnu" }; + static const char *const MIPSELTriples[] = { + "mipsel-linux-gnu", + "mipsel-linux-android" + }; static const char *const MIPS64LibDirs[] = { "/lib64", "/lib" }; static const char *const MIPS64Triples[] = { "mips64-linux-gnu" }; @@ -2079,6 +2082,25 @@ static bool isMipsArch(llvm::Triple::ArchType Arch) { Arch == llvm::Triple::mips64el; } +static bool isMipsR2Arch(llvm::Triple::ArchType Arch, + const ArgList &Args) { + if (Arch != llvm::Triple::mips && + Arch != llvm::Triple::mipsel) + return false; + + Arg *A = Args.getLastArg(options::OPT_march_EQ, + options::OPT_mcpu_EQ, + options::OPT_mips_CPUs_Group); + + if (!A) + return false; + + if (A->getOption().matches(options::OPT_mips_CPUs_Group)) + return A->getOption().matches(options::OPT_mips32r2); + + return A->getValue(Args) == StringRef("mips32r2"); +} + static StringRef getMultilibDir(const llvm::Triple &Triple, const ArgList &Args) { if (!isMipsArch(Triple.getArch())) @@ -2160,9 +2182,16 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) if (GCCInstallation.isValid()) { const llvm::Triple &GCCTriple = GCCInstallation.getTriple(); const std::string &LibPath = GCCInstallation.getParentLibPath(); - addPathIfExists((GCCInstallation.getInstallPath() + - GCCInstallation.getMultiarchSuffix()), - Paths); + + if (IsAndroid && isMipsR2Arch(Triple.getArch(), Args)) + addPathIfExists(GCCInstallation.getInstallPath() + + GCCInstallation.getMultiarchSuffix() + + "/mips-r2", + Paths); + else + addPathIfExists((GCCInstallation.getInstallPath() + + GCCInstallation.getMultiarchSuffix()), + Paths); // If the GCC installation we found is inside of the sysroot, we want to // prefer libraries installed in the parent prefix of the GCC installation. |