1 // UNSUPPORTED: system-windows
2 // A basic clang -cc1 command-line, and simple environment check.
4 // RUN: %clang -### %s --target=riscv32 \
5 // RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \
6 // RUN: | FileCheck -check-prefix=CC1 %s
7 // CC1: "-cc1" "-triple" "riscv32"
9 // Test interaction with -fuse-ld=lld, if lld is available.
10 // RUN: %clang -### %s --target=riscv32 \
11 // RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree -fuse-ld=lld 2>&1 \
12 // RUN: | FileCheck -check-prefix=LLD %s
13 // LLD: {{(error: invalid linker name in argument '-fuse-ld=lld')|(ld.lld)}}
15 // In the below tests, --rtlib=platform is used so that the driver ignores
16 // the configure-time CLANG_DEFAULT_RTLIB option when choosing the runtime lib
18 // RUN: %clang -### %s -fuse-ld= \
19 // RUN: --target=riscv32-unknown-elf --rtlib=platform \
20 // RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree \
21 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf 2>&1 \
22 // RUN: | FileCheck -check-prefix=C-RV32-BAREMETAL-ILP32 %s
24 // C-RV32-BAREMETAL-ILP32: "{{.*}}Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}bin{{/|\\\\}}riscv32-unknown-elf-ld"
25 // C-RV32-BAREMETAL-ILP32: "--sysroot={{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf"
26 // C-RV64-BAREMETAL-LP64-SAME: "-X"
27 // C-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib{{/|\\\\}}crt0.o"
28 // C-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1{{/|\\\\}}crtbegin.o"
29 // C-RV32-BAREMETAL-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1"
30 // C-RV32-BAREMETAL-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib"
31 // C-RV32-BAREMETAL-ILP32: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
32 // C-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1{{/|\\\\}}crtend.o"
34 // RUN: %clang -### %s -fuse-ld= \
35 // RUN: --target=riscv32-unknown-elf --rtlib=platform \
37 // RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \
38 // RUN: | FileCheck -check-prefix=C-RV32-BAREMETAL-NOSYSROOT-ILP32 %s
40 // C-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}bin{{/|\\\\}}riscv32-unknown-elf-ld"
41 // C-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}riscv32-unknown-linux-gnu/lib{{/|\\\\}}crt0.o"
42 // C-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1{{/|\\\\}}crtbegin.o"
43 // C-RV32-BAREMETAL-NOSYSROOT-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1"
44 // C-RV32-BAREMETAL-NOSYSROOT-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}riscv32-unknown-linux-gnu{{/|\\\\}}lib"
45 // C-RV32-BAREMETAL-NOSYSROOT-ILP32: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
46 // C-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1{{/|\\\\}}crtend.o"
48 // RUN: %clangxx -### %s -fuse-ld= \
49 // RUN: --target=riscv32-unknown-elf -stdlib=libstdc++ --rtlib=platform \
50 // RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree \
51 // RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf 2>&1 \
52 // RUN: | FileCheck -check-prefix=CXX-RV32-BAREMETAL-ILP32 %s
54 // CXX-RV32-BAREMETAL-ILP32: "-internal-isystem" "{{.*}}Inputs/basic_riscv32_tree/riscv32-unknown-elf/include/c++{{/|\\\\}}8.0.1"
55 // CXX-RV32-BAREMETAL-ILP32: "{{.*}}Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}bin{{/|\\\\}}riscv32-unknown-elf-ld"
56 // CXX-RV32-BAREMETAL-ILP32: "--sysroot={{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf"
57 // CXX-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib{{/|\\\\}}crt0.o"
58 // CXX-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1{{/|\\\\}}crtbegin.o"
59 // CXX-RV32-BAREMETAL-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1"
60 // CXX-RV32-BAREMETAL-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib"
61 // CXX-RV32-BAREMETAL-ILP32: "-lstdc++" "-lm" "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
62 // CXX-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1{{/|\\\\}}crtend.o"
64 // RUN: %clangxx -### %s -fuse-ld= \
65 // RUN: --target=riscv32-unknown-elf -stdlib=libstdc++ --rtlib=platform \
67 // RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \
68 // RUN: | FileCheck -check-prefix=CXX-RV32-BAREMETAL-NOSYSROOT-ILP32 %s
70 // CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "-internal-isystem" "{{.*}}Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}riscv32-unknown-linux-gnu/include/c++{{/|\\\\}}8.0.1"
71 // CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}bin{{/|\\\\}}riscv32-unknown-elf-ld"
72 // CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}riscv32-unknown-linux-gnu/lib{{/|\\\\}}crt0.o"
73 // CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1{{/|\\\\}}crtbegin.o"
74 // CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1"
75 // CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}riscv32-unknown-linux-gnu/lib"
76 // CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "-lstdc++" "-lm" "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
77 // CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-linux-gnu/8.0.1{{/|\\\\}}crtend.o"
79 // RUN: env "PATH=" %clang -### %s -fuse-ld=ld -no-pie \
80 // RUN: --target=riscv32-unknown-linux-gnu --rtlib=platform -mabi=ilp32 \
81 // RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_linux_sdk \
82 // RUN: --sysroot=%S/Inputs/multilib_riscv_linux_sdk/sysroot 2>&1 \
83 // RUN: | FileCheck -check-prefix=C-RV32-LINUX-MULTI-ILP32 %s
85 // C-RV32-LINUX-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-linux-gnu/bin{{/|\\\\}}ld"
86 // C-RV32-LINUX-MULTI-ILP32: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
87 // C-RV32-LINUX-MULTI-ILP32: "-m" "elf32lriscv" "-X"
88 // C-RV32-LINUX-MULTI-ILP32: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32.so.1"
89 // C-RV32-LINUX-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32{{/|\\\\}}crtbegin.o"
90 // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32"
91 // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32"
92 // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32"
94 // RUN: env "PATH=" %clang -### %s -fuse-ld=ld -no-pie \
95 // RUN: --target=riscv32-unknown-linux-gnu --rtlib=platform -march=rv32imafd \
96 // RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_linux_sdk \
97 // RUN: --sysroot=%S/Inputs/multilib_riscv_linux_sdk/sysroot 2>&1 \
98 // RUN: | FileCheck -check-prefix=C-RV32-LINUX-MULTI-ILP32D %s
100 // C-RV32-LINUX-MULTI-ILP32D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-linux-gnu/bin{{/|\\\\}}ld"
101 // C-RV32-LINUX-MULTI-ILP32D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
102 // C-RV32-LINUX-MULTI-ILP32D: "-m" "elf32lriscv"
103 // C-RV32-LINUX-MULTI-ILP32D: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32d.so.1"
104 // C-RV32-LINUX-MULTI-ILP32D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d{{/|\\\\}}crtbegin.o"
105 // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d"
106 // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32d"
107 // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32d"
109 // RUN: env "PATH=" %clang -### %s -fuse-ld=ld \
110 // RUN: --target=riscv32-unknown-elf --rtlib=platform --sysroot= \
111 // RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_elf_sdk 2>&1 \
112 // RUN: | FileCheck -check-prefix=C-RV32I-BAREMETAL-MULTI-ILP32 %s
114 // C-RV32I-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/bin{{/|\\\\}}ld"
115 // C-RV32I-BAREMETAL-MULTI-ILP32: "-m" "elf32lriscv"
116 // C-RV32I-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib/rv32imac/ilp32{{/|\\\\}}crt0.o"
117 // C-RV32I-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32imac/ilp32{{/|\\\\}}crtbegin.o"
118 // C-RV32I-BAREMETAL-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0"
119 // C-RV32I-BAREMETAL-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib"
120 // C-RV32I-BAREMETAL-MULTI-ILP32: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
121 // C-RV32I-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32imac/ilp32{{/|\\\\}}crtend.o"
123 // RUN: env "PATH=" %clang -### %s -fuse-ld=ld \
124 // RUN: --target=riscv32-unknown-elf --rtlib=platform --sysroot= \
125 // RUN: -march=rv32im -mabi=ilp32\
126 // RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_elf_sdk 2>&1 \
127 // RUN: | FileCheck -check-prefix=C-RV32IM-BAREMETAL-MULTI-ILP32 %s
129 // C-RV32IM-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/bin{{/|\\\\}}ld"
130 // C-RV32IM-BAREMETAL-MULTI-ILP32: "-m" "elf32lriscv"
131 // C-RV32IM-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib/rv32im/ilp32{{/|\\\\}}crt0.o"
132 // C-RV32IM-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32im/ilp32{{/|\\\\}}crtbegin.o"
133 // C-RV32IM-BAREMETAL-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0"
134 // C-RV32IM-BAREMETAL-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib"
135 // C-RV32IM-BAREMETAL-MULTI-ILP32: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
136 // C-RV32IM-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32im/ilp32{{/|\\\\}}crtend.o"
138 // RUN: env "PATH=" %clang -### %s -fuse-ld=ld \
139 // RUN: --target=riscv32-unknown-elf --rtlib=platform --sysroot= \
140 // RUN: -march=rv32iac -mabi=ilp32\
141 // RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_elf_sdk 2>&1 \
142 // RUN: | FileCheck -check-prefix=C-RV32IAC-BAREMETAL-MULTI-ILP32 %s
144 // C-RV32IAC-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/bin{{/|\\\\}}ld"
145 // C-RV32IAC-BAREMETAL-MULTI-ILP32: "-m" "elf32lriscv"
146 // C-RV32IAC-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib/rv32iac/ilp32{{/|\\\\}}crt0.o"
147 // C-RV32IAC-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32iac/ilp32{{/|\\\\}}crtbegin.o"
148 // C-RV32IAC-BAREMETAL-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0"
149 // C-RV32IAC-BAREMETAL-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib"
150 // C-RV32IAC-BAREMETAL-MULTI-ILP32: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
151 // C-RV32IAC-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32iac/ilp32{{/|\\\\}}crtend.o"
153 // RUN: env "PATH=" %clang -### %s -fuse-ld=ld \
154 // RUN: --target=riscv32-unknown-elf --rtlib=platform --sysroot= \
155 // RUN: -march=rv32imac -mabi=ilp32\
156 // RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_elf_sdk 2>&1 \
157 // RUN: | FileCheck -check-prefix=C-RV32IMAC-BAREMETAL-MULTI-ILP32 %s
159 // C-RV32IMAC-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/bin{{/|\\\\}}ld"
160 // C-RV32IMAC-BAREMETAL-MULTI-ILP32: "-m" "elf32lriscv"
161 // C-RV32IMAC-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib/rv32imac/ilp32{{/|\\\\}}crt0.o"
162 // C-RV32IMAC-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32imac/ilp32{{/|\\\\}}crtbegin.o"
163 // C-RV32IMAC-BAREMETAL-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0"
164 // C-RV32IMAC-BAREMETAL-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib"
165 // C-RV32IMAC-BAREMETAL-MULTI-ILP32: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
166 // C-RV32IMAC-BAREMETAL-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32imac/ilp32{{/|\\\\}}crtend.o"
168 // RUN: env "PATH=" %clang -### %s -fuse-ld=ld \
169 // RUN: --target=riscv32-unknown-elf --rtlib=platform --sysroot= \
170 // RUN: -march=rv32imafc -mabi=ilp32f \
171 // RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_elf_sdk 2>&1 \
172 // RUN: | FileCheck -check-prefix=C-RV32IMAFC-BAREMETAL-MULTI-ILP32F %s
174 // C-RV32IMAFC-BAREMETAL-MULTI-ILP32F: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/bin{{/|\\\\}}ld"
175 // C-RV32IMAFC-BAREMETAL-MULTI-ILP32F: "-m" "elf32lriscv"
176 // C-RV32IMAFC-BAREMETAL-MULTI-ILP32F: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib/rv32imafc/ilp32f{{/|\\\\}}crt0.o"
177 // C-RV32IMAFC-BAREMETAL-MULTI-ILP32F: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32imafc/ilp32f{{/|\\\\}}crtbegin.o"
178 // C-RV32IMAFC-BAREMETAL-MULTI-ILP32F: "-L{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0"
179 // C-RV32IMAFC-BAREMETAL-MULTI-ILP32F: "-L{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib"
180 // C-RV32IMAFC-BAREMETAL-MULTI-ILP32F: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
181 // C-RV32IMAFC-BAREMETAL-MULTI-ILP32F: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32imafc/ilp32f{{/|\\\\}}crtend.o"
183 // Check that --rtlib can be used to override the used runtime library
184 // RUN: %clang -### %s \
185 // RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_elf_sdk \
186 // RUN: --target=riscv32-unknown-elf --rtlib=libgcc 2>&1 \
187 // RUN: | FileCheck -check-prefix=C-RV32-RTLIB-LIBGCC-ILP32 %s
188 // C-RV32-RTLIB-LIBGCC-ILP32: "{{.*}}crt0.o"
189 // C-RV32-RTLIB-LIBGCC-ILP32: "{{.*}}crtbegin.o"
190 // C-RV32-RTLIB-LIBGCC-ILP32: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
191 // C-RV32-RTLIB-LIBGCC-ILP32: "{{.*}}crtend.o"
193 // RUN: %clang -### %s \
194 // RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_elf_sdk \
195 // RUN: --target=riscv32-unknown-elf --rtlib=compiler-rt 2>&1 \
196 // RUN: | FileCheck -check-prefix=C-RV32-RTLIB-COMPILERRT-ILP32 %s
197 // C-RV32-RTLIB-COMPILERRT-ILP32: "{{.*}}crt0.o"
198 // C-RV32-RTLIB-COMPILERRT-ILP32: "{{.*}}clang_rt.crtbegin-riscv32.o"
199 // C-RV32-RTLIB-COMPILERRT-ILP32: "--start-group" "-lc" "-lgloss" "--end-group" "{{.*}}libclang_rt.builtins-riscv32.a"
200 // C-RV32-RTLIB-COMPILERRT-ILP32: "{{.*}}clang_rt.crtend-riscv32.o"
202 // RUN: %clang -### %s --target=riscv32 \
203 // RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree --sysroot= \
204 // RUN: -resource-dir=%s/Inputs/resource_dir 2>&1 \
205 // RUN: | FileCheck -check-prefix=RESOURCE-INC %s
206 // RESOURCE-INC: "-internal-isystem" "{{.*}}/Inputs/resource_dir{{/|\\\\}}include"
207 // RESOURCE-INC: "-internal-isystem" "{{.*}}/basic_riscv32_tree{{.*}}riscv32-unknown-linux-gnu{{/|\\\\}}include"
209 // RUN: %clang -### %s --target=riscv32 \
210 // RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree --sysroot= \
211 // RUN: -resource-dir=%s/Inputs/resource_dir -nobuiltininc 2>&1 \
212 // RUN: | FileCheck -check-prefix=NO-RESOURCE-INC %s
213 // NO-RESOURCE-INC-NOT: "-internal-isystem" "{{.*}}/Inputs/resource_dir{{/|\\\\}}include"
214 // NO-RESOURCE-INC: "-internal-isystem" "{{.*}}/basic_riscv32_tree/{{.*}}riscv32-unknown-linux-gnu{{/|\\\\}}include"
216 // RUN: %clang --target=riscv32 %s -emit-llvm -S -o - | FileCheck %s
218 typedef __builtin_va_list
va_list;
219 typedef __SIZE_TYPE__
size_t;
220 typedef __PTRDIFF_TYPE__
ptrdiff_t;
221 typedef __WCHAR_TYPE__
wchar_t;
222 typedef __WINT_TYPE__
wint_t;
227 // CHECK: @align_c = dso_local global i32 1
228 int align_c
= __alignof(char);
230 // CHECK: @align_s = dso_local global i32 2
231 int align_s
= __alignof(short);
233 // CHECK: @align_i = dso_local global i32 4
234 int align_i
= __alignof(int);
236 // CHECK: @align_wc = dso_local global i32 4
237 int align_wc
= __alignof(wchar_t);
239 // CHECK: @align_wi = dso_local global i32 4
240 int align_wi
= __alignof(wint_t);
242 // CHECK: @align_l = dso_local global i32 4
243 int align_l
= __alignof(long);
245 // CHECK: @align_ll = dso_local global i32 8
246 int align_ll
= __alignof(long long);
248 // CHECK: @align_p = dso_local global i32 4
249 int align_p
= __alignof(void*);
251 // CHECK: @align_f = dso_local global i32 4
252 int align_f
= __alignof(float);
254 // CHECK: @align_d = dso_local global i32 8
255 int align_d
= __alignof(double);
257 // CHECK: @align_ld = dso_local global i32 16
258 int align_ld
= __alignof(long double);
260 // CHECK: @align_vl = dso_local global i32 4
261 int align_vl
= __alignof(va_list);
263 // CHECK: @align_a_c = dso_local global i32 1
264 int align_a_c
= __alignof(_Atomic(char));
266 // CHECK: @align_a_s = dso_local global i32 2
267 int align_a_s
= __alignof(_Atomic(short));
269 // CHECK: @align_a_i = dso_local global i32 4
270 int align_a_i
= __alignof(_Atomic(int));
272 // CHECK: @align_a_wc = dso_local global i32 4
273 int align_a_wc
= __alignof(_Atomic(wchar_t));
275 // CHECK: @align_a_wi = dso_local global i32 4
276 int align_a_wi
= __alignof(_Atomic(wint_t));
278 // CHECK: @align_a_l = dso_local global i32 4
279 int align_a_l
= __alignof(_Atomic(long));
281 // CHECK: @align_a_ll = dso_local global i32 8
282 int align_a_ll
= __alignof(_Atomic(long long));
284 // CHECK: @align_a_p = dso_local global i32 4
285 int align_a_p
= __alignof(_Atomic(void*));
287 // CHECK: @align_a_f = dso_local global i32 4
288 int align_a_f
= __alignof(_Atomic(float));
290 // CHECK: @align_a_d = dso_local global i32 8
291 int align_a_d
= __alignof(_Atomic(double));
293 // CHECK: @align_a_ld = dso_local global i32 16
294 int align_a_ld
= __alignof(_Atomic(long double));
296 // CHECK: @align_a_s4 = dso_local global i32 4
297 int align_a_s4
= __alignof(_Atomic(struct { char s
[4]; }));
299 // CHECK: @align_a_s8 = dso_local global i32 8
300 int align_a_s8
= __alignof(_Atomic(struct { char s
[8]; }));
302 // CHECK: @align_a_s16 = dso_local global i32 16
303 int align_a_s16
= __alignof(_Atomic(struct { char s
[16]; }));
305 // CHECK: @align_a_s32 = dso_local global i32 1
306 int align_a_s32
= __alignof(_Atomic(struct { char s
[32]; }));
311 // CHECK: @size_a_c = dso_local global i32 1
312 int size_a_c
= sizeof(_Atomic(char));
314 // CHECK: @size_a_s = dso_local global i32 2
315 int size_a_s
= sizeof(_Atomic(short));
317 // CHECK: @size_a_i = dso_local global i32 4
318 int size_a_i
= sizeof(_Atomic(int));
320 // CHECK: @size_a_wc = dso_local global i32 4
321 int size_a_wc
= sizeof(_Atomic(wchar_t));
323 // CHECK: @size_a_wi = dso_local global i32 4
324 int size_a_wi
= sizeof(_Atomic(wint_t));
326 // CHECK: @size_a_l = dso_local global i32 4
327 int size_a_l
= sizeof(_Atomic(long));
329 // CHECK: @size_a_ll = dso_local global i32 8
330 int size_a_ll
= sizeof(_Atomic(long long));
332 // CHECK: @size_a_p = dso_local global i32 4
333 int size_a_p
= sizeof(_Atomic(void*));
335 // CHECK: @size_a_f = dso_local global i32 4
336 int size_a_f
= sizeof(_Atomic(float));
338 // CHECK: @size_a_d = dso_local global i32 8
339 int size_a_d
= sizeof(_Atomic(double));
341 // CHECK: @size_a_ld = dso_local global i32 16
342 int size_a_ld
= sizeof(_Atomic(long double));
347 // CHECK: zeroext i8 @check_char()
348 char check_char(void) { return 0; }
350 // CHECK: define dso_local signext i16 @check_short()
351 short check_short(void) { return 0; }
353 // CHECK: define dso_local i32 @check_int()
354 int check_int(void) { return 0; }
356 // CHECK: define dso_local i32 @check_wchar_t()
357 int check_wchar_t(void) { return 0; }
359 // CHECK: define dso_local i32 @check_long()
360 long check_long(void) { return 0; }
362 // CHECK: define dso_local i64 @check_longlong()
363 long long check_longlong(void) { return 0; }
365 // CHECK: define dso_local zeroext i8 @check_uchar()
366 unsigned char check_uchar(void) { return 0; }
368 // CHECK: define dso_local zeroext i16 @check_ushort()
369 unsigned short check_ushort(void) { return 0; }
371 // CHECK: define dso_local i32 @check_uint()
372 unsigned int check_uint(void) { return 0; }
374 // CHECK: define dso_local i32 @check_ulong()
375 unsigned long check_ulong(void) { return 0; }
377 // CHECK: define dso_local i64 @check_ulonglong()
378 unsigned long long check_ulonglong(void) { return 0; }
380 // CHECK: define dso_local i32 @check_size_t()
381 size_t check_size_t(void) { return 0; }
383 // CHECK: define dso_local float @check_float()
384 float check_float(void) { return 0; }
386 // CHECK: define dso_local double @check_double()
387 double check_double(void) { return 0; }
389 // CHECK: define dso_local fp128 @check_longdouble()
390 long double check_longdouble(void) { return 0; }