Index: cfe/trunk/lib/Driver/ToolChains.cpp =================================================================== --- cfe/trunk/lib/Driver/ToolChains.cpp +++ cfe/trunk/lib/Driver/ToolChains.cpp @@ -1790,6 +1790,10 @@ Flags.push_back(std::string("-") + Flag); } +static bool isArmOrThumbArch(llvm::Triple::ArchType Arch) { + return Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb; +} + static bool isMipsArch(llvm::Triple::ArchType Arch) { return Arch == llvm::Triple::mips || Arch == llvm::Triple::mipsel || Arch == llvm::Triple::mips64 || Arch == llvm::Triple::mips64el; @@ -2313,6 +2317,48 @@ return false; } +static void findAndroidArmMultilibs(const Driver &D, + const llvm::Triple &TargetTriple, + StringRef Path, const ArgList &Args, + DetectedMultilibs &Result) { + // Find multilibs with subdirectories like armv7-a, thumb, armv7-a/thumb. + FilterNonExistent NonExistent(Path, D.getVFS()); + Multilib ArmV7Multilib = makeMultilib("/armv7-a") + .flag("+armv7") + .flag("-thumb"); + Multilib ThumbMultilib = makeMultilib("/thumb") + .flag("-armv7") + .flag("+thumb"); + Multilib ArmV7ThumbMultilib = makeMultilib("/armv7-a/thumb") + .flag("+armv7") + .flag("+thumb"); + Multilib DefaultMultilib = makeMultilib("") + .flag("-armv7") + .flag("-thumb"); + MultilibSet AndroidArmMultilibs = + MultilibSet() + .Either(ThumbMultilib, ArmV7Multilib, + ArmV7ThumbMultilib, DefaultMultilib) + .FilterOut(NonExistent); + + Multilib::flags_list Flags; + llvm::StringRef Arch = Args.getLastArgValue(options::OPT_march_EQ); + bool IsArmArch = TargetTriple.getArch() == llvm::Triple::arm; + bool IsThumbArch = TargetTriple.getArch() == llvm::Triple::thumb; + bool IsV7SubArch = TargetTriple.getSubArch() == llvm::Triple::ARMSubArch_v7; + bool IsThumbMode = IsThumbArch || + Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, false) || + (IsArmArch && llvm::ARM::parseArchISA(Arch) == llvm::ARM::IK_THUMB); + bool IsArmV7Mode = (IsArmArch || IsThumbArch) && + (llvm::ARM::parseArchVersion(Arch) == 7 || + (IsArmArch && Arch == "" && IsV7SubArch)); + addMultilibFlag(IsArmV7Mode, "armv7", Flags); + addMultilibFlag(IsThumbMode, "thumb", Flags); + + if (AndroidArmMultilibs.select(Flags, Result.SelectedMultilib)) + Result.Multilibs = AndroidArmMultilibs; +} + static bool findBiarchMultilibs(const Driver &D, const llvm::Triple &TargetTriple, StringRef Path, const ArgList &Args, @@ -2504,9 +2550,13 @@ DetectedMultilibs Detected; + // Android standalone toolchain could have multilibs for ARM and Thumb. // Debian mips multilibs behave more like the rest of the biarch ones, // so handle them there - if (isMipsArch(TargetArch)) { + if (isArmOrThumbArch(TargetArch) && TargetTriple.isAndroid()) { + // It should also work without multilibs in a simplified toolchain. + findAndroidArmMultilibs(D, TargetTriple, LI->getName(), Args, Detected); + } else if (isMipsArch(TargetArch)) { if (!findMIPSMultilibs(D, TargetTriple, LI->getName(), Args, Detected)) continue; } else if (!findBiarchMultilibs(D, TargetTriple, LI->getName(), Args, Index: cfe/trunk/test/Driver/android-ndk-standalone.cpp =================================================================== --- cfe/trunk/test/Driver/android-ndk-standalone.cpp +++ cfe/trunk/test/Driver/android-ndk-standalone.cpp @@ -0,0 +1,279 @@ +// Test header and library paths when Clang is used with Android standalone +// toolchain. +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-androideabi -stdlib=libstdc++ \ +// RUN: -B%S/Inputs/basic_android_ndk_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ +// RUN: | FileCheck %s +// CHECK: {{.*}}clang{{.*}}" "-cc1" +// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9" +// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb" +// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a" +// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" +// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" +// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb" +// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a" +// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" +// 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-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb" +// CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a" +// CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb" +// CHECK: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9" +// CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb" +// CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a" +// CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb" +// CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb" +// CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a" +// CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb" +// CHECK: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/arm-linux-androideabi/lib" +// CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb" +// CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a" +// CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb" +// 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_ndk_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-ARMV7 %s +// CHECK-ARMV7: {{.*}}clang{{.*}}" "-cc1" +// CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/4.9" +// CHECK-ARMV7-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb" +// CHECK-ARMV7-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" +// CHECK-ARMV7-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" +// CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a" +// CHECK-ARMV7-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb" +// CHECK-ARMV7-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" +// CHECK-ARMV7-NOT: "-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-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb" +// CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb" +// CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9" +// CHECK-ARMV7: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a" +// CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb" +// CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb" +// CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9" +// CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb" +// CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb" +// CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib" +// CHECK-ARMV7: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a" +// CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb" +// CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb" +// CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/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_ndk_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_ndk_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_ndk_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_ndk_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_ndk_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-ARMV7 %s +// +// ARM thumb mode. +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-androideabi -stdlib=libstdc++ \ +// RUN: -mthumb \ +// RUN: -B%S/Inputs/basic_android_ndk_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-THUMB %s +// CHECK-THUMB: {{.*}}clang{{.*}}" "-cc1" +// CHECK-THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9" +// CHECK-THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7/thumb" +// CHECK-THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7" +// CHECK-THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" +// CHECK-THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" +// CHECK-THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7/thumb" +// CHECK-THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7" +// CHECK-THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" +// CHECK-THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" +// CHECK-THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include" +// CHECK-THUMB: "-internal-isystem" "{{.*}}/lib/clang/{{[^/]*}}/include" +// CHECK-THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/include" +// CHECK-THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" +// CHECK-THUMB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb" +// CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a" +// CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9" +// CHECK-THUMB: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb" +// CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb" +// CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a" +// CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9" +// CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7" +// CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7/thumb" +// CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib" +// CHECK-THUMB: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb" +// CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7" +// CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7/thumb" +// CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib" +// CHECK-THUMB: "-L{{.*}}/sysroot/usr/lib" +// +// ARM V7 thumb mode. +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-androideabi -stdlib=libstdc++ \ +// RUN: -march=armv7-a -mthumb \ +// RUN: -B%S/Inputs/basic_android_ndk_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-ARMV7THUMB %s +// CHECK-ARMV7THUMB: {{.*}}clang{{.*}}" "-cc1" +// CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9" +// CHECK-ARMV7THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a" +// CHECK-ARMV7THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" +// CHECK-ARMV7THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" +// CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb" +// CHECK-ARMV7THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a" +// CHECK-ARMV7THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" +// CHECK-ARMV7THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" +// CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" +// CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include" +// CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/lib/clang/{{[^/]*}}/include" +// CHECK-ARMV7THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/include" +// CHECK-ARMV7THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" +// CHECK-ARMV7THUMB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb" +// CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a" +// CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9" +// CHECK-ARMV7THUMB: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb" +// CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb" +// CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a" +// CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9" +// CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb" +// CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a" +// CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib" +// CHECK-ARMV7THUMB: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb" +// CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb" +// CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a" +// CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib" +// CHECK-ARMV7THUMB: "-L{{.*}}/sysroot/usr/lib" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target armv7a-none-linux-androideabi -stdlib=libstdc++ \ +// RUN: -mthumb \ +// RUN: -B%S/Inputs/basic_android_ndk_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-ARMV7THUMB %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_ndk_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-AARCH64 %s +// CHECK-AARCH64: {{.*}}clang{{.*}}" "-cc1" +// 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.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 \ +// RUN: -target arm64-linux-android -stdlib=libstdc++ \ +// RUN: -B%S/Inputs/basic_android_ndk_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-ARM64 %s +// CHECK-ARM64: {{.*}}clang{{.*}}" "-cc1" +// 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.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 \ +// RUN: -target mipsel-linux-android \ +// RUN: -mips32 -stdlib=libstdc++ \ +// RUN: -B%S/Inputs/basic_android_ndk_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-MIPS %s +// CHECK-MIPS: {{.*}}clang{{.*}}" "-cc1" +// 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.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 \ +// RUN: -target mipsel-linux-android \ +// RUN: -march=mips32 -mips32r2 -stdlib=libstdc++ \ +// RUN: -B%S/Inputs/basic_android_ndk_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-MIPSR2 %s +// CHECK-MIPSR2: {{.*}}clang{{.*}}" "-cc1" +// 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.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: -mips32r6 -stdlib=libstdc++ \ +// RUN: -B%S/Inputs/basic_android_ndk_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-MIPSR6 %s +// CHECK-MIPSR6: {{.*}}clang{{.*}}" "-cc1" +// 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.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_ndk_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_ndk_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"