Clang Project

clang_source_code/test/Driver/hexagon-toolchain-elf.c
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 \
7// RUN:   %s 2>&1 \
8// RUN:   | FileCheck -check-prefix=CHECK000 %s
9// CHECK000: "-cc1" {{.*}} "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/include"
10
11// RUN: %clangxx -### -target hexagon-unknown-elf \
12// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
13// RUN:   %s 2>&1 \
14// RUN:   | FileCheck -check-prefix=CHECK001 %s
15// CHECK001: "-cc1" {{.*}} "-internal-isystem" "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/include/c++"
16// CHECK001:   "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/include"
17
18// -----------------------------------------------------------------------------
19// Test -nostdinc, -nostdlibinc, -nostdinc++
20// -----------------------------------------------------------------------------
21
22// RUN: %clang -### -target hexagon-unknown-elf \
23// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
24// RUN:   -nostdinc \
25// RUN:   %s 2>&1 \
26// RUN:   | FileCheck -check-prefix=CHECK010 %s
27// CHECK010: "-cc1"
28// CHECK010-NOT: "-internal-externc-isystem"
29
30// RUN: %clang -### -target hexagon-unknown-elf \
31// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
32// RUN:   -nostdlibinc \
33// RUN:   %s 2>&1 \
34// RUN:   | FileCheck -check-prefix=CHECK011 %s
35// CHECK011: "-cc1"
36// CHECK011-NOT: "-internal-externc-isystem"
37
38// RUN: %clangxx -### -target hexagon-unknown-elf \
39// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
40// RUN:   -nostdinc++ \
41// RUN:   %s 2>&1 \
42// RUN:   | FileCheck -check-prefix=CHECK012 %s
43// CHECK012: "-cc1"
44// CHECK012-NOT: "-internal-isystem"
45// CHECK012-DAG: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/include"
46
47// RUN: %clangxx -### -target hexagon-unknown-elf -fno-integrated-as    \
48// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \
49// RUN:   --gcc-toolchain="" \
50// RUN:   -nostdlibinc \
51// RUN:   %s 2>&1 \
52// RUN:   | FileCheck -check-prefix=CHECK013 %s
53// CHECK013: "-cc1"
54// CHECK013-NOT: "-internal-isystem"
55// CHECK013-NOT: "-internal-externc-isystem"
56
57// -----------------------------------------------------------------------------
58// Test -mcpu=<cpuname> -mv<number>
59// -----------------------------------------------------------------------------
60// RUN: %clang -### -target hexagon-unknown-elf \
61// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
62// RUN:   -mcpu=hexagonv5 \
63// RUN:   %s 2>&1 \
64// RUN:   | FileCheck -check-prefix=CHECK021 %s
65// CHECK021: "-cc1" {{.*}} "-target-cpu" "hexagonv5"
66// CHECK021: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v5/crt0
67
68// RUN: %clang -### -target hexagon-unknown-elf \
69// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
70// RUN:   -mcpu=hexagonv55 \
71// RUN:   %s 2>&1 \
72// RUN:   | FileCheck -check-prefix=CHECK022 %s
73// CHECK022: "-cc1" {{.*}} "-target-cpu" "hexagonv55"
74// CHECK022: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v55/crt0
75
76// RUN: %clang -### -target hexagon-unknown-elf \
77// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
78// RUN:   -mcpu=hexagonv60 \
79// RUN:   %s 2>&1 \
80// RUN:   | FileCheck -check-prefix=CHECK023 %s
81// CHECK023: "-cc1" {{.*}} "-target-cpu" "hexagonv60"
82// CHECK023: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0
83
84// RUN: %clang -### -target hexagon-unknown-elf \
85// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
86// RUN:   -mcpu=hexagonv62 \
87// RUN:   %s 2>&1 \
88// RUN:   | FileCheck -check-prefix=CHECK024 %s
89// CHECK024: "-cc1" {{.*}} "-target-cpu" "hexagonv62"
90// CHECK024: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v62/crt0
91
92// RUN: %clang -### -target hexagon-unknown-elf \
93// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
94// RUN:   -mcpu=hexagonv65 \
95// RUN:   %s 2>&1 \
96// RUN:   | FileCheck -check-prefix=CHECK025 %s
97// CHECK025: "-cc1" {{.*}} "-target-cpu" "hexagonv65"
98// CHECK025: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v65/crt0
99
100// RUN: %clang -### -target hexagon-unknown-elf \
101// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
102// RUN:   -mcpu=hexagonv66 \
103// RUN:   %s 2>&1 \
104// RUN:   | FileCheck -check-prefix=CHECK026 %s
105// CHECK026: "-cc1" {{.*}} "-target-cpu" "hexagonv66"
106// CHECK026: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v66/crt0
107
108// RUN: %clang -### -target hexagon-unknown-elf \
109// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
110// RUN:   -O3 \
111// RUN:   %s 2>&1 \
112// RUN:   | FileCheck -check-prefix=CHECK027 %s
113// CHECK027-NOT: "-ffp-contract=fast"
114// CHECK027: {{hexagon-link|ld}}
115
116// RUN: %clang -### -target hexagon-unknown-elf \
117// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
118// RUN:   -O3 -ffp-contract=off \
119// RUN:   %s 2>&1 \
120// RUN:   | FileCheck -check-prefix=CHECK028 %s
121// CHECK028-NOT: "-ffp-contract=fast"
122// CHECK028: {{hexagon-link|ld}}
123
124// -----------------------------------------------------------------------------
125// Test Linker related args
126// -----------------------------------------------------------------------------
127
128// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
129// Defaults for C
130// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
131// RUN: %clang -### -target hexagon-unknown-elf \
132// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
133// RUN:   -mcpu=hexagonv60 \
134// RUN:   %s 2>&1 \
135// RUN:   | FileCheck -check-prefix=CHECK030 %s
136// CHECK030: "-cc1"
137// CHECK030: {{hexagon-link|ld}}
138// CHECK030-NOT: "-static"
139// CHECK030-NOT: "-shared"
140// CHECK030: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
141// CHECK030: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
142// CHECK030: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
143// CHECK030: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
144// CHECK030: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
145// CHECK030: "{{[^"]+}}.o"
146// CHECK030: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group"
147// CHECK030: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
148
149// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
150// Defaults for C++
151// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
152// RUN: %clangxx -### -target hexagon-unknown-elf \
153// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
154// RUN:   -mcpu=hexagonv60 \
155// RUN:   %s 2>&1 \
156// RUN:   | FileCheck -check-prefix=CHECK031 %s
157// CHECK031: "-cc1"
158// CHECK031: {{hexagon-link|ld}}
159// CHECK031-NOT: "-static"
160// CHECK031-NOT: "-shared"
161// CHECK031: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
162// CHECK031: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
163// CHECK031: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
164// CHECK031: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
165// CHECK031: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
166// CHECK031: "{{[^"]+}}.o"
167// CHECK031: "-lstdc++" "-lm"
168// CHECK031: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group"
169// CHECK031: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
170
171// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
172// Additional Libraries (-L)
173// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
174// RUN: %clang -### -target hexagon-unknown-elf \
175// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
176// RUN:   -mcpu=hexagonv60 \
177// RUN:   -Lone -L two -L three \
178// RUN:   %s 2>&1 \
179// RUN:   | FileCheck -check-prefix=CHECK032 %s
180// CHECK032: "-cc1"
181// CHECK032: {{hexagon-link|ld}}
182// CHECK032-NOT: "-static"
183// CHECK032-NOT: "-shared"
184// CHECK032: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
185// CHECK032: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
186// CHECK032: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
187// CHECK032: "-Lone" "-Ltwo" "-Lthree"
188// CHECK032: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
189// CHECK032: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
190// CHECK032: "{{[^"]+}}.o"
191// CHECK032: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group"
192// CHECK032: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
193
194// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
195// -static, -shared
196// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
197// RUN: %clang -### -target hexagon-unknown-elf \
198// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
199// RUN:   -mcpu=hexagonv60 \
200// RUN:   -static \
201// RUN:   %s 2>&1 \
202// RUN:   | FileCheck -check-prefix=CHECK033 %s
203// CHECK033: "-cc1"
204// CHECK033: {{hexagon-link|ld}}
205// CHECK033: "-static"
206// CHECK033: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
207// CHECK033: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
208// CHECK033: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
209// CHECK033: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
210// CHECK033: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
211// CHECK033: "{{[^"]+}}.o"
212// CHECK033: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group"
213// CHECK033: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
214
215// RUN: %clang -### -target hexagon-unknown-elf \
216// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
217// RUN:   -mcpu=hexagonv60 \
218// RUN:   -shared \
219// RUN:   %s 2>&1 \
220// RUN:   | FileCheck -check-prefix=CHECK034 %s
221// CHECK034: "-cc1"
222// CHECK034: {{hexagon-link|ld}}
223// CHECK034: "-shared" "-call_shared"
224// CHECK034-NOT: crt0_standalone.o
225// CHECK034-NOT: crt0.o
226// CHECK034: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0/pic/initS.o"
227// CHECK034: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0"
228// CHECK034: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
229// CHECK034: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
230// CHECK034: "{{[^"]+}}.o"
231// CHECK034: "--start-group"
232// CHECK034-NOT: "-lstandalone"
233// CHECK034-NOT: "-lc"
234// CHECK034: "-lgcc"
235// CHECK034: "--end-group"
236// CHECK034: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0/pic/finiS.o"
237
238// RUN: %clang -### -target hexagon-unknown-elf \
239// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
240// RUN:   -mcpu=hexagonv60 \
241// RUN:   -shared \
242// RUN:   -static \
243// RUN:   %s 2>&1 \
244// RUN:   | FileCheck -check-prefix=CHECK035 %s
245// CHECK035: "-cc1"
246// CHECK035: {{hexagon-link|ld}}
247// CHECK035: "-shared" "-call_shared" "-static"
248// CHECK035-NOT: crt0_standalone.o
249// CHECK035-NOT: crt0.o
250// CHECK035: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0/init.o"
251// CHECK035: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0"
252// CHECK035: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
253// CHECK035: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
254// CHECK035: "{{[^"]+}}.o"
255// CHECK035: "--start-group"
256// CHECK035-NOT: "-lstandalone"
257// CHECK035-NOT: "-lc"
258// CHECK035: "-lgcc"
259// CHECK035: "--end-group"
260// CHECK035: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0/fini.o"
261
262// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
263// -nostdlib, -nostartfiles, -nodefaultlibs
264// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
265// RUN: %clangxx -### -target hexagon-unknown-elf \
266// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
267// RUN:   -mcpu=hexagonv60 \
268// RUN:   -nostdlib \
269// RUN:   %s 2>&1 \
270// RUN:   | FileCheck -check-prefix=CHECK036 %s
271// CHECK036: "-cc1"
272// CHECK036: {{hexagon-link|ld}}
273// CHECK036-NOT: crt0_standalone.o
274// CHECK036-NOT: crt0.o
275// CHECK036-NOT: init.o
276// CHECK036: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
277// CHECK036: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
278// CHECK036: "{{[^"]+}}.o"
279// CHECK036-NOT: "-lstdc++"
280// CHECK036-NOT: "-lm"
281// CHECK036-NOT: "--start-group"
282// CHECK036-NOT: "-lstandalone"
283// CHECK036-NOT: "-lc"
284// CHECK036-NOT: "-lgcc"
285// CHECK036-NOT: "--end-group"
286// CHECK036-NOT: fini.o
287
288// RUN: %clangxx -### -target hexagon-unknown-elf \
289// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
290// RUN:   -mcpu=hexagonv60 \
291// RUN:   -nostartfiles \
292// RUN:   %s 2>&1 \
293// RUN:   | FileCheck -check-prefix=CHECK037 %s
294// CHECK037: "-cc1"
295// CHECK037: {{hexagon-link|ld}}
296// CHECK037-NOT: crt0_standalone.o
297// CHECK037-NOT: crt0.o
298// CHECK037-NOT: init.o
299// CHECK037: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
300// CHECK037: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
301// CHECK037: "{{[^"]+}}.o"
302// CHECK037: "-lstdc++"
303// CHECK037: "-lm"
304// CHECK037: "--start-group"
305// CHECK037: "-lstandalone"
306// CHECK037: "-lc"
307// CHECK037: "-lgcc"
308// CHECK037: "--end-group"
309// CHECK037-NOT: fini.o
310
311// RUN: %clangxx -### -target hexagon-unknown-elf \
312// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
313// RUN:   -mcpu=hexagonv60 \
314// RUN:   -nodefaultlibs \
315// RUN:   %s 2>&1 \
316// RUN:   | FileCheck -check-prefix=CHECK038 %s
317// CHECK038: "-cc1"
318// CHECK038: {{hexagon-link|ld}}
319// CHECK038: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
320// CHECK038: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
321// CHECK038: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
322// CHECK038: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
323// CHECK038: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
324// CHECK038: "{{[^"]+}}.o"
325// CHECK038-NOT: "-lstdc++"
326// CHECK038-NOT: "-lm"
327// CHECK038-NOT: "--start-group"
328// CHECK038-NOT: "-lstandalone"
329// CHECK038-NOT: "-lc"
330// CHECK038-NOT: "-lgcc"
331// CHECK038-NOT: "--end-group"
332// CHECK038: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
333
334// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
335// -moslib
336// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
337// RUN: %clang -### -target hexagon-unknown-elf \
338// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
339// RUN:   -mcpu=hexagonv60 \
340// RUN:   -moslib=first -moslib=second \
341// RUN:   %s 2>&1 \
342// RUN:   | FileCheck -check-prefix=CHECK039 %s
343// CHECK039: "-cc1"
344// CHECK039: {{hexagon-link|ld}}
345// CHECK039-NOT: "-static"
346// CHECK039-NOT: "-shared"
347// CHECK039-NOT: crt0_standalone.o
348// CHECK039: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
349// CHECK039: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
350// CHECK039: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
351// CHECK039: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
352// CHECK039: "{{[^"]+}}.o"
353// CHECK039: "--start-group"
354// CHECK039: "-lfirst" "-lsecond"
355// CHECK039-NOT: "-lstandalone"
356// CHECK039: "-lc" "-lgcc" "--end-group"
357// CHECK039: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
358
359// RUN: %clang -### -target hexagon-unknown-elf \
360// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
361// RUN:   -mcpu=hexagonv60 \
362// RUN:   -moslib=first -moslib=second -moslib=standalone \
363// RUN:   %s 2>&1 \
364// RUN:   | FileCheck -check-prefix=CHECK03A %s
365// CHECK03A: "-cc1"
366// CHECK03A: {{hexagon-link|ld}}
367// CHECK03A-NOT: "-static"
368// CHECK03A-NOT: "-shared"
369// CHECK03A: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
370// CHECK03A: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
371// CHECK03A: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
372// CHECK03A: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
373// CHECK03A: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
374// CHECK03A: "{{[^"]+}}.o"
375// CHECK03A: "--start-group"
376// CHECK03A: "-lfirst" "-lsecond"
377// CHECK03A: "-lstandalone"
378// CHECK03A: "-lc" "-lgcc" "--end-group"
379// CHECK03A: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
380
381// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
382// Other args to pass to linker
383// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
384// RUN: %clangxx -### -target hexagon-unknown-elf \
385// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
386// RUN:   -mcpu=hexagonv60 \
387// RUN:   -s \
388// RUN:   -Tbss 0xdead -Tdata 0xbeef -Ttext 0xcafe \
389// RUN:   -t \
390// RUN:   -e start_here \
391// RUN:   -uFoo -undefined Bar \
392// RUN:   %s 2>&1 \
393// RUN:   | FileCheck -check-prefix=CHECK03B %s
394// CHECK03B: "-cc1"
395// CHECK03B: {{hexagon-link|ld}}
396// CHECK03B: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
397// CHECK03B: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
398// CHECK03B: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
399// CHECK03B: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
400// CHECK03B: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
401// CHECK03B: "-s"
402// CHECK03B: "-Tbss" "0xdead" "-Tdata" "0xbeef" "-Ttext" "0xcafe"
403// CHECK03B: "-t"
404// CHECK03B: "-u" "Foo" "-undefined" "Bar"
405// CHECK03B: "{{[^"]+}}.o"
406// CHECK03B: "-lstdc++" "-lm"
407// CHECK03B: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group"
408// CHECK03B: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
409
410// -----------------------------------------------------------------------------
411// pic, small data threshold
412// -----------------------------------------------------------------------------
413// RUN: %clang -### -target hexagon-unknown-elf \
414// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
415// RUN:   -mcpu=hexagonv60 \
416// RUN:   %s 2>&1 \
417// RUN:   | FileCheck -check-prefix=CHECK040 %s
418// CHECK040:      "-cc1"
419// CHECK040: {{hexagon-link|ld}}
420// CHECK040-NOT:  "-G{{[0-9]+}}"
421
422// RUN: %clang -### -target hexagon-unknown-elf \
423// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
424// RUN:   -mcpu=hexagonv60 \
425// RUN:   -fpic \
426// RUN:   %s 2>&1 \
427// RUN:   | FileCheck -check-prefix=CHECK041 %s
428// RUN: %clang -### -target hexagon-unknown-elf \
429// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
430// RUN:   -mcpu=hexagonv60 \
431// RUN:   -fPIC \
432// RUN:   %s 2>&1 \
433// RUN:   | FileCheck -check-prefix=CHECK041 %s
434// CHECK041:      "-cc1"
435// CHECK041-NOT:  "-mrelocation-model" "static"
436// CHECK041:      "-pic-level" "{{[12]}}"
437// CHECK041:      "-mllvm" "-hexagon-small-data-threshold=0"
438// CHECK041: {{hexagon-link|ld}}
439// CHECK041:      "-G0"
440
441// RUN: %clang -### -target hexagon-unknown-elf -fno-integrated-as \
442// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
443// RUN:   -mcpu=hexagonv60 \
444// RUN:   -G=8 \
445// RUN:   %s 2>&1 \
446// RUN:   | FileCheck -check-prefix=CHECK042 %s
447// RUN: %clang -### -target hexagon-unknown-elf -fno-integrated-as \
448// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
449// RUN:   -mcpu=hexagonv60 \
450// RUN:   -G 8 \
451// RUN:   %s 2>&1 \
452// RUN:   | FileCheck -check-prefix=CHECK042 %s
453// RUN: %clang -### -target hexagon-unknown-elf -fno-integrated-as \
454// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
455// RUN:   -mcpu=hexagonv60 \
456// RUN:   -msmall-data-threshold=8 \
457// RUN:   %s 2>&1 \
458// RUN:   | FileCheck -check-prefix=CHECK042 %s
459// CHECK042:      "-cc1"
460// CHECK042:      "-mrelocation-model" "static"
461// CHECK042:      "-mllvm" "-hexagon-small-data-threshold=8"
462// CHECK042-NEXT: llvm-mc
463// CHECK042:      "-gpsize=8"
464// CHECK042: {{hexagon-link|ld}}
465// CHECK042:      "-G8"
466
467// -----------------------------------------------------------------------------
468// pie
469// -----------------------------------------------------------------------------
470// RUN: %clang -### -target hexagon-unknown-elf \
471// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
472// RUN:   -mcpu=hexagonv60 \
473// RUN:   -pie \
474// RUN:   %s 2>&1 \
475// RUN:   | FileCheck -check-prefix=CHECK050 %s
476// CHECK050:      "-cc1"
477// CHECK050:      {{hexagon-link|ld}}
478// CHECK050:      "-pie"
479
480// RUN: %clang -### -target hexagon-unknown-elf \
481// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
482// RUN:   -mcpu=hexagonv60 \
483// RUN:   -pie -shared \
484// RUN:   %s 2>&1 \
485// RUN:   | FileCheck -check-prefix=CHECK051 %s
486// CHECK051:      "-cc1"
487// CHECK051       {{hexagon-link|ld}}
488// CHECK051-NOT:  "-pie"
489
490// -----------------------------------------------------------------------------
491// Test Assembler related args
492// -----------------------------------------------------------------------------
493// RUN: %clang -### -target hexagon-unknown-elf -fno-integrated-as    \
494// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
495// RUN:   -mcpu=hexagonv60 \
496// RUN:   -gdwarf-2 \
497// RUN:   -Wa,--noexecstack,--trap \
498// RUN:   -Xassembler --keep-locals \
499// RUN:   %s 2>&1 \
500// RUN:   | FileCheck -check-prefix=CHECK060 %s
501// CHECK060:      "-cc1"
502// CHECK060-NEXT: llvm-mc
503// CHECK060:      "--noexecstack" "--trap" "--keep-locals"
504// CHECK060       {{hexagon-link|ld}}
505
506// -----------------------------------------------------------------------------
507// ffixed-r19
508// -----------------------------------------------------------------------------
509// RUN: %clang -### -target hexagon-unknown-elf -ffixed-r19 %s 2>&1 \
510// RUN:        | FileCheck --check-prefix=CHECK070 %s
511// CHECK070: "-target-feature" "+reserved-r19"
512// RUN: %clang -### -target hexagon-unknown-elf %s 2>&1 \
513// RUN:        | FileCheck --check-prefix=CHECK071 %s
514// CHECK071-NOT: "+reserved-r19"
515
516// -----------------------------------------------------------------------------
517// Misc Defaults
518// -----------------------------------------------------------------------------
519// RUN: %clang -### -target hexagon-unknown-elf \
520// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
521// RUN:   -mcpu=hexagonv60 \
522// RUN:   %s 2>&1 \
523// RUN:   | FileCheck -check-prefix=CHECK080 %s
524// CHECK080:      "-cc1"
525// CHECK080:      "-Wreturn-type"
526