1 // UNSUPPORTED: system-windows
3 // RUN: %clang %s -### --target=armv6m-none-eabi -o %t.out 2>&1 \
4 // RUN: -T semihosted.lds \
5 // RUN: -L some/directory/user/asked/for \
6 // RUN: --sysroot=%S/Inputs/baremetal_arm \
7 // RUN: | FileCheck --check-prefix=CHECK-V6M-C %s
8 // CHECK-V6M-C: "-cc1" "-triple" "thumbv6m-none-unknown-eabi"
9 // CHECK-V6M-C-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
10 // CHECK-V6M-C-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
11 // CHECK-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
12 // CHECk-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include"
13 // CHECK-V6M-C-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
14 // CHECK-V6M-C-NEXT: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
15 // CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
16 // CHECK-V6M-C-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}lib"
17 // CHECK-V6M-C-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
18 // CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m" "-o" "{{.*}}.tmp.out"
20 // RUN: %clang %s -### --target=armv6m-none-eabi -nostdlibinc -nobuiltininc 2>&1 \
21 // RUN: --sysroot=%S/Inputs/baremetal_arm | FileCheck --check-prefix=CHECK-V6M-LIBINC %s
22 // RUN: %clang %s -### --target=armv6m-none-eabi -nostdinc 2>&1 \
23 // RUN: --sysroot=%S/Inputs/baremetal_arm | FileCheck --check-prefix=CHECK-V6M-LIBINC %s
24 // CHECK-V6M-LIBINC-NOT: "-internal-isystem"
26 // RUN: %clang %s -### --target=armv7m-vendor-none-eabi -rtlib=compiler-rt 2>&1 \
27 // RUN: --sysroot=%S/Inputs/baremetal_arm \
28 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
29 // RUN: | FileCheck --check-prefix=CHECK-ARMV7M-PER-TARGET %s
30 // CHECK-ARMV7M-PER-TARGET: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
31 // CHECK-ARMV7M-PER-TARGET: "-isysroot" "[[SYSROOT:[^"]*]]"
32 // CHECK-ARMV7M-PER-TARGET: "-x" "c++" "{{.*}}baremetal.cpp"
33 // CHECK-ARMV7M-PER-TARGET: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
34 // CHECK-ARMV7M-PER-TARGET: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}lib"
35 // CHECK-ARMV7M-PER-TARGET: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}armv7m-vendor-none-eabi
36 // CHECK-ARMV7M-PER-TARGET: "-lc" "-lm" "-lclang_rt.builtins"
38 // RUN: %clangxx %s -### --target=armv6m-none-eabi 2>&1 \
39 // RUN: --sysroot=%S/Inputs/baremetal_arm | FileCheck --check-prefix=CHECK-V6M-DEFAULTCXX %s
40 // CHECK-V6M-DEFAULTCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
41 // CHECK-V6M-DEFAULTCXX: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
42 // CHECK-V6M-DEFAULTCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}baremetal_arm{{[/\\]+}}lib"
43 // CHECK-V6M-DEFAULTCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
44 // CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
45 // CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m" "-o" "a.out"
47 // RUN: %clangxx %s -### --target=armv6m-none-eabi -stdlib=libc++ 2>&1 \
48 // RUN: --sysroot=%S/Inputs/baremetal_arm | FileCheck --check-prefix=CHECK-V6M-LIBCXX %s
49 // CHECK-V6M-LIBCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
50 // CHECK-V6M-LIBCXX-NOT: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}{{[^v].*}}"
51 // CHECK-V6M-LIBCXX-SAME: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
52 // CHECK-V6M-LIBCXX: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
53 // CHECK-V6M-LIBCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}baremetal_arm{{[/\\]+}}lib"
54 // CHECK-V6M-LIBCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
55 // CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
56 // CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m" "-o" "a.out"
58 // RUN: %clangxx %s -### --target=armv6m-none-eabi 2>&1 \
59 // RUN: --sysroot=%S/Inputs/baremetal_arm \
60 // RUN: -stdlib=libstdc++ \
61 // RUN: | FileCheck --check-prefix=CHECK-V6M-LIBSTDCXX %s
62 // CHECK-V6M-LIBSTDCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
63 // CHECK-V6M-LIBSTDCXX-NOT: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
64 // CHECK-V6M-LIBSTDCXX-SAME: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}6.0.0"
65 // CHECK-V6M-LIBSTDCXX: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
66 // CHECK-V6M-LIBSTDCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}baremetal_arm{{[/\\]+}}lib"
67 // CHECK-V6M-LIBSTDCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
68 // CHECK-V6M-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
69 // CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m" "-o" "a.out"
71 // RUN: %clangxx %s -### --target=armv6m-none-eabi 2>&1 \
72 // RUN: --sysroot=%S/Inputs/baremetal_arm \
73 // RUN: -nodefaultlibs \
74 // RUN: | FileCheck --check-prefix=CHECK-V6M-NDL %s
75 // CHECK-V6M-NDL: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
76 // CHECK-V6M-NDL: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
77 // CHECK-V6M-NDL-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}baremetal_arm{{[/\\]+}}lib"
78 // CHECK-V6M-NDL-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
80 // RUN: rm -rf %T/baremetal_cxx_sysroot
81 // RUN: mkdir -p %T/baremetal_cxx_sysroot/usr/include/c++/v1
82 // RUN: %clangxx %s -### 2>&1 \
83 // RUN: --target=armv6m-none-eabi \
84 // RUN: --sysroot=%T/baremetal_cxx_sysroot \
85 // RUN: -stdlib=libc++ \
86 // RUN: | FileCheck --check-prefix=CHECK-V6M-LIBCXX-USR %s
87 // CHECK-V6M-LIBCXX-USR: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
88 // CHECK-V6M-LIBCXX-USR-NOT: "-internal-isystem" "{{[^"]+}}baremetal_cxx_sysroot{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}{{[^v].*}}"
89 // CHECK-V6M-LIBCXX-USR-SAME: "-internal-isystem" "{{[^"]+}}baremetal_cxx_sysroot{{[/\\]+}}usr{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
90 // CHECK-V6M-LIBCXX-USR: "{{[^"]*}}-Bstatic"
91 // CHECK-V6M-LIBCXX-USR-SAME: "-L{{[^"]*}}{{[/\\]+}}baremetal_cxx_sysroot{{[/\\]+}}lib"
92 // CHECK-V6M-LIBCXX-USR-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
93 // CHECK-V6M-LIBCXX-USR-SAME: "-lc++" "-lc++abi" "-lunwind"
94 // CHECK-V6M-LIBCXX-USR-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
96 // RUN: %clangxx --target=arm-none-eabi -v 2>&1 \
97 // RUN: | FileCheck %s --check-prefix=CHECK-THREAD-MODEL
98 // CHECK-THREAD-MODEL: Thread model: posix
100 // RUN: %clangxx --target=arm-none-eabi -mthread-model single -v 2>&1 \
101 // RUN: | FileCheck %s --check-prefix=CHECK-THREAD-MODEL-SINGLE
102 // CHECK-THREAD-MODEL-SINGLE: Thread model: single
104 // RUN: %clangxx --target=arm-none-eabi -mthread-model posix -v 2>&1 \
105 // RUN: | FileCheck %s --check-prefix=CHECK-THREAD-MODEL-POSIX
106 // CHECK-THREAD-MODEL-POSIX: Thread model: posix
108 // RUN: %clang -### --target=arm-none-eabi -rtlib=libgcc -v %s 2>&1 \
109 // RUN: | FileCheck %s --check-prefix=CHECK-RTLIB-GCC
110 // CHECK-RTLIB-GCC: -lgcc
112 // RUN: %clang -### --target=arm-none-eabi -v %s 2>&1 \
113 // RUN: | FileCheck %s --check-prefix=CHECK-SYSROOT-INC
114 // CHECK-SYSROOT-INC-NOT: "-internal-isystem" "include"
116 // RUN: %clang -no-canonical-prefixes %s -### --target=aarch64-none-elf 2>&1 \
117 // RUN: | FileCheck --check-prefix=CHECK-AARCH64-NO-HOST-INC %s
118 // Verify that the bare metal driver does not include any host system paths:
119 // CHECK-AARCH64-NO-HOST-INC: InstalledDir: [[INSTALLEDDIR:.+]]
120 // CHECK-AARCH64-NO-HOST-INC: "-resource-dir" "[[RESOURCE:[^"]+]]"
121 // CHECK-AARCH64-NO-HOST-INC-SAME: "-internal-isystem" "[[INSTALLEDDIR]]{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}clang-runtimes{{[/\\]+}}aarch64-none-elf{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
122 // CHECK-AARCH64-NO-HOST-INC-SAME: "-internal-isystem" "[[RESOURCE]]{{[/\\]+}}include"
123 // CHECK-AARCH64-NO-HOST-INC-SAME: "-internal-isystem" "[[INSTALLEDDIR]]{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}clang-runtimes{{[/\\]+}}aarch64-none-elf{{[/\\]+}}include"
125 // RUN: %clang %s -### --target=riscv64-unknown-elf -o %t.out -L some/directory/user/asked/for \
126 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf 2>&1 \
127 // RUN: | FileCheck --check-prefix=CHECK-RV64 %s
128 // CHECK-RV64: "-cc1" "-triple" "riscv64-unknown-unknown-elf"
129 // CHECK-RV64-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
130 // CHECK-RV64-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
131 // CHECK-RV64-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
132 // CHECk-RV64-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include"
133 // CHECK-RV64-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
134 // CHECK-RV64-NEXT: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
135 // CHECK-RV64-SAME: "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
136 // CHECK-RV64-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}lib"
137 // CHECK-RV64-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
138 // CHECK-RV64-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv64" "-o" "{{.*}}.tmp.out"
140 // RUN: %clangxx %s -### --target=riscv64-unknown-elf 2>&1 \
141 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
142 // RUN: | FileCheck --check-prefix=CHECK-RV64-DEFAULTCXX %s
143 // CHECK-RV64-DEFAULTCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
144 // CHECK-RV64-DEFAULTCXX: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
145 // CHECK-RV64-DEFAULTCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}basic_riscv64_tree{{[/\\]+}}riscv64-unknown-elf{{[/\\]+}}lib"
146 // CHECK-RV64-DEFAULTCXX-SAME: "-L[[RESOURCE_DIR]]{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
147 // CHECK-RV64-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
148 // CHECK-RV64-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv64" "-o" "a.out"
150 // RUN: %clangxx %s -### --target=riscv64-unknown-elf 2>&1 \
151 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
152 // RUN: -stdlib=libc++ \
153 // RUN: | FileCheck --check-prefix=CHECK-RV64-LIBCXX %s
154 // CHECK-RV64-LIBCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
155 // CHECK-RV64-LIBCXX-NOT: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}{{[^v].*}}"
156 // CHECK-RV64-LIBCXX-SAME: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
157 // CHECK-RV64-LIBCXX: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
158 // CHECK-RV64-LIBCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}basic_riscv64_tree{{[/\\]+}}riscv64-unknown-elf{{[/\\]+}}lib"
159 // CHECK-RV64-LIBCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
160 // CHECK-RV64-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
161 // CHECK-RV64-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv64" "-o" "a.out"
163 // RUN: %clangxx %s -### 2>&1 --target=riscv64-unknown-elf \
164 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
165 // RUN: -stdlib=libstdc++ \
166 // RUN: | FileCheck --check-prefix=CHECK-RV64-LIBSTDCXX %s
167 // CHECK-RV64-LIBSTDCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
168 // CHECK-RV64-LIBSTDCXX-NOT: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
169 // CHECK-RV64-LIBSTDCXX-SAME: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}8.0.1"
170 // CHECK-RV64-LIBSTDCXX: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
171 // CHECK-RV64-LIBSTDCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}basic_riscv64_tree{{[/\\]+}}riscv64-unknown-elf{{[/\\]+}}lib"
172 // CHECK-RV64-LIBSTDCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
173 // CHECK-RV64-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
174 // CHECK-RV64-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv64" "-o" "a.out"
176 // RUN: %clang %s -### 2>&1 --target=riscv32-unknown-elf \
177 // RUN: -L some/directory/user/asked/for \
178 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
179 // RUN: | FileCheck --check-prefix=CHECK-RV32 %s
180 // CHECK-RV32: "-cc1" "-triple" "riscv32-unknown-unknown-elf"
181 // CHECK-RV32-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
182 // CHECK-RV32-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
183 // CHECK-RV32-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
184 // CHECK-RV32-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include"
185 // CHECK-RV32-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
186 // CHECK-RV32-NEXT: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
187 // CHECK-RV32-SAME: "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
188 // CHECK-RV32-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}lib"
189 // CHECK-RV32-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
190 // CHECK-RV32-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv32" "-o" "a.out"
192 // RUN: %clangxx %s -### 2>&1 --target=riscv32-unknown-elf \
193 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
194 // RUN: | FileCheck --check-prefix=CHECK-RV32-DEFAULTCXX %s
195 // CHECK-RV32-DEFAULTCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
196 // CHECK-RV32-DEFAULTCXX: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
197 // CHECK-RV32-DEFAULTCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}basic_riscv32_tree{{[/\\]+}}riscv32-unknown-elf{{[/\\]+}}lib"
198 // CHECK-RV32-DEFAULTCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
199 // CHECK-RV32-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
200 // CHECK-RV32-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv32" "-o" "a.out"
202 // RUN: %clangxx %s -### 2>&1 --target=riscv32-unknown-elf \
203 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
204 // RUN: -stdlib=libc++ \
205 // RUN: | FileCheck --check-prefix=CHECK-RV32-LIBCXX %s
206 // CHECK-RV32-LIBCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
207 // CHECK-RV32-LIBCXX-NOT: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}{{[^v].*}}"
208 // CHECK-RV32-LIBCXX-SAME: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
209 // CHECK-RV32-LIBCXX: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
210 // CHECK-RV32-LIBCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}basic_riscv32_tree{{[/\\]+}}riscv32-unknown-elf{{[/\\]+}}lib"
211 // CHECK-RV32-LIBCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
212 // CHECK-RV32-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
213 // CHECK-RV32-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv32" "-o" "a.out"
215 // RUN: %clangxx %s -### 2>&1 --target=riscv32-unknown-elf \
216 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
217 // RUN: -stdlib=libstdc++ \
218 // RUN: | FileCheck --check-prefix=CHECK-RV32-LIBSTDCXX %s
219 // CHECK-RV32-LIBSTDCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
220 // CHECK-RV32-LIBSTDCXX-NOT: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
221 // CHECK-RV32-LIBSTDCXX-SAME: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}8.0.1"
222 // CHECK-RV32-LIBSTDCXX: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
223 // CHECK-RV32-LIBSTDCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}basic_riscv32_tree{{[/\\]+}}riscv32-unknown-elf{{[/\\]+}}lib"
224 // CHECK-RV32-LIBSTDCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
225 // CHECK-RV32-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
226 // CHECK-RV32-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv32" "-o" "a.out"
228 // RUN: %clang %s -### 2>&1 --target=riscv64-unknown-elf \
229 // RUN: -nostdlibinc -nobuiltininc \
230 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
231 // RUN: | FileCheck --check-prefix=CHECK-RV64-LIBINC %s
233 // RUN: %clang %s -### 2>&1 --target=riscv64-unknown-elf -nostdinc \
234 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
235 // RUN: | FileCheck --check-prefix=CHECK-RV64-LIBINC %s
236 // CHECK-RV64-LIBINC-NOT: "-internal-isystem"
238 // RUN: %clangxx %s -### 2>&1 --target=riscv64-unknown-elf \
239 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
240 // RUN: -nodefaultlibs \
241 // RUN: | FileCheck --check-prefix=CHECK-RV64-NDL %s
242 // CHECK-RV64-NDL: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
243 // CHECK-RV64-NDL: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
244 // CHECK-RV64-NDL-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}basic_riscv64_tree{{[/\\]+}}riscv64-unknown-elf{{[/\\]+}}lib"
245 // CHECK-RV64-NDL-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
247 // RUN: %clang %s -### 2>&1 --target=riscv64-unknown-elf \
248 // RUN: -march=rv64imafdc -mabi=lp64d \
249 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
250 // RUN: | FileCheck --check-prefix=CHECK-RV64FD %s
252 // RUN: %clang %s -### 2>&1 --target=riscv64-unknown-elf \
253 // RUN: -march=rv64gc -mabi=lp64d \
254 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
255 // RUN: | FileCheck --check-prefix=CHECK-RV64FD %s
257 // CHECK-RV64FD: "-cc1" "-triple" "riscv64-unknown-unknown-elf"
258 // CHECK-RV64FD-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
259 // CHECK-RV64FD-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
260 // CHECK-RV64FD-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv64imafdc{{[/\\]+}}lp64d{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
261 // CHECk-RV64FD-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv64imafdc{{[/\\]+}}lp64d{{[/\\]+}}include"
262 // CHECK-RV64FD-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
263 // CHECK-RV64FD-NEXT: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
264 // CHECK-RV64FD-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}rv64imafdc{{[/\\]+}}lp64d{{[/\\]+}}lib"
265 // CHECK-RV64FD-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal{{[/\\]+}}rv64imafdc{{[/\\]+}}lp64d"
267 // RUN: %clang %s -### 2>&1 --target=riscv32-unknown-elf \
268 // RUN: -march=rv32i -mabi=ilp32 \
269 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
270 // RUN: | FileCheck --check-prefix=CHECK-RV32I %s
272 // RUN: %clang %s -### 2>&1 --target=riscv32-unknown-elf \
273 // RUN: -march=rv32ic -mabi=ilp32 \
274 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
275 // RUN: | FileCheck --check-prefix=CHECK-RV32I %s
277 // CHECK-RV32I: "-cc1" "-triple" "riscv32-unknown-unknown-elf"
278 // CHECK-RV32I-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
279 // CHECK-RV32I-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
280 // CHECK-RV32I-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32i{{[/\\]+}}ilp32{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
281 // CHECK-RV32I-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32i{{[/\\]+}}ilp32{{[/\\]+}}include"
282 // CHECK-RV32I-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
283 // CHECK-RV32I-NEXT: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
284 // CHECK-RV32I-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}rv32i{{[/\\]+}}ilp32{{[/\\]+}}lib"
285 // CHECK-RV32I-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal{{[/\\]+}}rv32i{{[/\\]+}}ilp32"
287 // RUN: %clang %s -### 2>&1 --target=riscv32-unknown-elf \
288 // RUN: -march=rv32im -mabi=ilp32 \
289 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
290 // RUN: | FileCheck --check-prefix=CHECK-RV32IM %s
292 // RUN: %clang %s -### 2>&1 --target=riscv32-unknown-elf \
293 // RUN: -march=rv32imc -mabi=ilp32 \
294 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
295 // RUN: | FileCheck --check-prefix=CHECK-RV32IM %s
297 // CHECK-RV32IM: "-cc1" "-triple" "riscv32-unknown-unknown-elf"
298 // CHECK-RV32IM-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
299 // CHECK-RV32IM-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
300 // CHECK-RV32IM-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32im{{[/\\]+}}ilp32{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
301 // CHECK-RV32IM-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32im{{[/\\]+}}ilp32{{[/\\]+}}include"
302 // CHECK-RV32IM-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
303 // CHECK-RV32IM-NEXT: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
304 // CHECK-RV32IM-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}rv32im{{[/\\]+}}ilp32{{[/\\]+}}lib"
305 // CHECK-RV32IM-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal{{[/\\]+}}rv32im{{[/\\]+}}ilp32"
307 // RUN: %clang %s -### 2>&1 --target=riscv32-unknown-elf \
308 // RUN: -march=rv32iac -mabi=ilp32 \
309 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
310 // RUN: | FileCheck --check-prefix=CHECK-RV32IAC %s
312 // CHECK-RV32IAC: "-cc1" "-triple" "riscv32-unknown-unknown-elf"
313 // CHECK-RV32IAC-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
314 // CHECK-RV32IAC-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
315 // CHECK-RV32IAC-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32iac{{[/\\]+}}ilp32{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
316 // CHECK-RV32IAC-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32iac{{[/\\]+}}ilp32{{[/\\]+}}include"
317 // CHECK-RV32IAC-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
318 // CHECK-RV32IAC-NEXT: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
319 // CHECK-RV32IAC-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}rv32iac{{[/\\]+}}ilp32{{[/\\]+}}lib"
320 // CHECK-RV32IAC-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal{{[/\\]+}}rv32iac{{[/\\]+}}ilp32"
322 // RUN: %clang %s -### 2>&1 --target=riscv32-unknown-elf -march=rv32imafc -mabi=ilp32f \
323 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
324 // RUN: | FileCheck --check-prefix=CHECK-RV32IMAFC %s
326 // RUN: %clang %s -### 2>&1 --target=riscv32-unknown-elf -march=rv32imafdc -mabi=ilp32f \
327 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
328 // RUN: | FileCheck --check-prefix=CHECK-RV32IMAFC %s
330 // RUN: %clang %s -### 2>&1 --target=riscv32-unknown-elf -march=rv32gc -mabi=ilp32f \
331 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
332 // RUN: | FileCheck --check-prefix=CHECK-RV32IMAFC %s
334 // CHECK-RV32IMAFC: "-cc1" "-triple" "riscv32-unknown-unknown-elf"
335 // CHECK-RV32IMAFC-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
336 // CHECK-RV32IMAFC-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
337 // CHECK-RV32IMAFC-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32imafc{{[/\\]+}}ilp32f{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
338 // CHECK-RV32IMAFC-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32imafc{{[/\\]+}}ilp32f{{[/\\]+}}include"
339 // CHECK-RV32IMAFC-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
340 // CHECK-RV32IMAFC-NEXT: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
341 // CHECK-RV32IMAFC-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}rv32imafc{{[/\\]+}}ilp32f{{[/\\]+}}lib"
342 // CHECK-RV32IMAFC-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal{{[/\\]+}}rv32imafc{{[/\\]+}}ilp32f"
344 // Check that compiler-rt library without the arch filename suffix will
345 // be used if present.
346 // RUN: rm -rf %T/baremetal_clang_rt_noarch
347 // RUN: mkdir -p %T/baremetal_clang_rt_noarch/lib
348 // RUN: touch %T/baremetal_clang_rt_noarch/lib/libclang_rt.builtins.a
349 // RUN: %clang %s -### 2>&1 \
350 // RUN: --target=armv6m-none-eabi \
351 // RUN: --sysroot=%T/baremetal_clang_rt_noarch \
352 // RUN: | FileCheck --check-prefix=CHECK-CLANGRT-NOARCH %s
353 // CHECK-CLANGRT-NOARCH: "-lclang_rt.builtins"
354 // CHECK-CLANGRT-NOARCH-NOT: "-lclang_rt.builtins-armv6m"
356 // Check that compiler-rt library with the arch filename suffix will be
358 // RUN: rm -rf %T/baremetal_clang_rt_arch
359 // RUN: mkdir -p %T/baremetal_clang_rt_arch/lib
360 // RUN: touch %T/baremetal_clang_rt_arch/lib/libclang_rt.builtins-armv6m.a
361 // RUN: %clang %s -### 2>&1 \
362 // RUN: --target=armv6m-none-eabi \
363 // RUN: --sysroot=%T/baremetal_clang_rt_arch \
364 // RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARCH %s
365 // CHECK-CLANGRT-ARCH: "-lclang_rt.builtins-armv6m"
366 // CHECK-CLANGRT-ARCH-NOT: "-lclang_rt.builtins"