Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Driver / hexagon-toolchain-linux.c
blobfe32638417ea4ad8042273ac4dfde433cd225e09
1 // UNSUPPORTED: system-windows
3 // -----------------------------------------------------------------------------
4 // Passing --musl
5 // -----------------------------------------------------------------------------
6 // RUN: %clang -### --target=hexagon-unknown-linux-musl \
7 // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
8 // RUN: -mcpu=hexagonv60 \
9 // RUN: -fuse-ld=lld \
10 // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree %s 2>&1 | FileCheck -check-prefix=CHECK000 %s
11 // CHECK000-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crti.o
12 // CHECK000: "-dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1"
13 // CHECK000: "{{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o"
14 // CHECK000: "-lclang_rt.builtins-hexagon" "-lc"
15 // -----------------------------------------------------------------------------
16 // Passing --musl --shared
17 // -----------------------------------------------------------------------------
18 // RUN: %clang -### --target=hexagon-unknown-linux-musl \
19 // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
20 // RUN: -mcpu=hexagonv60 \
21 // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree -shared %s 2>&1 | FileCheck -check-prefix=CHECK001 %s
22 // CHECK001-NOT: -dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1
23 // CHECK001: "{{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crti.o"
24 // CHECK001: "-lclang_rt.builtins-hexagon" "-lc"
25 // CHECK001-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o
26 // -----------------------------------------------------------------------------
27 // Passing --musl -nostdlib
28 // -----------------------------------------------------------------------------
29 // RUN: %clang -### --target=hexagon-unknown-linux-musl \
30 // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
31 // RUN: -mcpu=hexagonv60 \
32 // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree -nostdlib %s 2>&1 | FileCheck -check-prefix=CHECK002 %s
33 // CHECK002: "-dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1"
34 // CHECK002-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crti.o
35 // CHECK002-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o
36 // CHECK002-NOT: "-lclang_rt.builtins-hexagon"
37 // CHECK002-NOT: "-lc"
38 // -----------------------------------------------------------------------------
39 // Passing --musl -nostartfiles
40 // -----------------------------------------------------------------------------
41 // RUN: %clang -### --target=hexagon-unknown-linux-musl \
42 // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
43 // RUN: -mcpu=hexagonv60 \
44 // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree -nostartfiles %s 2>&1 | FileCheck -check-prefix=CHECK003 %s
45 // CHECK003: "-dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1"
46 // CHECK003-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}Scrt1.o
47 // CHECK003-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o
48 // CHECK003: "-lclang_rt.builtins-hexagon" "-lc"
49 // -----------------------------------------------------------------------------
50 // Passing --musl -nodefaultlibs
51 // -----------------------------------------------------------------------------
52 // RUN: %clang -### --target=hexagon-unknown-linux-musl \
53 // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
54 // RUN: -mcpu=hexagonv60 \
55 // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree -nodefaultlibs %s 2>&1 | FileCheck -check-prefix=CHECK004 %s
56 // CHECK004: "-dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1"
57 // CHECK004: "{{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o"
58 // CHECK004-NOT: "-lclang_rt.builtins-hexagon"
59 // CHECK004-NOT: "-lc"
60 // -----------------------------------------------------------------------------
61 // Passing --musl -nolibc
62 // -----------------------------------------------------------------------------
63 // RUN: %clang -### --target=hexagon-unknown-linux-musl \
64 // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
65 // RUN: -mcpu=hexagonv60 --sysroot=%S/Inputs/basic_linux_libcxx_tree \
66 // RUN: -nolibc %s 2>&1 | FileCheck -check-prefix=CHECK-NOLIBC %s
67 // CHECK-NOLIBC: "-dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1"
68 // CHECK-NOLIBC-SAME: "{{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o"
69 // CHECK-NOLIBC-NOT: "-lc"
70 // -----------------------------------------------------------------------------
71 // Not Passing -fno-use-init-array when musl is selected
72 // -----------------------------------------------------------------------------
73 // RUN: %clang -### --target=hexagon-unknown-linux-musl \
74 // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
75 // RUN: -mcpu=hexagonv60 %s 2>&1 | FileCheck -check-prefix=CHECK005 %s
76 // CHECK005-NOT: -fno-use-init-array
77 // -----------------------------------------------------------------------------
78 // -----------------------------------------------------------------------------
79 // c++ when musl is selected
80 // -----------------------------------------------------------------------------
81 // RUN: %clangxx -### --target=hexagon-unknown-linux-musl \
82 // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
83 // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree \
84 // RUN: -mcpu=hexagonv60 %s 2>&1 | FileCheck -check-prefix=CHECK006 %s
85 // CHECK006: "-internal-isystem" "{{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1"
86 // -----------------------------------------------------------------------------
87 // c++ when musl is selected
88 // -----------------------------------------------------------------------------
89 // RUN: %clangxx -### --target=hexagon-unknown-elf \
90 // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
91 // RUN: -stdlib=libc++ \
92 // RUN: -mcpu=hexagonv60 %s 2>&1 | FileCheck -check-prefix=CHECK007 %s
93 // CHECK007: "-internal-isystem" "{{.*}}hexagon{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1"
94 // -----------------------------------------------------------------------------
95 // internal-isystem for linux with and without musl
96 // -----------------------------------------------------------------------------
97 // RUN: %clang -### --target=hexagon-unknown-linux-musl \
98 // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
99 // RUN: -resource-dir=%S/Inputs/resource_dir %s 2>&1 | FileCheck -check-prefix=CHECK008 %s
100 // CHECK008: InstalledDir: [[INSTALLED_DIR:.+]]
101 // CHECK008: "-resource-dir" "[[RESOURCE:[^"]+]]"
102 // CHECK008-SAME: {{^}} "-internal-isystem" "[[RESOURCE]]/include"
103 // CHECK008-SAME: {{^}} "-internal-externc-isystem" "[[INSTALLED_DIR]]/../target/hexagon/include"
105 // RUN: %clang -### --target=hexagon-unknown-linux \
106 // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
107 // RUN: -resource-dir=%S/Inputs/resource_dir %s 2>&1 | FileCheck -check-prefix=CHECK009 %s
108 // CHECK009: InstalledDir: [[INSTALLED_DIR:.+]]
109 // CHECK009: "-resource-dir" "[[RESOURCE:[^"]+]]"
110 // CHECK009-SAME: {{^}} "-internal-isystem" "[[RESOURCE]]/include"
111 // CHECK009-SAME: {{^}} "-internal-externc-isystem" "[[INSTALLED_DIR]]/../target/hexagon/include"
113 // RUN: %clang -Werror -L/tmp \
114 // RUN: --target=hexagon-unknown-linux-musl %s -### 2>&1 \
115 // RUN: | FileCheck -check-prefix=CHECK010 %s
116 // CHECK010: InstalledDir: [[INSTALLED_DIR:.+]]
117 // CHECK010-NOT: "-lstandalone"
118 // CHECK010-NOT: crt0_standalone.o
119 // CHECK010: crt1.o
120 // CHECK010: "-L/tmp"
121 // CHECK010-NOT: "-lstandalone"