[RISCV][FMV] Support target_clones (#85786)
[llvm-project.git] / clang / test / Driver / android-ndk-standalone.cpp
blob2670a6707a96c95b254ae1ae583f911ba021cb0a
1 // Test header and library paths when Clang is used with Android standalone
2 // toolchain.
3 //
4 // RUN: %clang -### %s 2>&1 \
5 // RUN: --target=arm-linux-androideabi21 \
6 // RUN: --gcc-toolchain=%S/Inputs/basic_android_ndk_tree \
7 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
8 // RUN: | FileCheck %s
9 // CHECK: "-cc1"
10 // CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
11 // CHECK: "-internal-isystem" "{{.*}}{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1"
12 // CHECK: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include"
13 // CHECK: "-internal-isystem" "{{.*}}/sysroot/usr/local/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"
35 // RUN: %clang -### %s 2>&1 \
36 // RUN: --target=arm-linux-androideabi14 \
37 // RUN: --gcc-toolchain=%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"
43 // RUN: %clang -### %s 2>&1 \
44 // RUN: --target=arm-linux-androideabi21 -stdlib=libstdc++ \
45 // RUN: --gcc-toolchain=%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: "-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"
77 // RUN: %clang -### %s 2>&1 \
78 // RUN: --target=armv7a-none-linux-androideabi21 \
79 // RUN: --gcc-toolchain=%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: "-cc1"
83 // CHECK-ARMV7: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
84 // CHECK-ARMV7: "-internal-isystem" "{{.*}}{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1"
85 // CHECK-ARMV7: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include"
86 // CHECK-ARMV7: "-internal-isystem" "{{.*}}/sysroot/usr/local/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"
108 // Other flags that can trigger armv7 mode.
109 // RUN: %clang -### %s 2>&1 \
110 // RUN: --target=arm-linux-androideabi21 \
111 // RUN: -march=armv7 \
112 // RUN: --gcc-toolchain=%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 -### %s 2>&1 \
116 // RUN: --target=arm-linux-androideabi21 \
117 // RUN: -march=armv7a \
118 // RUN: --gcc-toolchain=%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 -### %s 2>&1 \
122 // RUN: --target=arm-linux-androideabi21 \
123 // RUN: -march=armv7-a \
124 // RUN: --gcc-toolchain=%S/Inputs/basic_android_ndk_tree \
125 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
126 // RUN: | FileCheck --check-prefix=CHECK-ARMV7 %s
128 // ARM thumb mode.
129 // RUN: %clang -### %s 2>&1 \
130 // RUN: --target=arm-linux-androideabi21 \
131 // RUN: -mthumb \
132 // RUN: --gcc-toolchain=%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: "-cc1"
136 // CHECK-THUMB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
137 // CHECK-THUMB: "-internal-isystem" "{{.*}}{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1"
138 // CHECK-THUMB: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include"
139 // CHECK-THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/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"
162 // ARM V7 thumb mode.
163 // RUN: %clang -### %s 2>&1 \
164 // RUN: --target=arm-linux-androideabi21 \
165 // RUN: -march=armv7-a -mthumb \
166 // RUN: --gcc-toolchain=%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: "-cc1"
170 // CHECK-ARMV7THUMB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
171 // CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1"
172 // CHECK-ARMV7THUMB: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include"
173 // CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/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"
195 // RUN: %clang -### %s 2>&1 \
196 // RUN: --target=arm-linux-androideabi21 \
197 // RUN: -march=armv7-a -mthumb \
198 // RUN: --gcc-toolchain=%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
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: .;
209 // RUN: %clang -### %s 2>&1 \
210 // RUN: --target=armv7a-none-linux-androideabi21 \
211 // RUN: -mthumb \
212 // RUN: --gcc-toolchain=%S/Inputs/basic_android_ndk_tree \
213 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
214 // RUN: | FileCheck --check-prefix=CHECK-ARMV7THUMB %s
216 // RUN: %clang -### %s 2>&1 \
217 // RUN: --target=aarch64-linux-android21 \
218 // RUN: --gcc-toolchain=%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: "-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"
232 // RUN: %clang -### %s 2>&1 \
233 // RUN: --target=arm64-linux-android21 \
234 // RUN: --gcc-toolchain=%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: "-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"
248 // RUN: %clang -### %s 2>&1 \
249 // RUN: --target=i686-linux-android21 \
250 // RUN: --gcc-toolchain=%S/Inputs/basic_android_ndk_tree \
251 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
252 // RUN: | FileCheck --check-prefix=CHECK-I686 %s
253 // CHECK-I686: "-cc1"
254 // CHECK-I686: "-internal-isystem" "{{.*}}{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1"
255 // CHECK-I686: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/i686-linux-android"
256 // CHECK-I686: "-internal-externc-isystem" "{{.*}}/sysroot/include"
257 // CHECK-I686: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
258 // CHECK-I686: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
259 // CHECK-I686: "-L{{.*}}/lib/gcc/i686-linux-android/4.9"
260 // CHECK-I686: "-L{{.*}}/sysroot/usr/lib/i686-linux-android/21"
261 // CHECK-I686: "-L{{.*}}/sysroot/usr/lib/i686-linux-android"
262 // CHECK-I686: "-L{{.*}}/lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/lib"
264 // RUN: %clang -### %s 2>&1 \
265 // RUN: --target=x86_64-linux-android21 \
266 // RUN: --gcc-toolchain=%S/Inputs/basic_android_ndk_tree \
267 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
268 // RUN: | FileCheck --check-prefix=CHECK-X86_64 %s
269 // CHECK-X86_64: "-cc1"
270 // CHECK-X86_64: "-internal-isystem" "{{.*}}{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1"
271 // CHECK-X86_64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/x86_64-linux-android"
272 // CHECK-X86_64: "-internal-externc-isystem" "{{.*}}/sysroot/include"
273 // CHECK-X86_64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
274 // CHECK-X86_64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
275 // CHECK-X86_64: "-L{{.*}}/lib/gcc/x86_64-linux-android/4.9"
276 // CHECK-X86_64: "-L{{.*}}/sysroot/usr/lib/x86_64-linux-android/21"
277 // CHECK-X86_64: "-L{{.*}}/sysroot/usr/lib/x86_64-linux-android"
278 // CHECK-X86_64: "-L{{.*}}/lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/lib"
280 // We need two sets of tests to verify that we both don't find non-Android
281 // toolchains installations and that we *do* find Android toolchains. We can't
282 // do both at the same time in this environment because we need to pass
283 // --sysroot to find the toolchains which would override searching in /usr. In a
284 // production environment --sysroot is not used and the toolchains are instead
285 // found relative to the clang binary, so both would be considered.
287 // RUN: %clang -v --target=i686-linux-android \
288 // RUN: 2>&1 | FileCheck --check-prefix=CHECK-I686-GCC-NOSYS %s
290 // CHECK-I686-GCC-NOSYS-NOT: Found candidate GCC installation: /usr{{.*}}
292 // RUN: %clang -v --target=i686-linux-android \
293 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree \
294 // RUN: 2>&1 | FileCheck --check-prefix=CHECK-I686-GCC %s
296 // CHECK-I686-GCC-NOT: Found candidate GCC installation: /usr{{.*}}
297 // CHECK-I686-GCC: Found candidate GCC installation: {{.*}}i686-linux-android{{[/\\]}}4.9
298 // CHECK-I686-GCC-NEXT: Found candidate GCC installation: {{.*}}x86_64-linux-android{{[/\\]}}4.9
299 // CHECK-I686-GCC-NEXT: Selected GCC installation: {{.*}}i686-linux-android{{[/\\]}}4.9
301 // RUN: %clang -v --target=x86_64-linux-android \
302 // RUN: 2>&1 | FileCheck --check-prefix=CHECK-X86_64-GCC-NOSYS %s
304 // CHECK-X86_64-GCC-NOSYS-NOT: Found candidate GCC installation: /usr{{.*}}
306 // RUN: %clang -v --target=x86_64-linux-android \
307 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree \
308 // RUN: 2>&1 | FileCheck --check-prefix=CHECK-X86_64-GCC %s
310 // CHECK-X86_64-GCC-NOT: Found candidate GCC installation: /usr{{.*}}
311 // CHECK-X86_64-GCC: Found candidate GCC installation: {{.*}}i686-linux-android{{[/\\]}}4.9
312 // CHECK-X86_64-GCC-NEXT: Found candidate GCC installation: {{.*}}x86_64-linux-android{{[/\\]}}4.9
313 // CHECK-X86_64-GCC-NEXT: Selected GCC installation: {{.*}}x86_64-linux-android{{[/\\]}}4.9