1 // Test header and library paths when Clang is used with Android standalone
2 // toolchain.
3 //
4 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
5 // RUN:     -target arm-linux-androideabi21 \
6 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
7 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
8 // RUN:   | FileCheck  %s
9 // CHECK: {{.*}}clang{{.*}}" "-cc1"
10 // CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
11 // CHECK: "-internal-isystem" "{{.*}}/include/c++/v1"
12 // CHECK: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
13 // CHECK: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include"
14 // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/arm-linux-androideabi"
15 // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/include"
16 // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
17 // CHECK: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
18 // CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb"
19 // CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a"
20 // CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb"
21 // CHECK: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9"
22 // CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb"
23 // CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a"
24 // CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb"
25 // CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb"
26 // CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a"
27 // CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb"
28 // CHECK: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi/21"
29 // CHECK: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi"
30 // CHECK: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/arm-linux-androideabi/lib"
31 // CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb"
32 // CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a"
33 // CHECK-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb"
34 //
35 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
36 // RUN:     -target arm-linux-androideabi14 \
37 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
38 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
39 // RUN:   | FileCheck --check-prefix=CHECK-14 %s
40 // CHECK-14: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi/14"
41 // CHECK-14: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi"
42 //
43 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
44 // RUN:     -target arm-linux-androideabi21 -stdlib=libstdc++ \
45 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
46 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
47 // RUN:   | FileCheck --check-prefix=CHECK-STDCXX %s
48 // CHECK-STDCXX: {{.*}}clang{{.*}}" "-cc1"
49 // CHECK-STDCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
50 // CHECK-STDCXX: "-internal-isystem" "{{.*}}/include/c++/4.9"
51 // CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb"
52 // CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a"
53 // CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
54 // CHECK-STDCXX: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi"
55 // CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb"
56 // CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a"
57 // CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
58 // CHECK-STDCXX: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
59 // CHECK-STDCXX: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
60 // CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb"
61 // CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a"
62 // CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb"
63 // CHECK-STDCXX: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9"
64 // CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb"
65 // CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a"
66 // CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb"
67 // CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb"
68 // CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a"
69 // CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb"
70 // CHECK-STDCXX: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi/21"
71 // CHECK-STDCXX: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi"
72 // CHECK-STDCXX: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/arm-linux-androideabi/lib"
73 // CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb"
74 // CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a"
75 // CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb"
76 //
77 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
78 // RUN:     -target armv7a-none-linux-androideabi21 \
79 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
80 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
81 // RUN:   | FileCheck  --check-prefix=CHECK-ARMV7 %s
82 // CHECK-ARMV7: {{.*}}clang{{.*}}" "-cc1"
83 // CHECK-ARMV7: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
84 // CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/v1"
85 // CHECK-ARMV7: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
86 // CHECK-ARMV7: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include"
87 // CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/arm-linux-androideabi"
88 // CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/include"
89 // CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
90 // CHECK-ARMV7: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
91 // CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb"
92 // CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb"
93 // CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9"
94 // CHECK-ARMV7: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a"
95 // CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb"
96 // CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb"
97 // CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9"
98 // CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb"
99 // CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb"
100 // CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib"
101 // CHECK-ARMV7: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi/21"
102 // CHECK-ARMV7: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi"
103 // CHECK-ARMV7: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a"
104 // CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb"
105 // CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb"
106 // CHECK-ARMV7-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib"
107 //
108 // Other flags that can trigger armv7 mode.
109 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
110 // RUN:     -target arm-linux-androideabi21 \
111 // RUN:     -march=armv7 \
112 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
113 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
114 // RUN:   | FileCheck  --check-prefix=CHECK-ARMV7 %s
115 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
116 // RUN:     -target arm-linux-androideabi21 \
117 // RUN:     -march=armv7a \
118 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
119 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
120 // RUN:   | FileCheck  --check-prefix=CHECK-ARMV7 %s
121 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
122 // RUN:     -target arm-linux-androideabi21 \
123 // RUN:     -march=armv7-a \
124 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
125 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
126 // RUN:   | FileCheck  --check-prefix=CHECK-ARMV7 %s
127 //
128 // ARM thumb mode.
129 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
130 // RUN:     -target arm-linux-androideabi21 \
131 // RUN:     -mthumb \
132 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
133 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
134 // RUN:   | FileCheck  --check-prefix=CHECK-THUMB %s
135 // CHECK-THUMB: {{.*}}clang{{.*}}" "-cc1"
136 // CHECK-THUMB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
137 // CHECK-THUMB: "-internal-isystem" "{{.*}}/include/c++/v1"
138 // CHECK-THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
139 // CHECK-THUMB: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include"
140 // CHECK-THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/arm-linux-androideabi"
141 // CHECK-THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/include"
142 // CHECK-THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
143 // CHECK-THUMB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
144 // CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb"
145 // CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a"
146 // CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9"
147 // CHECK-THUMB: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb"
148 // CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb"
149 // CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a"
150 // CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9"
151 // CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7"
152 // CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7/thumb"
153 // CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib"
154 // CHECK-THUMB: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi/21"
155 // CHECK-THUMB: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi"
156 // CHECK-THUMB: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb"
157 // CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7"
158 // CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7/thumb"
159 // CHECK-THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib"
160 // CHECK-THUMB: "-L{{.*}}/sysroot/usr/lib"
161 //
162 // ARM V7 thumb mode.
163 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
164 // RUN:     -target arm-linux-androideabi21 \
165 // RUN:     -march=armv7-a -mthumb \
166 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
167 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
168 // RUN:   | FileCheck  --check-prefix=CHECK-ARMV7THUMB %s
169 // CHECK-ARMV7THUMB: {{.*}}clang{{.*}}" "-cc1"
170 // CHECK-ARMV7THUMB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
171 // CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/include/c++/v1"
172 // CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
173 // CHECK-ARMV7THUMB: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include"
174 // CHECK-ARMV7THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/arm-linux-androideabi"
175 // CHECK-ARMV7THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/include"
176 // CHECK-ARMV7THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
177 // CHECK-ARMV7THUMB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
178 // CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb"
179 // CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a"
180 // CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9"
181 // CHECK-ARMV7THUMB: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb"
182 // CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb"
183 // CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a"
184 // CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9"
185 // CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb"
186 // CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a"
187 // CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib"
188 // CHECK-ARMV7THUMB: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi/21"
189 // CHECK-ARMV7THUMB: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi"
190 // CHECK-ARMV7THUMB: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb"
191 // CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb"
192 // CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a"
193 // CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib"
194 
195 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
196 // RUN:     -target arm-linux-androideabi21 \
197 // RUN:     -march=armv7-a -mthumb \
198 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
199 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
200 // RUN:     -print-multi-lib \
201 // RUN:   | FileCheck  --check-prefix=CHECK-ARM-MULTILIBS %s
202 
203 // CHECK-ARM-MULTILIBS:      thumb;@mthumb
204 // CHECK-ARM-MULTILIBS-NEXT: armv7-a;@march=armv7-a
205 // CHECK-ARM-MULTILIBS-NEXT: armv7-a/thumb;@march=armv7-a@mthumb
206 // CHECK-ARM-MULTILIBS-NEXT: .;
207 
208 //
209 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
210 // RUN:     -target armv7a-none-linux-androideabi21 \
211 // RUN:     -mthumb \
212 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
213 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
214 // RUN:   | FileCheck  --check-prefix=CHECK-ARMV7THUMB %s
215 //
216 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
217 // RUN:     -target aarch64-linux-android21 \
218 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
219 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
220 // RUN:   | FileCheck --check-prefix=CHECK-AARCH64 %s
221 // CHECK-AARCH64: {{.*}}clang{{.*}}" "-cc1"
222 // CHECK-AARCH64: "-internal-isystem" "{{.*}}/include/c++/v1"
223 // CHECK-AARCH64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/aarch64-linux-android"
224 // CHECK-AARCH64: "-internal-externc-isystem" "{{.*}}/sysroot/include"
225 // CHECK-AARCH64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
226 // CHECK-AARCH64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
227 // CHECK-AARCH64: "-L{{.*}}/lib/gcc/aarch64-linux-android/4.9"
228 // CHECK-AARCH64: "-L{{.*}}/sysroot/usr/lib/aarch64-linux-android/21"
229 // CHECK-AARCH64: "-L{{.*}}/sysroot/usr/lib/aarch64-linux-android"
230 // CHECK-AARCH64: "-L{{.*}}/lib/gcc/aarch64-linux-android/4.9/../../../../aarch64-linux-android/lib"
231 //
232 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
233 // RUN:     -target arm64-linux-android21 \
234 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
235 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
236 // RUN:   | FileCheck --check-prefix=CHECK-ARM64 %s
237 // CHECK-ARM64: {{.*}}clang{{.*}}" "-cc1"
238 // CHECK-ARM64: "-internal-isystem" "{{.*}}/include/c++/v1"
239 // CHECK-ARM64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/aarch64-linux-android"
240 // CHECK-ARM64: "-internal-externc-isystem" "{{.*}}/sysroot/include"
241 // CHECK-ARM64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
242 // CHECK-ARM64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
243 // CHECK-ARM64: "-L{{.*}}/lib/gcc/aarch64-linux-android/4.9"
244 // CHECK-ARM64: "-L{{.*}}/sysroot/usr/lib/aarch64-linux-android/21"
245 // CHECK-ARM64: "-L{{.*}}/sysroot/usr/lib/aarch64-linux-android"
246 // CHECK-ARM64: "-L{{.*}}/lib/gcc/aarch64-linux-android/4.9/../../../../aarch64-linux-android/lib"
247 //
248 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
249 // RUN:     -target mipsel-linux-android21 \
250 // RUN:     -mips32 \
251 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
252 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
253 // RUN:   | FileCheck --check-prefix=CHECK-MIPS %s
254 // CHECK-MIPS: {{.*}}clang{{.*}}" "-cc1"
255 // CHECK-MIPS: "-internal-isystem" "{{.*}}/include/c++/v1"
256 // CHECK-MIPS: "-internal-externc-isystem" "{{.*}}/sysroot/include"
257 // CHECK-MIPS: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
258 // CHECK-MIPS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
259 // CHECK-MIPS: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.9"
260 // CHECK-MIPS: "-L{{.*}}/sysroot/usr/lib/mipsel-linux-android/21"
261 // CHECK-MIPS: "-L{{.*}}/sysroot/usr/lib/mipsel-linux-android"
262 // CHECK-MIPS: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.9/../../../../mipsel-linux-android/lib"
263 //
264 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
265 // RUN:     -target i686-linux-android21 \
266 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
267 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
268 // RUN:   | FileCheck --check-prefix=CHECK-I686 %s
269 // CHECK-I686: {{.*}}clang{{.*}}" "-cc1"
270 // CHECK-I686: "-internal-isystem" "{{.*}}/include/c++/v1"
271 // CHECK-I686: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/i686-linux-android"
272 // CHECK-I686: "-internal-externc-isystem" "{{.*}}/sysroot/include"
273 // CHECK-I686: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
274 // CHECK-I686: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
275 // CHECK-I686: "-L{{.*}}/lib/gcc/i686-linux-android/4.9"
276 // CHECK-I686: "-L{{.*}}/sysroot/usr/lib/i686-linux-android/21"
277 // CHECK-I686: "-L{{.*}}/sysroot/usr/lib/i686-linux-android"
278 // CHECK-I686: "-L{{.*}}/lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/lib"
279 //
280 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
281 // RUN:     -target x86_64-linux-android21 \
282 // RUN:     -B%S/Inputs/basic_android_ndk_tree \
283 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
284 // RUN:   | FileCheck --check-prefix=CHECK-X86_64 %s
285 // CHECK-X86_64: {{.*}}clang{{.*}}" "-cc1"
286 // CHECK-X86_64: "-internal-isystem" "{{.*}}/include/c++/v1"
287 // CHECK-X86_64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/x86_64-linux-android"
288 // CHECK-X86_64: "-internal-externc-isystem" "{{.*}}/sysroot/include"
289 // CHECK-X86_64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
290 // CHECK-X86_64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
291 // CHECK-X86_64: "-L{{.*}}/lib/gcc/x86_64-linux-android/4.9"
292 // CHECK-X86_64: "-L{{.*}}/sysroot/usr/lib/x86_64-linux-android/21"
293 // CHECK-X86_64: "-L{{.*}}/sysroot/usr/lib/x86_64-linux-android"
294 // CHECK-X86_64: "-L{{.*}}/lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/lib"
295 
296 // We need two sets of tests to verify that we both don't find non-Android
297 // toolchains installations and that we *do* find Android toolchains. We can't
298 // do both at the same time in this environment because we need to pass
299 // --sysroot to find the toolchains which would override searching in /usr. In a
300 // production environment --sysroot is not used and the toolchains are instead
301 // found relative to the clang binary, so both would be considered.
302 
303 // RUN: %clang -v --target=i686-linux-android \
304 // RUN:     2>&1 | FileCheck --check-prefix=CHECK-I686-GCC-NOSYS %s
305 //
306 // CHECK-I686-GCC-NOSYS-NOT: Found candidate GCC installation: /usr{{.*}}
307 //
308 // RUN: %clang -v --target=i686-linux-android \
309 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree \
310 // RUN:     2>&1 | FileCheck --check-prefix=CHECK-I686-GCC %s
311 //
312 // CHECK-I686-GCC-NOT: Found candidate GCC installation: /usr{{.*}}
313 // CHECK-I686-GCC: Found candidate GCC installation: {{.*}}i686-linux-android{{[/\\]}}4.9
314 // CHECK-I686-GCC-NEXT: Found candidate GCC installation: {{.*}}x86_64-linux-android{{[/\\]}}4.9
315 // CHECK-I686-GCC-NEXT: Selected GCC installation: {{.*}}i686-linux-android{{[/\\]}}4.9
316 
317 // RUN: %clang -v --target=x86_64-linux-android \
318 // RUN:     2>&1 | FileCheck --check-prefix=CHECK-X86_64-GCC-NOSYS %s
319 //
320 // CHECK-X86_64-GCC-NOSYS-NOT: Found candidate GCC installation: /usr{{.*}}
321 
322 // RUN: %clang -v --target=x86_64-linux-android \
323 // RUN:     --sysroot=%S/Inputs/basic_android_ndk_tree \
324 // RUN:     2>&1 | FileCheck --check-prefix=CHECK-X86_64-GCC %s
325 //
326 // CHECK-X86_64-GCC-NOT: Found candidate GCC installation: /usr{{.*}}
327 // CHECK-X86_64-GCC: Found candidate GCC installation: {{.*}}i686-linux-android{{[/\\]}}4.9
328 // CHECK-X86_64-GCC-NEXT: Found candidate GCC installation: {{.*}}x86_64-linux-android{{[/\\]}}4.9
329 // CHECK-X86_64-GCC-NEXT: Selected GCC installation: {{.*}}x86_64-linux-android{{[/\\]}}4.9
330