[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Driver / baremetal.cpp
blob53c666d3a91a9d31384fb2a27d48256c0e14854d
1 // UNSUPPORTED: system-windows
3 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
4 // RUN: -target armv6m-none-eabi \
5 // RUN: -T semihosted.lds \
6 // RUN: -L some/directory/user/asked/for \
7 // RUN: --sysroot=%S/Inputs/baremetal_arm \
8 // RUN: | FileCheck --check-prefix=CHECK-V6M-C %s
9 // CHECK-V6M-C: "[[PREFIX_DIR:.*]]{{[/\\]+}}{{[^/^\\]+}}{{[/\\]+}}clang{{.*}}" "-cc1" "-triple" "thumbv6m-none-unknown-eabi"
10 // CHECK-V6M-C-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
11 // CHECK-V6M-C-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
12 // CHECK-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
13 // CHECk-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include"
14 // CHECK-V6M-C-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
15 // CHECK-V6M-C-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
16 // CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
17 // CHECK-V6M-C-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}lib"
18 // CHECK-V6M-C-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
19 // CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
20 // CHECK-V6M-C-SAME: "-o" "{{.*}}.o"
22 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
23 // RUN: -target armv6m-none-eabi \
24 // RUN: -nostdlibinc -nobuiltininc \
25 // RUN: --sysroot=%S/Inputs/baremetal_arm \
26 // RUN: | FileCheck --check-prefix=CHECK-V6M-LIBINC %s
27 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
28 // RUN: -target armv6m-none-eabi \
29 // RUN: -nostdinc \
30 // RUN: --sysroot=%S/Inputs/baremetal_arm \
31 // RUN: | FileCheck --check-prefix=CHECK-V6M-LIBINC %s
32 // CHECK-V6M-LIBINC-NOT: "-internal-isystem"
34 // RUN: %clang -no-canonical-prefixes -rtlib=compiler-rt %s -### -o %t.o 2>&1 \
35 // RUN: -target armv7m-vendor-none-eabi \
36 // RUN: --sysroot=%S/Inputs/baremetal_arm \
37 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
38 // RUN: | FileCheck --check-prefix=CHECK-ARMV7M-PER-TARGET %s
39 // CHECK-ARMV7M-PER-TARGET: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
40 // CHECK-ARMV7M-PER-TARGET: "-isysroot" "[[SYSROOT:[^"]*]]"
41 // CHECK-ARMV7M-PER-TARGET: "-x" "c++" "{{.*}}baremetal.cpp"
42 // CHECK-ARMV7M-PER-TARGET: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
43 // CHECK-ARMV7M-PER-TARGET: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}lib"
44 // CHECK-ARMV7M-PER-TARGET: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}armv7m-vendor-none-eabi
45 // CHECK-ARMV7M-PER-TARGET: "-lc" "-lm" "-lclang_rt.builtins"
46 // CHECK-ARMV7M-PER-TARGET: "-o" "{{.*}}.o"
48 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
49 // RUN: -target armv6m-none-eabi \
50 // RUN: --sysroot=%S/Inputs/baremetal_arm \
51 // RUN: | FileCheck --check-prefix=CHECK-V6M-DEFAULTCXX %s
52 // CHECK-V6M-DEFAULTCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
53 // CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
54 // CHECK-V6M-DEFAULTCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}baremetal_arm{{[/\\]+}}lib"
55 // CHECK-V6M-DEFAULTCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
56 // CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
57 // CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
58 // CHECK-V6M-DEFAULTCXX-SAME: "-o" "{{.*}}.o"
60 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
61 // RUN: -target armv6m-none-eabi \
62 // RUN: --sysroot=%S/Inputs/baremetal_arm \
63 // RUN: -stdlib=libc++ \
64 // RUN: | FileCheck --check-prefix=CHECK-V6M-LIBCXX %s
65 // CHECK-V6M-LIBCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
66 // CHECK-V6M-LIBCXX-NOT: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}{{[^v].*}}"
67 // CHECK-V6M-LIBCXX-SAME: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
68 // CHECK-V6M-LIBCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
69 // CHECK-V6M-LIBCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}baremetal_arm{{[/\\]+}}lib"
70 // CHECK-V6M-LIBCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
71 // CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
72 // CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
73 // CHECK-V6M-LIBCXX-SAME: "-o" "{{.*}}.o"
75 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
76 // RUN: -target armv6m-none-eabi \
77 // RUN: --sysroot=%S/Inputs/baremetal_arm \
78 // RUN: -stdlib=libstdc++ \
79 // RUN: | FileCheck --check-prefix=CHECK-V6M-LIBSTDCXX %s
80 // CHECK-V6M-LIBSTDCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
81 // CHECK-V6M-LIBSTDCXX-NOT: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
82 // CHECK-V6M-LIBSTDCXX-SAME: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}6.0.0"
83 // CHECK-V6M-LIBSTDCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
84 // CHECK-V6M-LIBSTDCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}baremetal_arm{{[/\\]+}}lib"
85 // CHECK-V6M-LIBSTDCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
86 // CHECK-V6M-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
87 // CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
88 // CHECK-V6M-LIBSTDCXX-SAME: "-o" "{{.*}}.o"
90 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
91 // RUN: -target armv6m-none-eabi \
92 // RUN: --sysroot=%S/Inputs/baremetal_arm \
93 // RUN: -nodefaultlibs \
94 // RUN: | FileCheck --check-prefix=CHECK-V6M-NDL %s
95 // CHECK-V6M-NDL: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
96 // CHECK-V6M-NDL: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
97 // CHECK-V6M-NDL-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}baremetal_arm{{[/\\]+}}lib"
98 // CHECK-V6M-NDL-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
99 // CHECK-V6M-NDL-SAME: "-o" "{{.*}}.o"
101 // RUN: %clangxx -target arm-none-eabi -v 2>&1 \
102 // RUN: | FileCheck %s --check-prefix=CHECK-THREAD-MODEL
103 // CHECK-THREAD-MODEL: Thread model: posix
105 // RUN: %clangxx -target arm-none-eabi -mthread-model single -v 2>&1 \
106 // RUN: | FileCheck %s --check-prefix=CHECK-THREAD-MODEL-SINGLE
107 // CHECK-THREAD-MODEL-SINGLE: Thread model: single
109 // RUN: %clangxx -target arm-none-eabi -mthread-model posix -v 2>&1 \
110 // RUN: | FileCheck %s --check-prefix=CHECK-THREAD-MODEL-POSIX
111 // CHECK-THREAD-MODEL-POSIX: Thread model: posix
113 // RUN: %clang -### -target arm-none-eabi -rtlib=libgcc -v %s 2>&1 \
114 // RUN: | FileCheck %s --check-prefix=CHECK-RTLIB-GCC
115 // CHECK-RTLIB-GCC: -lgcc
117 // RUN: %clang -### -target arm-none-eabi -v %s 2>&1 \
118 // RUN: | FileCheck %s --check-prefix=CHECK-SYSROOT-INC
119 // CHECK-SYSROOT-INC-NOT: "-internal-isystem" "include"
121 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
122 // RUN: -target aarch64-none-elf \
123 // RUN: | FileCheck --check-prefix=CHECK-AARCH64-NO-HOST-INC %s
124 // Verify that the bare metal driver does not include any host system paths:
125 // CHECK-AARCH64-NO-HOST-INC: InstalledDir: [[INSTALLEDDIR:.+]]
126 // CHECK-AARCH64-NO-HOST-INC: "-resource-dir" "[[RESOURCE:[^"]+]]"
127 // CHECK-AARCH64-NO-HOST-INC-SAME: "-internal-isystem" "[[INSTALLEDDIR]]{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}clang-runtimes{{[/\\]+}}aarch64-none-elf{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
128 // CHECK-AARCH64-NO-HOST-INC-SAME: "-internal-isystem" "[[RESOURCE]]{{[/\\]+}}include"
129 // CHECK-AARCH64-NO-HOST-INC-SAME: "-internal-isystem" "[[INSTALLEDDIR]]{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}clang-runtimes{{[/\\]+}}aarch64-none-elf{{[/\\]+}}include"
131 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
132 // RUN: -target riscv64-unknown-elf \
133 // RUN: -L some/directory/user/asked/for \
134 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
135 // RUN: | FileCheck --check-prefix=CHECK-RV64 %s
136 // CHECK-RV64: "[[PREFIX_DIR:.*]]{{[/\\]+}}{{[^/^\\]+}}{{[/\\]+}}clang{{.*}}" "-cc1" "-triple" "riscv64-unknown-unknown-elf"
137 // CHECK-RV64-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
138 // CHECK-RV64-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
139 // CHECK-RV64-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
140 // CHECk-RV64-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include"
141 // CHECK-RV64-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
142 // CHECK-RV64-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
143 // CHECK-RV64-SAME: "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
144 // CHECK-RV64-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}lib"
145 // CHECK-RV64-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
146 // CHECK-RV64-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv64"
147 // CHECK-RV64-SAME: "-o" "{{.*}}.o"
149 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
150 // RUN: -target riscv64-unknown-elf \
151 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
152 // RUN: | FileCheck --check-prefix=CHECK-RV64-DEFAULTCXX %s
153 // CHECK-RV64-DEFAULTCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
154 // CHECK-RV64-DEFAULTCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
155 // CHECK-RV64-DEFAULTCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}basic_riscv64_tree{{[/\\]+}}riscv64-unknown-elf{{[/\\]+}}lib"
156 // CHECK-RV64-DEFAULTCXX-SAME: "-L[[RESOURCE_DIR]]{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
157 // CHECK-RV64-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
158 // CHECK-RV64-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv64"
159 // CHECK-RV64-DEFAULTCXX-SAME: "-o" "{{.*}}.o"
161 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
162 // RUN: -target riscv64-unknown-elf \
163 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
164 // RUN: -stdlib=libc++ \
165 // RUN: | FileCheck --check-prefix=CHECK-RV64-LIBCXX %s
166 // CHECK-RV64-LIBCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
167 // CHECK-RV64-LIBCXX-NOT: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}{{[^v].*}}"
168 // CHECK-RV64-LIBCXX-SAME: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
169 // CHECK-RV64-LIBCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
170 // CHECK-RV64-LIBCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}basic_riscv64_tree{{[/\\]+}}riscv64-unknown-elf{{[/\\]+}}lib"
171 // CHECK-RV64-LIBCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
172 // CHECK-RV64-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
173 // CHECK-RV64-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv64"
174 // CHECK-RV64-LIBCXX-SAME: "-o" "{{.*}}.o"
176 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
177 // RUN: -target riscv64-unknown-elf \
178 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
179 // RUN: -stdlib=libstdc++ \
180 // RUN: | FileCheck --check-prefix=CHECK-RV64-LIBSTDCXX %s
181 // CHECK-RV64-LIBSTDCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
182 // CHECK-RV64-LIBSTDCXX-NOT: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
183 // CHECK-RV64-LIBSTDCXX-SAME: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}8.0.1"
184 // CHECK-RV64-LIBSTDCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
185 // CHECK-RV64-LIBSTDCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}basic_riscv64_tree{{[/\\]+}}riscv64-unknown-elf{{[/\\]+}}lib"
186 // CHECK-RV64-LIBSTDCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
187 // CHECK-RV64-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
188 // CHECK-RV64-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv64"
189 // CHECK-RV64-LIBSTDCXX-SAME: "-o" "{{.*}}.o"
191 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
192 // RUN: -target riscv32-unknown-elf \
193 // RUN: -L some/directory/user/asked/for \
194 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
195 // RUN: | FileCheck --check-prefix=CHECK-RV32 %s
196 // CHECK-RV32: "[[PREFIX_DIR:.*]]{{[/\\]+}}{{[^/^\\]+}}{{[/\\]+}}clang{{.*}}" "-cc1" "-triple" "riscv32-unknown-unknown-elf"
197 // CHECK-RV32-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
198 // CHECK-RV32-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
199 // CHECK-RV32-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
200 // CHECK-RV32-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include"
201 // CHECK-RV32-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
202 // CHECK-RV32-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
203 // CHECK-RV32-SAME: "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
204 // CHECK-RV32-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}lib"
205 // CHECK-RV32-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
206 // CHECK-RV32-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv32"
207 // CHECK-RV32-SAME: "-o" "{{.*}}.o"
209 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
210 // RUN: -target riscv32-unknown-elf \
211 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
212 // RUN: | FileCheck --check-prefix=CHECK-RV32-DEFAULTCXX %s
213 // CHECK-RV32-DEFAULTCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
214 // CHECK-RV32-DEFAULTCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
215 // CHECK-RV32-DEFAULTCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}basic_riscv32_tree{{[/\\]+}}riscv32-unknown-elf{{[/\\]+}}lib"
216 // CHECK-RV32-DEFAULTCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
217 // CHECK-RV32-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
218 // CHECK-RV32-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv32"
219 // CHECK-RV32-DEFAULTCXX-SAME: "-o" "{{.*}}.o"
221 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
222 // RUN: -target riscv32-unknown-elf \
223 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
224 // RUN: -stdlib=libc++ \
225 // RUN: | FileCheck --check-prefix=CHECK-RV32-LIBCXX %s
226 // CHECK-RV32-LIBCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
227 // CHECK-RV32-LIBCXX-NOT: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}{{[^v].*}}"
228 // CHECK-RV32-LIBCXX-SAME: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
229 // CHECK-RV32-LIBCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
230 // CHECK-RV32-LIBCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}basic_riscv32_tree{{[/\\]+}}riscv32-unknown-elf{{[/\\]+}}lib"
231 // CHECK-RV32-LIBCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
232 // CHECK-RV32-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
233 // CHECK-RV32-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv32"
234 // CHECK-RV32-LIBCXX-SAME: "-o" "{{.*}}.o"
236 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
237 // RUN: -target riscv32-unknown-elf \
238 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
239 // RUN: -stdlib=libstdc++ \
240 // RUN: | FileCheck --check-prefix=CHECK-RV32-LIBSTDCXX %s
241 // CHECK-RV32-LIBSTDCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
242 // CHECK-RV32-LIBSTDCXX-NOT: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
243 // CHECK-RV32-LIBSTDCXX-SAME: "-internal-isystem" "{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}8.0.1"
244 // CHECK-RV32-LIBSTDCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
245 // CHECK-RV32-LIBSTDCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}basic_riscv32_tree{{[/\\]+}}riscv32-unknown-elf{{[/\\]+}}lib"
246 // CHECK-RV32-LIBSTDCXX-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
247 // CHECK-RV32-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
248 // CHECK-RV32-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-riscv32"
249 // CHECK-RV32-LIBSTDCXX-SAME: "-o" "{{.*}}.o"
251 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
252 // RUN: -target riscv64-unknown-elf \
253 // RUN: -nostdlibinc -nobuiltininc \
254 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
255 // RUN: | FileCheck --check-prefix=CHECK-RV64-LIBINC %s
257 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
258 // RUN: -target riscv64-unknown-elf \
259 // RUN: -nostdinc \
260 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
261 // RUN: | FileCheck --check-prefix=CHECK-RV64-LIBINC %s
262 // CHECK-RV64-LIBINC-NOT: "-internal-isystem"
264 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
265 // RUN: -target riscv64-unknown-elf \
266 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
267 // RUN: -nodefaultlibs \
268 // RUN: | FileCheck --check-prefix=CHECK-RV64-NDL %s
269 // CHECK-RV64-NDL: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
270 // CHECK-RV64-NDL: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
271 // CHECK-RV64-NDL-SAME: "-L{{[^"]*}}{{[/\\]+}}Inputs{{[/\\]+}}basic_riscv64_tree{{[/\\]+}}riscv64-unknown-elf{{[/\\]+}}lib"
272 // CHECK-RV64-NDL-SAME: "-L[[RESOURCE_DIR]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
273 // CHECK-RV64-NDL-SAME: "-o" "{{.*}}.o"
275 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
276 // RUN: -target riscv64-unknown-elf \
277 // RUN: -march=rv64imafdc -mabi=lp64d \
278 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
279 // RUN: | FileCheck --check-prefix=CHECK-RV64FD %s
281 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
282 // RUN: -target riscv64-unknown-elf \
283 // RUN: -march=rv64gc -mabi=lp64d \
284 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf \
285 // RUN: | FileCheck --check-prefix=CHECK-RV64FD %s
287 // CHECK-RV64FD: "[[PREFIX_DIR:.*]]{{[/\\]+}}{{[^/^\\]+}}{{[/\\]+}}clang{{.*}}" "-cc1" "-triple" "riscv64-unknown-unknown-elf"
288 // CHECK-RV64FD-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
289 // CHECK-RV64FD-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
290 // CHECK-RV64FD-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv64imafdc{{[/\\]+}}lp64d{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
291 // CHECk-RV64FD-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv64imafdc{{[/\\]+}}lp64d{{[/\\]+}}include"
292 // CHECK-RV64FD-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
293 // CHECK-RV64FD-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
294 // CHECK-RV64FD-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}rv64imafdc{{[/\\]+}}lp64d{{[/\\]+}}lib"
295 // CHECK-RV64FD-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal{{[/\\]+}}rv64imafdc{{[/\\]+}}lp64d"
297 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
298 // RUN: -target riscv32-unknown-elf \
299 // RUN: -march=rv32i -mabi=ilp32 \
300 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
301 // RUN: | FileCheck --check-prefix=CHECK-RV32I %s
303 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
304 // RUN: -target riscv32-unknown-elf \
305 // RUN: -march=rv32ic -mabi=ilp32 \
306 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
307 // RUN: | FileCheck --check-prefix=CHECK-RV32I %s
309 // CHECK-RV32I: "[[PREFIX_DIR:.*]]{{[/\\]+}}{{[^/^\\]+}}{{[/\\]+}}clang{{.*}}" "-cc1" "-triple" "riscv32-unknown-unknown-elf"
310 // CHECK-RV32I-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
311 // CHECK-RV32I-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
312 // CHECK-RV32I-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32i{{[/\\]+}}ilp32{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
313 // CHECK-RV32I-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32i{{[/\\]+}}ilp32{{[/\\]+}}include"
314 // CHECK-RV32I-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
315 // CHECK-RV32I-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
316 // CHECK-RV32I-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}rv32i{{[/\\]+}}ilp32{{[/\\]+}}lib"
317 // CHECK-RV32I-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal{{[/\\]+}}rv32i{{[/\\]+}}ilp32"
319 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
320 // RUN: -target riscv32-unknown-elf \
321 // RUN: -march=rv32im -mabi=ilp32 \
322 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
323 // RUN: | FileCheck --check-prefix=CHECK-RV32IM %s
325 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
326 // RUN: -target riscv32-unknown-elf \
327 // RUN: -march=rv32imc -mabi=ilp32 \
328 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
329 // RUN: | FileCheck --check-prefix=CHECK-RV32IM %s
331 // CHECK-RV32IM: "[[PREFIX_DIR:.*]]{{[/\\]+}}{{[^/^\\]+}}{{[/\\]+}}clang{{.*}}" "-cc1" "-triple" "riscv32-unknown-unknown-elf"
332 // CHECK-RV32IM-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
333 // CHECK-RV32IM-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
334 // CHECK-RV32IM-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32im{{[/\\]+}}ilp32{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
335 // CHECK-RV32IM-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32im{{[/\\]+}}ilp32{{[/\\]+}}include"
336 // CHECK-RV32IM-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
337 // CHECK-RV32IM-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
338 // CHECK-RV32IM-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}rv32im{{[/\\]+}}ilp32{{[/\\]+}}lib"
339 // CHECK-RV32IM-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal{{[/\\]+}}rv32im{{[/\\]+}}ilp32"
341 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
342 // RUN: -target riscv32-unknown-elf \
343 // RUN: -march=rv32iac -mabi=ilp32 \
344 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
345 // RUN: | FileCheck --check-prefix=CHECK-RV32IAC %s
347 // CHECK-RV32IAC: "[[PREFIX_DIR:.*]]{{[/\\]+}}{{[^/^\\]+}}{{[/\\]+}}clang{{.*}}" "-cc1" "-triple" "riscv32-unknown-unknown-elf"
348 // CHECK-RV32IAC-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
349 // CHECK-RV32IAC-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
350 // CHECK-RV32IAC-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32iac{{[/\\]+}}ilp32{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
351 // CHECK-RV32IAC-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32iac{{[/\\]+}}ilp32{{[/\\]+}}include"
352 // CHECK-RV32IAC-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
353 // CHECK-RV32IAC-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
354 // CHECK-RV32IAC-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}rv32iac{{[/\\]+}}ilp32{{[/\\]+}}lib"
355 // CHECK-RV32IAC-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal{{[/\\]+}}rv32iac{{[/\\]+}}ilp32"
357 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
358 // RUN: -target riscv32-unknown-elf \
359 // RUN: -march=rv32imafc -mabi=ilp32f \
360 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
361 // RUN: | FileCheck --check-prefix=CHECK-RV32IMAFC %s
363 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
364 // RUN: -target riscv32-unknown-elf \
365 // RUN: -march=rv32imafdc -mabi=ilp32f \
366 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
367 // RUN: | FileCheck --check-prefix=CHECK-RV32IMAFC %s
369 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
370 // RUN: -target riscv32-unknown-elf \
371 // RUN: -march=rv32gc -mabi=ilp32f \
372 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf \
373 // RUN: | FileCheck --check-prefix=CHECK-RV32IMAFC %s
375 // CHECK-RV32IMAFC: "[[PREFIX_DIR:.*]]{{[/\\]+}}{{[^/^\\]+}}{{[/\\]+}}clang{{.*}}" "-cc1" "-triple" "riscv32-unknown-unknown-elf"
376 // CHECK-RV32IMAFC-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
377 // CHECK-RV32IMAFC-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
378 // CHECK-RV32IMAFC-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32imafc{{[/\\]+}}ilp32f{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
379 // CHECK-RV32IMAFC-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}rv32imafc{{[/\\]+}}ilp32f{{[/\\]+}}include"
380 // CHECK-RV32IMAFC-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
381 // CHECK-RV32IMAFC-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
382 // CHECK-RV32IMAFC-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}rv32imafc{{[/\\]+}}ilp32f{{[/\\]+}}lib"
383 // CHECK-RV32IMAFC-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal{{[/\\]+}}rv32imafc{{[/\\]+}}ilp32f"