Index: include/clang/Driver/ToolChain.h =================================================================== --- include/clang/Driver/ToolChain.h +++ include/clang/Driver/ToolChain.h @@ -108,6 +108,10 @@ static void addSystemInclude(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path); + static void + addSystemIncludeIfExists(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args, + const Twine &Path); static void addExternCSystemInclude(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path); Index: lib/Driver/ToolChain.cpp =================================================================== --- lib/Driver/ToolChain.cpp +++ lib/Driver/ToolChain.cpp @@ -585,6 +585,14 @@ CC1Args.push_back(DriverArgs.MakeArgString(Path)); } +void ToolChain::addSystemIncludeIfExists(const ArgList &DriverArgs, + ArgStringList &CC1Args, + const Twine &Path) { + if (llvm::sys::fs::exists(Path)) + addSystemInclude(DriverArgs, CC1Args, Path); +} + + /// \brief Utility function to add a system include directory with extern "C" /// semantics to CC1 arguments. /// Index: lib/Driver/ToolChains.h =================================================================== --- lib/Driver/ToolChains.h +++ lib/Driver/ToolChains.h @@ -78,6 +78,7 @@ class GCCInstallationDetector { bool IsValid; llvm::Triple GCCTriple; + llvm::Triple TargetTriple; const Driver &D; // FIXME: These might be better as path objects. @@ -99,6 +100,9 @@ /// The set of multilibs that the detected installation supports. MultilibSet Multilibs; + /// Optional lib subdirectories for SubArchTypes. + SmallVector CandidateSubLibDirs; + public: explicit GCCInstallationDetector(const Driver &D) : IsValid(false), D(D) {} void init(const llvm::Triple &TargetTriple, const llvm::opt::ArgList &Args, @@ -110,12 +114,18 @@ /// \brief Get the GCC triple for the detected install. const llvm::Triple &getTriple() const { return GCCTriple; } + /// \brief Get the GCC target triple for this compilation. + const llvm::Triple &getTargetTriple() const { return TargetTriple; } + /// \brief Get the detected GCC installation path. StringRef getInstallPath() const { return GCCInstallPath; } /// \brief Get the detected GCC parent lib path. StringRef getParentLibPath() const { return GCCParentLibPath; } + /// \brief Get the SubArchType subdirectories under lib. + const SmallVectorImpl &getSubLibs() { return CandidateSubLibDirs; } + /// \brief Get the detected Multilib const Multilib &getMultilib() const { return SelectedMultilib; } @@ -134,9 +144,16 @@ private: static void + CollectSubLibDirs(const llvm::Triple &Triple, + const llvm::opt::ArgList &Args, + SmallVectorImpl &SubLibDirs); + + static void CollectLibDirsAndTriples(const llvm::Triple &TargetTriple, const llvm::Triple &BiarchTriple, + const llvm::opt::ArgList &Args, SmallVectorImpl &LibDirs, + SmallVectorImpl &SubLibDirs, SmallVectorImpl &TripleAliases, SmallVectorImpl &BiarchLibDirs, SmallVectorImpl &BiarchTripleAliases); @@ -223,7 +240,13 @@ /// \brief Check whether the target triple's architecture is 32-bits. bool isTarget32Bit() const { return getTriple().isArch32Bit(); } + void addSystemIncludeWithSubArchDir(StringRef SubArchDir, + const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args, + Twine Path) const; + bool addLibStdCXXIncludePaths(Twine Base, Twine Suffix, StringRef GCCTriple, + StringRef SubArchDir, StringRef GCCMultiarchTriple, StringRef TargetMultiarchTriple, Twine IncludeSuffix, @@ -815,6 +838,8 @@ void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override; + StringRef GetClangCXXStdlibSubArchIncludeDir( + const llvm::opt::ArgList &DriverArgs) const; void AddClangCXXStdlibIncludeArgs( const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override; Index: lib/Driver/ToolChains.cpp =================================================================== --- lib/Driver/ToolChains.cpp +++ lib/Driver/ToolChains.cpp @@ -1378,6 +1378,7 @@ void Generic_GCC::GCCInstallationDetector::init( const llvm::Triple &TargetTriple, const ArgList &Args, ArrayRef ExtraTripleAliases) { + this->TargetTriple = TargetTriple; llvm::Triple BiarchVariantTriple = TargetTriple.isArch32Bit() ? TargetTriple.get64BitArchVariant() : TargetTriple.get32BitArchVariant(); @@ -1386,7 +1387,8 @@ // The compatible GCC triples for this particular architecture. SmallVector CandidateTripleAliases; SmallVector CandidateBiarchTripleAliases; - CollectLibDirsAndTriples(TargetTriple, BiarchVariantTriple, CandidateLibDirs, + CollectLibDirsAndTriples(TargetTriple, BiarchVariantTriple, Args, + CandidateLibDirs, CandidateSubLibDirs, CandidateTripleAliases, CandidateBiarchLibDirs, CandidateBiarchTripleAliases); @@ -1471,9 +1473,55 @@ return false; } +/*static*/ void Generic_GCC::GCCInstallationDetector::CollectSubLibDirs( + const llvm::Triple &Triple, const ArgList &Args, + SmallVectorImpl &SubLibDirs) { + // Recognize only thumb and armv7 types for now. + static const char *const ARMThumbLibDirs[] = {"/thumb"}; + static const char *const ARMV7aLibDirs[] = {"/armv7-a"}; + static const char *const ARMV7aThumbLibDirs[] = { + "/armv7-a/thumb", "/armv7-a"}; + using std::begin; + using std::end; + llvm::StringRef Arch = Args.getLastArgValue(options::OPT_march_EQ); + bool Thumb = Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, false); + if (Arch == "armv7" || Arch == "armv7-a" || Arch == "armv7a") { + if (Thumb) + SubLibDirs.append(begin(ARMV7aThumbLibDirs), end(ARMV7aThumbLibDirs)); + else + SubLibDirs.append(begin(ARMV7aLibDirs), end(ARMV7aLibDirs)); + return; + } + if (Arch == "thumb") { + SubLibDirs.append(begin(ARMThumbLibDirs), end(ARMThumbLibDirs)); + return; + } + switch (Triple.getArch()) { + case llvm::Triple::thumb: + SubLibDirs.append(begin(ARMThumbLibDirs), end(ARMThumbLibDirs)); + break; + case llvm::Triple::arm: + if (Triple.getSubArch() == llvm::Triple::ARMSubArch_v7 && Arch == "") { + if (Thumb) + SubLibDirs.append(begin(ARMV7aThumbLibDirs), end(ARMV7aThumbLibDirs)); + else + SubLibDirs.append(begin(ARMV7aLibDirs), end(ARMV7aLibDirs)); + } else { + if (Thumb) + SubLibDirs.append(begin(ARMThumbLibDirs), end(ARMThumbLibDirs)); + } + break; + default: + break; + } +} + /*static*/ void Generic_GCC::GCCInstallationDetector::CollectLibDirsAndTriples( - const llvm::Triple &TargetTriple, const llvm::Triple &BiarchTriple, + const llvm::Triple &TargetTriple, + const llvm::Triple &BiarchTriple, + const ArgList &Args, SmallVectorImpl &LibDirs, + SmallVectorImpl &SubLibDirs, SmallVectorImpl &TripleAliases, SmallVectorImpl &BiarchLibDirs, SmallVectorImpl &BiarchTripleAliases) { @@ -1587,6 +1635,7 @@ break; case llvm::Triple::arm: case llvm::Triple::thumb: + CollectSubLibDirs(TargetTriple, Args, SubLibDirs); LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs)); if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) { TripleAliases.append(begin(ARMHFTriples), end(ARMHFTriples)); @@ -2543,9 +2592,19 @@ } } +/// \brief Helper to add system include path with subarch directory suffix. +void Generic_GCC::addSystemIncludeWithSubArchDir( + StringRef SubArchDir, const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args, Twine Path) const { + if (SubArchDir != "") + addSystemIncludeIfExists(DriverArgs, CC1Args, Path + "/" + SubArchDir); + addSystemInclude(DriverArgs, CC1Args, Path); +} + /// \brief Helper to add the variant paths of a libstdc++ installation. bool Generic_GCC::addLibStdCXXIncludePaths( - Twine Base, Twine Suffix, StringRef GCCTriple, StringRef GCCMultiarchTriple, + Twine Base, Twine Suffix, StringRef GCCTriple, + StringRef SubArchDir, StringRef GCCMultiarchTriple, StringRef TargetMultiarchTriple, Twine IncludeSuffix, const ArgList &DriverArgs, ArgStringList &CC1Args) const { if (!getVFS().exists(Base + Suffix)) @@ -2558,18 +2617,19 @@ // this vanilla search path. if ((GCCMultiarchTriple.empty() && TargetMultiarchTriple.empty()) || getVFS().exists(Base + Suffix + "/" + GCCTriple + IncludeSuffix)) { - addSystemInclude(DriverArgs, CC1Args, - Base + Suffix + "/" + GCCTriple + IncludeSuffix); + addSystemIncludeWithSubArchDir( + SubArchDir, DriverArgs, CC1Args, + Base + Suffix + "/" + GCCTriple + IncludeSuffix); } else { // Otherwise try to use multiarch naming schemes which have normalized the // triples and put the triple before the suffix. // // GCC surprisingly uses *both* the GCC triple with a multilib suffix and // the target triple, so we support that here. - addSystemInclude(DriverArgs, CC1Args, - Base + "/" + GCCMultiarchTriple + Suffix + IncludeSuffix); - addSystemInclude(DriverArgs, CC1Args, - Base + "/" + TargetMultiarchTriple + Suffix); + addSystemIncludeWithSubArchDir(SubArchDir, DriverArgs, CC1Args, + Base + "/" + GCCMultiarchTriple + Suffix + IncludeSuffix); + addSystemIncludeWithSubArchDir(SubArchDir, DriverArgs, CC1Args, + Base + "/" + TargetMultiarchTriple + Suffix); } addSystemInclude(DriverArgs, CC1Args, Base + Suffix + "/backward"); @@ -3464,6 +3524,14 @@ Paths.push_back(Path.str()); } +static void addPathIfExists(const Driver &D, const Twine &Path, + const SmallVectorImpl &SubDirs, + ToolChain::path_list &Paths) { + for (const auto &Suffix : SubDirs) + addPathIfExists(D, Path + Suffix, Paths); + addPathIfExists(D, Path, Paths); +} + /// Solaris - Solaris tool chain which can call as(1) and ld(1) directly. Solaris::Solaris(const Driver &D, const llvm::Triple &Triple, @@ -3898,7 +3966,7 @@ // Sourcery CodeBench MIPS toolchain holds some libraries under // a biarch-like suffix of the GCC installation. addPathIfExists(D, GCCInstallation.getInstallPath() + Multilib.gccSuffix(), - Paths); + GCCInstallation.getSubLibs(), Paths); // GCC cross compiling toolchains will install target libraries which ship // as part of the toolchain under // rather than as @@ -3920,7 +3988,7 @@ // Clang diverges from GCC's behavior. addPathIfExists(D, LibPath + "/../" + GCCTriple.str() + "/lib/../" + OSLibDir + Multilib.osSuffix(), - Paths); + GCCInstallation.getSubLibs(), 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. @@ -4323,6 +4391,16 @@ return MaxVersion ? (base + "/" + MaxVersionString).str() : ""; } +StringRef Linux::GetClangCXXStdlibSubArchIncludeDir( + const ArgList &DriverArgs) const { + // Only recognize armv7-a for now. + llvm::StringRef Arch = DriverArgs.getLastArgValue(options::OPT_march_EQ); + if (Arch == "armv7" || Arch == "armv7-a" || Arch == "armv7a") + return "armv7-a"; + llvm::Triple::SubArchType SubArchType = GCCInstallation.getTargetTriple().getSubArch(); + return (SubArchType == llvm::Triple::ARMSubArch_v7) ? "armv7-a" : ""; +} + void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, ArgStringList &CC1Args) const { if (DriverArgs.hasArg(options::OPT_nostdlibinc) || @@ -4359,6 +4437,7 @@ StringRef LibDir = GCCInstallation.getParentLibPath(); StringRef InstallDir = GCCInstallation.getInstallPath(); StringRef TripleStr = GCCInstallation.getTriple().str(); + StringRef SubArchDir = GetClangCXXStdlibSubArchIncludeDir(DriverArgs); const Multilib &Multilib = GCCInstallation.getMultilib(); const std::string GCCMultiarchTriple = getMultiarchTriple( getDriver(), GCCInstallation.getTriple(), getDriver().SysRoot); @@ -4368,7 +4447,7 @@ // The primary search for libstdc++ supports multiarch variants. if (addLibStdCXXIncludePaths(LibDir.str() + "/../include", - "/c++/" + Version.Text, TripleStr, + "/c++/" + Version.Text, TripleStr, SubArchDir, GCCMultiarchTriple, TargetMultiarchTriple, Multilib.includeSuffix(), DriverArgs, CC1Args)) return; @@ -4391,6 +4470,7 @@ for (const auto &IncludePath : LibStdCXXIncludePathCandidates) { if (addLibStdCXXIncludePaths(IncludePath, /*Suffix*/ "", TripleStr, + /*SubArchDir*/ "", /*GCCMultiarchTriple*/ "", /*TargetMultiarchTriple*/ "", Multilib.includeSuffix(), DriverArgs, CC1Args)) @@ -4702,7 +4782,7 @@ addLibStdCXXIncludePaths( LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.Text, - "", TripleStr, "", "", Multilib.includeSuffix(), DriverArgs, CC1Args); + "", TripleStr, "", "", "", Multilib.includeSuffix(), DriverArgs, CC1Args); } // MyriadToolChain handles several triples: Index: test/Driver/android-standalone.cpp =================================================================== --- test/Driver/android-standalone.cpp +++ test/Driver/android-standalone.cpp @@ -7,28 +7,74 @@ // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ // RUN: | FileCheck %s // CHECK: {{.*}}clang{{.*}}" "-cc1" -// CHECK: "-internal-isystem" "{{.*}}/arm-linux-androideabi/include/c++/4.4.3" -// CHECK: "-internal-isystem" "{{.*}}/arm-linux-androideabi/include/c++/4.4.3/arm-linux-androideabi" +// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9" +// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a" +// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" +// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" +// CHECK: "-internal-isystem" "{{.*}}/sysroot/usr/local/include" +// CHECK: "-internal-isystem" "{{.*}}/lib/clang/{{[^/]*}}/include" // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/include" // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" // CHECK: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" -// CHECK: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.4.3" -// CHECK: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/lib" +// CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a" +// CHECK: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9" +// CHECK: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/lib" // CHECK: "-L{{.*}}/sysroot/usr/lib" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target armv7a-none-linux-androideabi -stdlib=libstdc++ \ +// RUN: -B%S/Inputs/basic_android_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-ARMV7 %s +// CHECK-ARMV7: {{.*}}clang{{.*}}" "-cc1" +// CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/4.9" +// CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a" +// CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" +// CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" +// CHECK-ARMV7: "-internal-isystem" "{{.*}}/sysroot/usr/local/include" +// CHECK-ARMV7: "-internal-isystem" "{{.*}}/lib/clang/{{[^/]*}}/include" +// CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/include" +// CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" +// CHECK-ARMV7: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-ARMV7: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a" +// CHECK-ARMV7: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9" +// CHECK-ARMV7: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/lib" +// CHECK-ARMV7: "-L{{.*}}/sysroot/usr/lib" +// +// Other flags that can trigger armv7 mode. +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-androideabi -stdlib=libstdc++ \ +// RUN: -march=armv7 \ +// RUN: -B%S/Inputs/basic_android_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-ARMV7 %s +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-androideabi -stdlib=libstdc++ \ +// RUN: -march=armv7a \ +// RUN: -B%S/Inputs/basic_android_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-ARMV7 %s +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-androideabi -stdlib=libstdc++ \ +// RUN: -march=armv7-a \ +// RUN: -B%S/Inputs/basic_android_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-ARMV7 %s +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target aarch64-linux-android -stdlib=libstdc++ \ // RUN: -B%S/Inputs/basic_android_tree \ // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-AARCH64 %s // CHECK-AARCH64: {{.*}}clang{{.*}}" "-cc1" -// CHECK-AARCH64: "-internal-isystem" "{{.*}}/aarch64-linux-android/include/c++/4.8" -// CHECK-AARCH64: "-internal-isystem" "{{.*}}/aarch64-linux-android/include/c++/4.8/aarch64-linux-android" +// CHECK-AARCH64: "-internal-isystem" "{{.*}}/include/c++/4.9" +// CHECK-AARCH64: "-internal-isystem" "{{.*}}/include/c++/4.9/aarch64-linux-android" +// CHECK-AARCH64: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" // CHECK-AARCH64: "-internal-externc-isystem" "{{.*}}/sysroot/include" // CHECK-AARCH64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" // CHECK-AARCH64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" -// CHECK-AARCH64: "-L{{.*}}/lib/gcc/aarch64-linux-android/4.8" -// CHECK-AARCH64: "-L{{.*}}/lib/gcc/aarch64-linux-android/4.8/../../../../aarch64-linux-android/lib" +// CHECK-AARCH64: "-L{{.*}}/lib/gcc/aarch64-linux-android/4.9" +// CHECK-AARCH64: "-L{{.*}}/lib/gcc/aarch64-linux-android/4.9/../../../../aarch64-linux-android/lib" // CHECK-AARCH64: "-L{{.*}}/sysroot/usr/lib" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ @@ -37,13 +83,14 @@ // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-ARM64 %s // CHECK-ARM64: {{.*}}clang{{.*}}" "-cc1" -// CHECK-ARM64: "-internal-isystem" "{{.*}}/aarch64-linux-android/include/c++/4.8" -// CHECK-ARM64: "-internal-isystem" "{{.*}}/aarch64-linux-android/include/c++/4.8/aarch64-linux-android" +// CHECK-ARM64: "-internal-isystem" "{{.*}}/include/c++/4.9" +// CHECK-ARM64: "-internal-isystem" "{{.*}}/include/c++/4.9/aarch64-linux-android" +// CHECK-ARM64: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" // CHECK-ARM64: "-internal-externc-isystem" "{{.*}}/sysroot/include" // CHECK-ARM64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" // CHECK-ARM64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" -// CHECK-ARM64: "-L{{.*}}/lib/gcc/aarch64-linux-android/4.8" -// CHECK-ARM64: "-L{{.*}}/lib/gcc/aarch64-linux-android/4.8/../../../../aarch64-linux-android/lib" +// CHECK-ARM64: "-L{{.*}}/lib/gcc/aarch64-linux-android/4.9" +// CHECK-ARM64: "-L{{.*}}/lib/gcc/aarch64-linux-android/4.9/../../../../aarch64-linux-android/lib" // CHECK-ARM64: "-L{{.*}}/sysroot/usr/lib" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ @@ -53,13 +100,14 @@ // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-MIPS %s // CHECK-MIPS: {{.*}}clang{{.*}}" "-cc1" -// CHECK-MIPS: "-internal-isystem" "{{.*}}/mipsel-linux-android/include/c++/4.4.3" -// CHECK-MIPS: "-internal-isystem" "{{.*}}/mipsel-linux-android/include/c++/4.4.3/mipsel-linux-android" +// CHECK-MIPS: "-internal-isystem" "{{.*}}/include/c++/4.9" +// CHECK-MIPS: "-internal-isystem" "{{.*}}/include/c++/4.9/mipsel-linux-android" +// CHECK-MIPS: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" // CHECK-MIPS: "-internal-externc-isystem" "{{.*}}/sysroot/include" // CHECK-MIPS: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" // CHECK-MIPS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" -// CHECK-MIPS: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.4.3" -// CHECK-MIPS: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.4.3/../../../../mipsel-linux-android/lib" +// CHECK-MIPS: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.9" +// CHECK-MIPS: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.9/../../../../mipsel-linux-android/lib" // CHECK-MIPS: "-L{{.*}}/sysroot/usr/lib" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ @@ -69,43 +117,48 @@ // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-MIPSR2 %s // CHECK-MIPSR2: {{.*}}clang{{.*}}" "-cc1" -// CHECK-MIPSR2: "-internal-isystem" "{{.*}}/mipsel-linux-android/include/c++/4.4.3" -// CHECK-MIPSR2: "-internal-isystem" "{{.*}}/mipsel-linux-android/include/c++/4.4.3/mipsel-linux-android" +// CHECK-MIPSR2: "-internal-isystem" "{{.*}}/include/c++/4.9" +// NOT-YET-CHECK-MIPSR2: "-internal-isystem" "{{.*}}/include/c++/4.9/mipsel-linux-android/mips-r2" +// CHECK-MIPSR2: "-internal-isystem" "{{.*}}/include/c++/4.9/mipsel-linux-android" +// CHECK-MIPSR2: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" // CHECK-MIPSR2: "-internal-externc-isystem" "{{.*}}/sysroot/include" // CHECK-MIPSR2: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" // CHECK-MIPSR2: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" -// CHECK-MIPSR2: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.4.3/mips-r2" -// CHECK-MIPSR2: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.4.3/../../../../mipsel-linux-android/lib" +// CHECK-MIPSR2: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.9/mips-r2" +// CHECK-MIPSR2: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.9/../../../../mipsel-linux-android/lib" // CHECK-MIPSR2: "-L{{.*}}/sysroot/usr/lib" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target mipsel-linux-android \ -// RUN: -mips32 -march=mips32r2 -stdlib=libstdc++ \ -// RUN: -B%S/Inputs/basic_android_tree \ -// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ -// RUN: | FileCheck --check-prefix=CHECK-MIPSR2-A %s -// CHECK-MIPSR2-A: {{.*}}clang{{.*}}" "-cc1" -// CHECK-MIPSR2-A: "-internal-isystem" "{{.*}}/mipsel-linux-android/include/c++/4.4.3" -// CHECK-MIPSR2-A: "-internal-isystem" "{{.*}}/mipsel-linux-android/include/c++/4.4.3/mipsel-linux-android" -// CHECK-MIPSR2-A: "-internal-externc-isystem" "{{.*}}/sysroot/include" -// CHECK-MIPSR2-A: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" -// CHECK-MIPSR2-A: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" -// CHECK-MIPSR2-A: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.4.3/mips-r2" -// CHECK-MIPSR2-A: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.4.3/../../../../mipsel-linux-android/lib" -// CHECK-MIPSR2-A: "-L{{.*}}/sysroot/usr/lib" -// -// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target mipsel-linux-android \ // RUN: -mips32r6 -stdlib=libstdc++ \ // RUN: -B%S/Inputs/basic_android_tree \ // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-MIPSR6 %s // CHECK-MIPSR6: {{.*}}clang{{.*}}" "-cc1" -// CHECK-MIPSR6: "-internal-isystem" "{{.*}}/mipsel-linux-android/include/c++/4.4.3" -// CHECK-MIPSR6: "-internal-isystem" "{{.*}}/mipsel-linux-android/include/c++/4.4.3/mipsel-linux-android" +// CHECK-MIPSR6: "-internal-isystem" "{{.*}}/include/c++/4.9" +// NOT-YET-CHECK-MIPSR6: "-internal-isystem" "{{.*}}/include/c++/4.9/mipsel-linux-android/mips-r6" +// CHECK-MIPSR6: "-internal-isystem" "{{.*}}/include/c++/4.9/mipsel-linux-android" +// CHECK-MIPSR6: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" // CHECK-MIPSR6: "-internal-externc-isystem" "{{.*}}/sysroot/include" // CHECK-MIPSR6: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" // CHECK-MIPSR6: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" -// CHECK-MIPSR6: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.4.3/mips-r6" -// CHECK-MIPSR6: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.4.3/../../../../mipsel-linux-android/lib" +// CHECK-MIPSR6: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.9/mips-r6" +// CHECK-MIPSR6: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.9/../../../../mipsel-linux-android/lib" // CHECK-MIPSR6: "-L{{.*}}/sysroot/usr/lib" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target i686-linux-android \ +// RUN: -stdlib=libstdc++ \ +// RUN: -B%S/Inputs/basic_android_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-I686 %s +// CHECK-I686: {{.*}}clang{{.*}}" "-cc1" +// CHECK-I686: "-internal-isystem" "{{.*}}/include/c++/4.9" +// CHECK-I686: "-internal-isystem" "{{.*}}/include/c++/4.9/i686-linux-android" +// CHECK-I686: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" +// CHECK-I686: "-internal-externc-isystem" "{{.*}}/sysroot/include" +// CHECK-I686: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" +// CHECK-I686: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-I686: "-L{{.*}}/lib/gcc/i686-linux-android/4.9" +// CHECK-I686: "-L{{.*}}/lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/lib" +// CHECK-I686: "-L{{.*}}/sysroot/usr/lib" Index: test/Driver/fuse-ld.c =================================================================== --- test/Driver/fuse-ld.c +++ test/Driver/fuse-ld.c @@ -54,16 +54,16 @@ // RUN: -target arm-linux-androideabi \ // RUN: -gcc-toolchain %S/Inputs/basic_android_tree 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-ANDROID-ARM-LD-TC -// CHECK-ANDROID-ARM-LD-TC: Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin{{/|\\+}}ld +// CHECK-ANDROID-ARM-LD-TC: Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin{{/|\\+}}ld // RUN: %clang %s -### -fuse-ld=bfd \ // RUN: -target arm-linux-androideabi \ // RUN: -gcc-toolchain %S/Inputs/basic_android_tree 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-ANDROID-ARM-BFD-TC -// CHECK-ANDROID-ARM-BFD-TC: Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin{{/|\\+}}ld.bfd +// CHECK-ANDROID-ARM-BFD-TC: Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin{{/|\\+}}ld.bfd // RUN: %clang %s -### -fuse-ld=gold \ // RUN: -target arm-linux-androideabi \ // RUN: -gcc-toolchain %S/Inputs/basic_android_tree 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-ANDROID-ARM-GOLD-TC -// CHECK-ANDROID-ARM-GOLD-TC: Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin{{/|\\+}}ld.gold +// CHECK-ANDROID-ARM-GOLD-TC: Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin{{/|\\+}}ld.gold