xref: /llvm-project/clang/test/Driver/hexagon-toolchain-elf.c (revision c2b89fc9e45d325282b8eb6536f6145282dc3fdf)
1 // -----------------------------------------------------------------------------
2 // Test standard include paths
3 // -----------------------------------------------------------------------------
4 
5 // RUN: %clang -### --target=hexagon-unknown-elf \
6 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin %s 2>&1 | FileCheck -check-prefix=CHECK000 %s
7 // CHECK000: "-cc1" {{.*}} "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/include"
8 
9 // RUN: %clangxx -### --target=hexagon-unknown-elf \
10 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin %s 2>&1 | FileCheck -check-prefix=CHECK001 %s
11 // CHECK001: "-cc1" {{.*}} "-internal-isystem" "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/include/c++"
12 // CHECK001:   "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/include"
13 
14 // -----------------------------------------------------------------------------
15 // Test -nostdinc, -nostdlibinc, -nostdinc++
16 // -----------------------------------------------------------------------------
17 
18 // RUN: %clang -### --target=hexagon-unknown-elf \
19 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
20 // RUN:   -nostdinc %s 2>&1 | FileCheck -check-prefix=CHECK110 %s
21 // CHECK110: "-cc1"
22 // CHECK110-NOT: "-internal-externc-isystem"
23 
24 // RUN: %clang -### --target=hexagon-unknown-elf \
25 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
26 // RUN:   -nostdlibinc %s 2>&1 | FileCheck -check-prefix=CHECK111 %s
27 // CHECK111: "-cc1"
28 // CHECK111-NOT: "-internal-externc-isystem"
29 
30 // RUN: %clangxx -### --target=hexagon-unknown-elf \
31 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
32 // RUN:   -nostdinc++ %s 2>&1 | FileCheck -check-prefix=CHECK112 %s
33 // CHECK112: "-cc1"
34 // CHECK112-NOT: "-internal-isystem"
35 // CHECK112-DAG: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/include"
36 
37 // RUN: %clangxx -### --target=hexagon-unknown-elf -fno-integrated-as    \
38 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \
39 // RUN:   -nostdlibinc %s 2>&1 | FileCheck -check-prefix=CHECK113 %s
40 // CHECK113: "-cc1"
41 // CHECK113-NOT: "-internal-isystem"
42 // CHECK113-NOT: "-internal-externc-isystem"
43 
44 // -----------------------------------------------------------------------------
45 // Test -mcpu=<cpuname> -mv<number>
46 // -----------------------------------------------------------------------------
47 // RUN: %clang -### --target=hexagon-unknown-elf \
48 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
49 // RUN:   -mcpu=hexagonv5 %s 2>&1 | FileCheck -check-prefix=CHECK221 %s
50 // CHECK221: "-cc1" {{.*}} "-target-cpu" "hexagonv5"
51 // CHECK221: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v5/crt0
52 
53 // RUN: %clang -### --target=hexagon-unknown-elf \
54 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
55 // RUN:   -mcpu=hexagonv55 %s 2>&1 | FileCheck -check-prefix=CHECK222 %s
56 // CHECK222: "-cc1" {{.*}} "-target-cpu" "hexagonv55"
57 // CHECK222: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v55/crt0
58 
59 // RUN: %clang -### --target=hexagon-unknown-elf \
60 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
61 // RUN:   -mcpu=hexagonv60 %s 2>&1 | FileCheck -check-prefix=CHECK223 %s
62 // CHECK223: "-cc1" {{.*}} "-target-cpu" "hexagonv60"
63 // CHECK223: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0
64 
65 // RUN: %clang -### --target=hexagon-unknown-elf \
66 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
67 // RUN:   -mcpu=hexagonv62 %s 2>&1 | FileCheck -check-prefix=CHECK224 %s
68 // CHECK224: "-cc1" {{.*}} "-target-cpu" "hexagonv62"
69 // CHECK224: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v62/crt0
70 
71 // RUN: %clang -### --target=hexagon-unknown-elf \
72 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
73 // RUN:   -mcpu=hexagonv65 %s 2>&1 | FileCheck -check-prefix=CHECK225 %s
74 // CHECK225: "-cc1" {{.*}} "-target-cpu" "hexagonv65"
75 // CHECK225: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v65/crt0
76 
77 // RUN: %clang -### --target=hexagon-unknown-elf \
78 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
79 // RUN:   -mcpu=hexagonv66 %s 2>&1 | FileCheck -check-prefix=CHECK226 %s
80 // CHECK226: "-cc1" {{.*}} "-target-cpu" "hexagonv66"
81 // CHECK226: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v66/crt0
82 
83 // RUN: %clang -### --target=hexagon-unknown-elf \
84 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
85 // RUN:   -O3 %s 2>&1 | FileCheck -check-prefix=CHECK227 %s
86 // CHECK227-NOT: "-ffp-contract=fast"
87 // CHECK227: {{hexagon-link|ld}}
88 
89 // RUN: %clang -### --target=hexagon-unknown-elf \
90 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
91 // RUN:   -O3 -ffp-contract=off %s 2>&1 | FileCheck -check-prefix=CHECK228 %s
92 // CHECK228-NOT: "-ffp-contract=fast"
93 // CHECK228: {{hexagon-link|ld}}
94 
95 // RUN: not %clang -### --target=hexagon-unknown-elf \
96 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
97 // RUN:   -mcpu=hexagonv65 -march=hexagon\
98 // RUN:   %s 2>&1 | FileCheck -check-prefix=CHECK229 %s
99 // RUN: not %clang -### --target=hexagon-unknown-elf \
100 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
101 // RUN:   -mv65 -march=hexagon\
102 // RUN:   %s 2>&1 | FileCheck -check-prefix=CHECK229 %s
103 // CHECK229: "-cc1" {{.*}} "-target-cpu" "hexagonv65"
104 // CHECK229: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v65/crt0
105 
106 // RUN: not %clang -### --target=hexagon-unknown-elf \
107 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
108 // RUN:   -mcpu=hexagonv67 -fuse-ld=hexagon-link \
109 // RUN:   %s 2>&1 | FileCheck -check-prefix=CHECK22A %s
110 // CHECK22A: "-cc1" {{.*}} "-target-cpu" "hexagonv67"
111 // CHECK22A: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v67/crt0
112 
113 // RUN: not %clang -### --target=hexagon-unknown-elf \
114 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
115 // RUN:   -mcpu=hexagonv67t \
116 // RUN:   -fuse-ld=fake-value-to-ignore-CLANG_DEFAULT_LINKER %s 2>&1 | FileCheck -check-prefix=CHECK22B %s
117 // CHECK22B: "-cc1" {{.*}} "-target-cpu" "hexagonv67t"
118 // CHECK22B: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v67t/crt0
119 
120 // RUN: not %clang -### --target=hexagon-unknown-elf \
121 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
122 // RUN:   -mcpu=hexagonv68 -fuse-ld=hexagon-link \
123 // RUN:   %s 2>&1 | FileCheck -check-prefix=CHECK22C %s
124 // CHECK22C: "-cc1" {{.*}} "-target-cpu" "hexagonv68"
125 // CHECK22C: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v68/crt0
126 
127 // RUN: not %clang -### --target=hexagon-unknown-elf \
128 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
129 // RUN:   -mcpu=hexagonv69 -fuse-ld=hexagon-link \
130 // RUN:   %s 2>&1 | FileCheck -check-prefix=CHECK22D %s
131 // CHECK22D: "-cc1" {{.*}} "-target-cpu" "hexagonv69"
132 // CHECK22D: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v69/crt0
133 
134 // RUN: not %clang -### --target=hexagon-unknown-elf \
135 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
136 // RUN:   -mcpu=hexagonv71 -fuse-ld=hexagon-link \
137 // RUN:   %s 2>&1 | FileCheck -check-prefix=CHECK22E %s
138 // CHECK22E: "-cc1" {{.*}} "-target-cpu" "hexagonv71"
139 // CHECK22E: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v71/crt0
140 
141 // RUN: not %clang -### --target=hexagon-unknown-elf \
142 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
143 // RUN:   -mcpu=hexagonv71t -fuse-ld=hexagon-link \
144 // RUN:   %s 2>&1 | FileCheck -check-prefix=CHECK22F %s
145 // CHECK22F: "-cc1" {{.*}} "-target-cpu" "hexagonv71t"
146 // CHECK22F: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v71t/crt0
147 
148 // RUN: not %clang -### --target=hexagon-unknown-elf \
149 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
150 // RUN:   -mcpu=hexagonv73 -fuse-ld=hexagon-link \
151 // RUN:   %s 2>&1 | FileCheck -check-prefix=CHECK230 %s
152 // CHECK230: "-cc1" {{.*}} "-target-cpu" "hexagonv73"
153 // CHECK230: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v73/crt0
154 
155 // RUN: not %clang -### --target=hexagon-unknown-elf \
156 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
157 // RUN:   -mcpu=hexagonv75 -fuse-ld=hexagon-link \
158 // RUN:   %s 2>&1 | FileCheck -check-prefix=CHECK240 %s
159 // CHECK240: "-cc1" {{.*}} "-target-cpu" "hexagonv75"
160 // CHECK240: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v75/crt0
161 
162 // RUN: not %clang -### --target=hexagon-unknown-elf \
163 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
164 // RUN:   -mcpu=hexagonv79 -fuse-ld=hexagon-link \
165 // RUN:   %s 2>&1 | FileCheck -check-prefix=CHECK250 %s
166 // CHECK250: "-cc1" {{.*}} "-target-cpu" "hexagonv79"
167 // CHECK250: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v79/crt0
168 
169 // -----------------------------------------------------------------------------
170 // Test Linker related args
171 // -----------------------------------------------------------------------------
172 
173 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
174 // Defaults for C
175 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
176 // RUN: %clang -### --target=hexagon-unknown-elf \
177 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
178 // RUN:   -mcpu=hexagonv60 %s 2>&1 | FileCheck -check-prefix=CHECK330 %s
179 // CHECK330: "-cc1"
180 // CHECK330: {{hexagon-link|ld}}
181 // CHECK330-NOT: "-static"
182 // CHECK330-NOT: "-shared"
183 // CHECK330: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
184 // CHECK330: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
185 // CHECK330: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
186 // CHECK330: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
187 // CHECK330: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
188 // CHECK330: "{{[^"]+}}.o"
189 // CHECK330: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group"
190 // CHECK330: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
191 
192 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
193 // Defaults for C++
194 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
195 // RUN: %clangxx -### --target=hexagon-unknown-elf \
196 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
197 // RUN:   -mcpu=hexagonv60 %s 2>&1 | FileCheck -check-prefix=CHECK331 %s
198 // CHECK331: "-cc1"
199 // CHECK331: {{hexagon-link|ld}}
200 // CHECK331-NOT: "-static"
201 // CHECK331-NOT: "-shared"
202 // CHECK331: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
203 // CHECK331-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
204 // CHECK331-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
205 // CHECK331-SAME: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
206 // CHECK331-SAME: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
207 // CHECK331-SAME: "{{[^"]+}}.o"
208 // CHECK331-SAME: "-lstdc++" "-lm" "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group"
209 // CHECK331-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
210 
211 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
212 // Additional Libraries (-L)
213 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
214 // RUN: %clang -### --target=hexagon-unknown-elf \
215 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
216 // RUN:   -mcpu=hexagonv60 \
217 // RUN:   -Lone -L two -L three %s 2>&1 | FileCheck -check-prefix=CHECK332 %s
218 // CHECK332: "-cc1"
219 // CHECK332: {{hexagon-link|ld}}
220 // CHECK332-NOT: "-static"
221 // CHECK332-NOT: "-shared"
222 // CHECK332: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
223 // CHECK332: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
224 // CHECK332: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
225 // CHECK332: "-Lone" "-Ltwo" "-Lthree"
226 // CHECK332: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
227 // CHECK332: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
228 // CHECK332: "{{[^"]+}}.o"
229 // CHECK332: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group"
230 // CHECK332: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
231 
232 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
233 // -static, -shared
234 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
235 // RUN: %clang -### --target=hexagon-unknown-elf \
236 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
237 // RUN:   -mcpu=hexagonv60 \
238 // RUN:   -static %s 2>&1 | FileCheck -check-prefix=CHECK333 %s
239 // CHECK333: "-cc1"
240 // CHECK333: {{hexagon-link|ld}}
241 // CHECK333: "-static"
242 // CHECK333: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
243 // CHECK333: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
244 // CHECK333: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
245 // CHECK333: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
246 // CHECK333: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
247 // CHECK333: "{{[^"]+}}.o"
248 // CHECK333: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group"
249 // CHECK333: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
250 
251 // RUN: %clang -### --target=hexagon-unknown-elf \
252 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
253 // RUN:   -mcpu=hexagonv60 \
254 // RUN:   -shared %s 2>&1 | FileCheck -check-prefix=CHECK334 %s
255 // CHECK334: "-cc1"
256 // CHECK334: {{hexagon-link|ld}}
257 // CHECK334: "-shared" "-call_shared"
258 // CHECK334-NOT: crt0_standalone.o
259 // CHECK334-NOT: crt0.o
260 // CHECK334: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0/pic/initS.o"
261 // CHECK334: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0"
262 // CHECK334: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
263 // CHECK334: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
264 // CHECK334: "{{[^"]+}}.o"
265 // CHECK334: "--start-group"
266 // CHECK334-NOT: "-lstandalone"
267 // CHECK334-NOT: "-lc"
268 // CHECK334: "-lgcc"
269 // CHECK334: "--end-group"
270 // CHECK334: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0/pic/finiS.o"
271 
272 // RUN: %clang -### --target=hexagon-unknown-elf \
273 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
274 // RUN:   -mcpu=hexagonv60 \
275 // RUN:   -shared \
276 // RUN:   -static %s 2>&1 | FileCheck -check-prefix=CHECK335 %s
277 // CHECK335: "-cc1"
278 // CHECK335: {{hexagon-link|ld}}
279 // CHECK335: "-shared" "-call_shared" "-static"
280 // CHECK335-NOT: crt0_standalone.o
281 // CHECK335-NOT: crt0.o
282 // CHECK335: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0/init.o"
283 // CHECK335-SAME: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0"
284 // CHECK335-SAME: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
285 // CHECK335-SAME: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
286 // CHECK335-SAME: "{{[^"]+}}.o"
287 // CHECK335-SAME: "--start-group"
288 // CHECK335-NOT: "-lstandalone"
289 // CHECK335-NOT: "-lc"
290 // CHECK335-SAME: "-lgcc" "--end-group"
291 // CHECK335-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0/fini.o"
292 
293 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
294 // -nostdlib, -nostartfiles, -nodefaultlibs, -nolibc
295 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
296 // RUN: %clangxx -### --target=hexagon-unknown-elf \
297 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
298 // RUN:   -mcpu=hexagonv60 \
299 // RUN:   -nostdlib %s 2>&1 | FileCheck -check-prefix=CHECK336 %s
300 // CHECK336: "-cc1"
301 // CHECK336: {{hexagon-link|ld}}
302 // CHECK336-NOT: crt0_standalone.o
303 // CHECK336-NOT: crt0.o
304 // CHECK336-NOT: init.o
305 // CHECK336: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
306 // CHECK336: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
307 // CHECK336: "{{[^"]+}}.o"
308 // CHECK336-NOT: "-lstdc++"
309 // CHECK336-NOT: "-lm"
310 // CHECK336-NOT: "--start-group"
311 // CHECK336-NOT: "-lstandalone"
312 // CHECK336-NOT: "-lc"
313 // CHECK336-NOT: "-lgcc"
314 // CHECK336-NOT: "--end-group"
315 // CHECK336-NOT: fini.o
316 
317 // RUN: %clangxx -### --target=hexagon-unknown-elf \
318 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
319 // RUN:   -mcpu=hexagonv60 \
320 // RUN:   -nostartfiles %s 2>&1 | FileCheck -check-prefix=CHECK337 %s
321 // CHECK337: "-cc1"
322 // CHECK337: {{hexagon-link|ld}}
323 // CHECK337-NOT: crt0_standalone.o
324 // CHECK337-NOT: crt0.o
325 // CHECK337-NOT: init.o
326 // CHECK337: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
327 // CHECK337: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
328 // CHECK337: "{{[^"]+}}.o"
329 // CHECK337: "-lstdc++" "-lm" "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group"
330 // CHECK337-NOT: fini.o
331 
332 // RUN: %clangxx -### --target=hexagon-unknown-elf \
333 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
334 // RUN:   -mcpu=hexagonv60 \
335 // RUN:   -nodefaultlibs %s 2>&1 | FileCheck -check-prefix=CHECK338 %s
336 // CHECK338: "-cc1"
337 // CHECK338: {{hexagon-link|ld}}
338 // CHECK338: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
339 // CHECK338: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
340 // CHECK338: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
341 // CHECK338: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
342 // CHECK338: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
343 // CHECK338: "{{[^"]+}}.o"
344 // CHECK338-NOT: "-lstdc++"
345 // CHECK338-NOT: "-lm"
346 // CHECK338-NOT: "--start-group"
347 // CHECK338-NOT: "-lstandalone"
348 // CHECK338-NOT: "-lc"
349 // CHECK338-NOT: "-lgcc"
350 // CHECK338-NOT: "--end-group"
351 // CHECK338: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
352 
353 // RUN: %clangxx -### --target=hexagon-unknown-elf \
354 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin -mcpu=hexagonv60 \
355 // RUN:   -fuse-ld=lld -nolibc %s 2>&1 | FileCheck -check-prefix=CHECK-NOLIBC %s
356 // CHECK-NOLIBC: "-cc1"
357 // CHECK-NOLIBC: ld.lld
358 // CHECK-NOLIBC-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
359 // CHECK-NOLIBC-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
360 // CHECK-NOLIBC-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
361 // CHECK-NOLIBC-SAME: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
362 // CHECK-NOLIBC-SAME: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
363 // CHECK-NOLIBC-SAME: "{{[^"]+}}.o"
364 // CHECK-NOLIBC-SAME: "-lstdc++"
365 // CHECK-NOLIBC-SAME: "-lm"
366 // CHECK-NOLIBC-SAME: "--start-group"
367 // CHECK-NOLIBC-SAME: "-lstandalone"
368 // CHECK-NOLIBC-NOT: "-lc"
369 // CHECK-NOLIBC-SAME: "-lgcc"
370 // CHECK-NOLIBC-SAME: "--end-group"
371 // CHECK-NOLIBC-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
372 
373 
374 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
375 // -moslib
376 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
377 // RUN: %clang -### --target=hexagon-unknown-elf \
378 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
379 // RUN:   -mcpu=hexagonv60 \
380 // RUN:   -moslib=first -moslib=second %s 2>&1 | FileCheck -check-prefix=CHECK339 %s
381 // CHECK339: "-cc1"
382 // CHECK339: {{hexagon-link|ld}}
383 // CHECK339-NOT: "-static"
384 // CHECK339-NOT: "-shared"
385 // CHECK339-NOT: crt0_standalone.o
386 // CHECK339: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
387 // CHECK339-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
388 // CHECK339-SAME: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
389 // CHECK339-SAME: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
390 // CHECK339-SAME: "{{[^"]+}}.o"
391 // CHECK339-SAME: "--start-group" "-lfirst" "-lsecond"
392 // CHECK339-NOT: "-lstandalone"
393 // CHECK339-SAME: "-lc" "-lgcc" "--end-group"
394 // CHECK339-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
395 
396 // RUN: %clang -### --target=hexagon-unknown-elf \
397 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
398 // RUN:   -mcpu=hexagonv60 \
399 // RUN:   -moslib=first -moslib=second -moslib=standalone %s 2>&1 | FileCheck -check-prefix=CHECK33A %s
400 // CHECK33A: "-cc1"
401 // CHECK33A: {{hexagon-link|ld}}
402 // CHECK33A-NOT: "-static"
403 // CHECK33A-NOT: "-shared"
404 // CHECK33A:      "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
405 // CHECK33A-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
406 // CHECK33A-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
407 // CHECK33A-SAME: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
408 // CHECK33A-SAME: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
409 // CHECK33A-SAME: "{{[^"]+}}.o"
410 // CHECK33A-SAME: "--start-group"
411 // CHECK33A-SAME: "-lfirst" "-lsecond"
412 // CHECK33A-SAME: "-lstandalone"
413 // CHECK33A-SAME: "-lc" "-lgcc" "--end-group"
414 // CHECK33A-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
415 
416 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
417 // Other args to pass to linker
418 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
419 // RUN: %clangxx -### --target=hexagon-unknown-elf \
420 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
421 // RUN:   -mcpu=hexagonv60 -fuse-ld=lld \
422 // RUN:   -s -t -e start_here -uFoo -undefined Bar %s 2>&1 | FileCheck -check-prefix=CHECK33B %s
423 // CHECK33B:      "-cc1"
424 // CHECK33B:      ld.lld
425 // CHECK33B-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
426 // CHECK33B-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
427 // CHECK33B-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
428 // CHECK33B-SAME: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
429 // CHECK33B-SAME: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
430 // CHECK33B-SAME: "-s" "-t" "-u" "Foo" "-undefined" "Bar"
431 // CHECK33B-SAME: "{{[^"]+}}.o"
432 // CHECK33B-SAME: "-lstdc++" "-lm" "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group"
433 // CHECK33B-SAME: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
434 
435 // -----------------------------------------------------------------------------
436 // pic, small data threshold
437 // -----------------------------------------------------------------------------
438 // RUN: %clang -### --target=hexagon-unknown-elf \
439 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
440 // RUN:   -mcpu=hexagonv60 %s 2>&1 | FileCheck -check-prefix=CHECK340 %s
441 // CHECK340:      "-cc1"
442 // CHECK340: {{hexagon-link|ld}}
443 // CHECK340-NOT:  "-G{{[0-9]+}}"
444 
445 // RUN: %clang -### --target=hexagon-unknown-elf \
446 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
447 // RUN:   -mcpu=hexagonv60 \
448 // RUN:   -fpic %s 2>&1 | FileCheck -check-prefix=CHECK341 %s
449 // RUN: %clang -### --target=hexagon-unknown-elf \
450 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
451 // RUN:   -mcpu=hexagonv60 \
452 // RUN:   -fPIC %s 2>&1 | FileCheck -check-prefix=CHECK341 %s
453 // CHECK341:      "-cc1"
454 // CHECK341-NOT:  "-mrelocation-model" "static"
455 // CHECK341:      "-pic-level" "{{[12]}}"
456 // CHECK341:      "-mllvm" "-hexagon-small-data-threshold=0"
457 // CHECK341: {{hexagon-link|ld}}
458 // CHECK341:      "-G0"
459 
460 // RUN: %clang -### --target=hexagon-unknown-elf -fno-integrated-as -fno-pie -no-pie \
461 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
462 // RUN:   -mcpu=hexagonv60 \
463 // RUN:   -G=8 %s 2>&1 | FileCheck -check-prefix=CHECK342 %s
464 // RUN: %clang -### --target=hexagon-unknown-elf -fno-integrated-as -fno-pie -no-pie \
465 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
466 // RUN:   -mcpu=hexagonv60 \
467 // RUN:   -G 8 %s 2>&1 | FileCheck -check-prefix=CHECK342 %s
468 // RUN: %clang -### --target=hexagon-unknown-elf -fno-integrated-as -fno-pie -no-pie \
469 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
470 // RUN:   -mcpu=hexagonv60 \
471 // RUN:   -msmall-data-threshold=8 %s 2>&1 | FileCheck -check-prefix=CHECK342 %s
472 // CHECK342:      "-cc1"
473 // CHECK342:      "-mrelocation-model" "static"
474 // CHECK342:      "-mllvm" "-hexagon-small-data-threshold=8"
475 // CHECK342-NEXT: llvm-mc
476 // CHECK342:      "-gpsize=8"
477 // CHECK342: {{hexagon-link|ld}}
478 // CHECK342:      "-G8"
479 
480 // -----------------------------------------------------------------------------
481 // pie
482 // -----------------------------------------------------------------------------
483 // RUN: %clang -### --target=hexagon-unknown-elf \
484 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
485 // RUN:   -mcpu=hexagonv60 \
486 // RUN:   -pie %s 2>&1 | FileCheck -check-prefix=CHECK350 %s
487 // CHECK350:      "-cc1"
488 // CHECK350:      {{hexagon-link|ld}}
489 // CHECK350:      "-pie"
490 
491 // RUN: %clang -### --target=hexagon-unknown-elf \
492 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
493 // RUN:   -mcpu=hexagonv60 \
494 // RUN:   -pie -shared %s 2>&1 | FileCheck -check-prefix=CHECK351 %s
495 // CHECK351:      "-cc1"
496 // CHECK351:      {{hexagon-link|ld}}
497 // CHECK351-NOT:  "-pie"
498 
499 // -----------------------------------------------------------------------------
500 // Test Assembler related args
501 // -----------------------------------------------------------------------------
502 // RUN: %clang -### --target=hexagon-unknown-elf -fno-integrated-as    \
503 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
504 // RUN:   -mcpu=hexagonv60 \
505 // RUN:   -gdwarf-2 \
506 // RUN:   -Wa,--noexecstack,--trap \
507 // RUN:   -Xassembler --keep-locals %s 2>&1 | FileCheck -check-prefix=CHECK360 %s
508 // CHECK360:      "-cc1"
509 // CHECK360-NEXT: llvm-mc
510 // CHECK360:      "--noexecstack" "--trap" "--keep-locals"
511 // CHECK360:      {{hexagon-link|ld}}
512 
513 // -----------------------------------------------------------------------------
514 // ffixed-r19
515 // -----------------------------------------------------------------------------
516 // RUN: %clang -### --target=hexagon-unknown-elf -ffixed-r19 %s 2>&1 \
517 // RUN:        | FileCheck --check-prefix=CHECK370 %s
518 // CHECK370: "-target-feature" "+reserved-r19"
519 // RUN: %clang -### --target=hexagon-unknown-elf %s 2>&1 \
520 // RUN:        | FileCheck --check-prefix=CHECK371 %s
521 // CHECK371-NOT: "+reserved-r19"
522 
523 // -----------------------------------------------------------------------------
524 // mcabac
525 // -----------------------------------------------------------------------------
526 // RUN: %clang -### --target=hexagon-unknown-elf -mcabac %s 2>&1 \
527 // RUN:        | FileCheck --check-prefix=CHECK372 %s
528 // CHECK372: "-target-feature" "+cabac"
529 // RUN: %clang -### --target=hexagon-unknown-elf %s 2>&1 \
530 // RUN:        | FileCheck --check-prefix=CHECK373 %s
531 // CHECK373-NOT: "+cabac"
532 
533 // -----------------------------------------------------------------------------
534 // Misc Defaults
535 // -----------------------------------------------------------------------------
536 // RUN: %clang -### --target=hexagon-unknown-elf \
537 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
538 // RUN:   -mcpu=hexagonv60 %s 2>&1 | FileCheck -check-prefix=CHECK380 %s
539 // CHECK380:      "-cc1"
540 // CHECK380-SAME: "-Wreturn-type"
541 
542 // -----------------------------------------------------------------------------
543 // Default, hexagon-link is used
544 // -----------------------------------------------------------------------------
545 // RUN: not %clang -### --target=hexagon-unknown-elf \
546 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
547 // RUN:   -mcpu=hexagonv60 \
548 // RUN:   -fuse-ld=fake-value-to-ignore-CLANG_DEFAULT_LINKER %s 2>&1 | FileCheck -check-prefix=CHECK381 %s
549 // CHECK381:      "-march=hexagon"
550 // CHECK381:      "-mcpu=hexagonv60"
551 // -----------------------------------------------------------------------------
552 // Passing -fuse-ld=lld
553 // -----------------------------------------------------------------------------
554 // RUN: %clang -### --target=hexagon-unknown-elf \
555 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
556 // RUN:   -mcpu=hexagonv60 \
557 // RUN:   -fuse-ld=lld %s 2>&1 | FileCheck -check-prefix=CHECK382 %s
558 // CHECK382-NOT:      "-march=
559 // CHECK382-NOT:      "-mcpu=
560 // -----------------------------------------------------------------------------
561 // Passing --sysroot
562 // -----------------------------------------------------------------------------
563 // RUN: %clang -### --target=hexagon-unknown-elf \
564 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
565 // RUN:   -mcpu=hexagonv60 \
566 // RUN:   --sysroot=/hexagon %s 2>&1 | FileCheck -check-prefix=CHECK383 %s
567 // CHECK383:          "-isysroot" "/hexagon"
568 // CHECK383:          "-internal-externc-isystem" "/hexagon{{/|\\\\}}include"
569 // -----------------------------------------------------------------------------
570 // Passing -fno-use-init-array
571 // -----------------------------------------------------------------------------
572 // RUN: %clang -### --target=hexagon-unknown-elf \
573 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
574 // RUN:   -mcpu=hexagonv60 %s 2>&1 | FileCheck -check-prefix=CHECK384 %s
575 // CHECK384:          "-fno-use-init-array"
576