1 // RUN: %clang %s -### -no-canonical-prefixes --target=arm-liteos \
2 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
3 // RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=ld -march=armv7-a 2>&1 \
4 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-ARM %s
5 // RUN: %clang %s -### -no-canonical-prefixes --target=arm-liteos \
6 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
7 // RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=ld -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=soft 2>&1 \
8 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-ARM-A7-SOFT %s
9 // CHECK: {{.*}}clang{{.*}}" "-cc1"
10 // CHECK-NOT: "-munwind-tables"
11 // CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
12 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
13 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include"
14 // CHECK-NOT: "-fsanitize=safe-stack"
15 // CHECK-NOT: "-stack-protector" "2"
16 // CHECK-NOT: "-fno-common"
17 // CHECK: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]"
18 // CHECK-NOT: "--sysroot=[[SYSROOT]]"
19 // CHECK-NOT: "--build-id"
20 // CHECK: "--hash-style=both"
22 // CHECK: "-dynamic-linker" "/lib/ld-musl-arm.so.1"
25 // CHECK: clang_rt.crtbegin.o
26 // CHECK-ARM: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}"
27 // CHECK-ARM-A7-SOFT: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_soft"
28 // CHECK-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a"
29 // CHECK-ARM-A7-SOFT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos/a7_soft{{/|\\\\}}libclang_rt.builtins.a"
31 // CHECK: clang_rt.crtend.o
34 // RUN: not %clang %s -### --target=arm-liteos -rtlib=libgcc 2>&1 \
35 // RUN: | FileCheck %s -check-prefix=CHECK-RTLIB
36 // CHECK-RTLIB: error: invalid runtime library name in argument '-rtlib=libgcc'
38 // RUN: %clang %s -### --target=arm-liteos -static -fuse-ld=ld 2>&1 \
39 // RUN: | FileCheck %s -check-prefix=CHECK-STATIC
40 // CHECK-STATIC: "-static"
41 // CHECK-STATIC-NOT: "-Bdynamic"
42 // CHECK-STATIC: "-l:libunwind.a"
43 // CHECK-STATIC: "-lc"
45 // RUN: %clang %s -### --target=arm-liteos -shared -fuse-ld=ld 2>&1 \
46 // RUN: | FileCheck %s -check-prefix=CHECK-SHARED
47 // CHECK-SHARED-NOT: "-pie"
48 // CHECK-SHARED: "-shared"
49 // CHECK-SHARED: "-lc"
50 // CHECK-SHARED: "-l:libunwind.a"
52 // RUN: %clang %s -### --target=arm-linux-ohos -fuse-ld=ld 2>&1 \
53 // RUN: | FileCheck %s -check-prefix=CHECK-RUNTIME
54 // RUN: %clang %s -### --target=aarch64-linux-ohos -fuse-ld=ld 2>&1 \
55 // RUN: | FileCheck %s -check-prefix=CHECK-RUNTIME
56 // RUN: %clang %s -### --target=mipsel-linux-ohos -fuse-ld=ld 2>&1 \
57 // RUN: | FileCheck %s -check-prefix=CHECK-RUNTIME
58 // RUN: %clang %s -### --target=x86_64-linux-ohos -fuse-ld=ld 2>&1 \
59 // RUN: | FileCheck %s -check-prefix=CHECK-RUNTIME
60 // CHECK-RUNTIME: "{{.*}}libclang_rt.builtins.a"
61 // CHECK-RUNTIME: "-l:libunwind.a"
64 // RUN: %clang %s -### --target=arm-liteos -r -fuse-ld=ld 2>&1 \
65 // RUN: | FileCheck %s -check-prefix=CHECK-RELOCATABLE
66 // CHECK-RELOCATABLE-NOT: "-pie"
67 // CHECK-RELOCATABLE: "-r"
69 // RUN: %clang %s -### --target=arm-liteos -nodefaultlibs -fuse-ld=ld 2>&1 \
70 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
71 // RUN: | FileCheck %s -check-prefix=CHECK-NODEFAULTLIBS
72 // CHECK-NODEFAULTLIBS: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
73 // CHECK-NODEFAULTLIBS-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a"
74 // CHECK-NODEFAULTLIBS-NOT: "-lc"
76 // RUN: %clang %s -### --target=arm-liteos -nostdlib -fuse-ld=ld 2>&1 \
77 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
78 // RUN: | FileCheck %s -check-prefix=CHECK-NOSTDLIB
79 // CHECK-NOSTDLIB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
80 // CHECK-NOSTDLIB-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a"
81 // CHECK-NOSTDLIB-NOT: "-lc"
83 // RUN: %clang %s -### --target=arm-liteos -nolibc -fuse-ld=ld 2>&1 \
84 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
85 // RUN: | FileCheck %s -check-prefix=CHECK-NOLIBC
86 // CHECK-NOLIBC: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
87 // CHECK-NOLIBC: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a"
88 // CHECK-NOLIBC-NOT: "-lc"
90 // RUN: %clang %s -### --target=arm-liteos \
91 // RUN: -fsanitize=safe-stack 2>&1 \
92 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
94 // RUN: | FileCheck %s -check-prefix=CHECK-SAFESTACK
95 // CHECK-SAFESTACK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
96 // CHECK-SAFESTACK: "-fsanitize=safe-stack"
97 // CHECK-SAFESTACK: "__safestack_init"
98 // CHECK-SAFESTACK: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.safestack.a"
100 // RUN: %clang %s -### --target=arm-liteos \
101 // RUN: -fsanitize=address 2>&1 \
102 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
103 // RUN: -fuse-ld=ld \
104 // RUN: | FileCheck %s -check-prefix=CHECK-ASAN-ARM
105 // CHECK-ASAN-ARM: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
106 // CHECK-ASAN-ARM: "-fsanitize=address"
107 // CHECK-ASAN-ARM: "-fsanitize-address-use-after-scope"
108 // CHECK-ASAN-ARM: "-dynamic-linker" "/lib/ld-musl-arm.so.1"
109 // CHECK-ASAN-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.asan.a"
110 // CHECK-ASAN-ARM-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.asan-preinit.a"
112 // RUN: %clang %s -### --target=arm-liteos \
113 // RUN: -fsanitize=address -fPIC -shared 2>&1 \
114 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
115 // RUN: -shared-libsan \
116 // RUN: -fuse-ld=ld \
117 // RUN: | FileCheck %s -check-prefix=CHECK-ASAN-SHARED
118 // CHECK-ASAN-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
119 // CHECK-ASAN-SHARED: "-fsanitize=address"
120 // CHECK-ASAN-SHARED: "-fsanitize-address-use-after-scope"
121 // CHECK-ASAN-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.asan.so"
122 // CHECK-ASAN-SHARED-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.asan-preinit.a"
124 // RUN: %clang %s -### --target=arm-liteos \
125 // RUN: -fsanitize=fuzzer 2>&1 \
126 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
127 // RUN: -fuse-ld=ld \
128 // RUN: | FileCheck %s -check-prefix=CHECK-FUZZER-ARM
129 // CHECK-FUZZER-ARM: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
130 // CHECK-FUZZER-ARM: "-fsanitize=fuzzer,fuzzer-no-link"
131 // CHECK-FUZZER-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.fuzzer.a"
133 // RUN: %clang %s -### --target=arm-liteos \
134 // RUN: -fsanitize=scudo 2>&1 \
135 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
136 // RUN: -fuse-ld=ld \
137 // RUN: | FileCheck %s -check-prefix=CHECK-SCUDO-ARM
138 // CHECK-SCUDO-ARM: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
139 // CHECK-SCUDO-ARM: "-fsanitize=scudo"
140 // CHECK-SCUDO-ARM: "-pie"
141 // CHECK-SCUDO-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.scudo_standalone.a"
143 // RUN: %clang %s -### --target=arm-liteos \
144 // RUN: -fsanitize=scudo -fPIC -shared 2>&1 \
145 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
146 // RUN: -shared-libsan \
147 // RUN: -fuse-ld=ld \
148 // RUN: | FileCheck %s -check-prefix=CHECK-SCUDO-SHARED
149 // CHECK-SCUDO-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
150 // CHECK-SCUDO-SHARED: "-fsanitize=scudo"
151 // CHECK-SCUDO-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.scudo_standalone.so"
153 // RUN: %clang %s -### --target=arm-liteos \
154 // RUN: -fxray-instrument -fxray-modes=xray-basic \
155 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
156 // RUN: -fuse-ld=ld 2>&1 \
157 // RUN: | FileCheck %s -check-prefix=CHECK-XRAY-ARM
158 // CHECK-XRAY-ARM: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
159 // CHECK-XRAY-ARM: "-fxray-instrument"
160 // CHECK-XRAY-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.xray.a"
161 // CHECK-XRAY-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.xray-basic.a"
163 // RUN: %clang %s -### --target=arm-liteos \
164 // RUN: -O3 -flto -mcpu=cortex-a53 2>&1 \
165 // RUN: -fuse-ld=ld \
166 // RUN: | FileCheck %s -check-prefix=CHECK-LTO
167 // CHECK-LTO: "-plugin-opt=mcpu=cortex-a53"
168 // CHECK-LTO: "-plugin-opt=O3"
170 // RUN: %clang %s -### --target=arm-liteos \
171 // RUN: -flto=thin -flto-jobs=8 -mcpu=cortex-a7 2>&1 \
172 // RUN: -fuse-ld=ld \
173 // RUN: | FileCheck %s -check-prefix=CHECK-THINLTO
174 // CHECK-THINLTO: "-plugin-opt=mcpu=cortex-a7"
175 // CHECK-THINLTO: "-plugin-opt=thinlto"
176 // CHECK-THINLTO: "-plugin-opt=jobs=8"
178 // RUN: %clang %s -### --target=arm-liteos \
179 // RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \
180 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
181 // RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \
182 // RUN: -march=armv7-a -mfloat-abi=soft 2>&1\
183 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM
184 // RUN: %clang %s -### --target=arm-liteos \
185 // RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \
186 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
187 // RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \
188 // RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=soft 2>&1\
189 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM-A7-SOFT
190 // RUN: %clang %s -### --target=arm-liteos \
191 // RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \
192 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
193 // RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \
194 // RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 2>&1\
195 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM-A7-SOFTFP
196 // RUN: %clang %s -### --target=arm-liteos \
197 // RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \
198 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
199 // RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \
200 // RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 2>&1\
201 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-HF,CHECK-MULTILIB-ARM-A7-HARD
202 // CHECK-MULTILIB: {{.*}}clang{{.*}}" "-cc1"
203 // CHECK-MULTILIB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
204 // CHECK-MULTILIB: "-isysroot" "[[SYSROOT:[^"]+]]"
205 // CHECK-MULTILIB: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]"
206 // CHECK-MULTILIB-SF: "-dynamic-linker" "/lib/ld-musl-arm.so.1"
207 // CHECK-MULTILIB-HF: "-dynamic-linker" "/lib/ld-musl-armhf.so.1"
209 // CHECK-MULTILIB-ARM: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}"
211 // CHECK-MULTILIB-ARM-A7-SOFT: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_soft"
213 // CHECK-MULTILIB-ARM-A7-SOFTFP: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_softfp_neon-vfpv4"
215 // CHECK-MULTILIB-ARM-A7-HARD: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_hard_neon-vfpv4"
217 // CHECK-MULTILIB-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a"
218 // CHECK-MULTILIB-ARM-A7-SOFT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_soft{{/|\\\\}}libclang_rt.builtins.a"
219 // CHECK-MULTILIB-ARM-A7-SOFTFP: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_softfp_neon-vfpv4{{/|\\\\}}libclang_rt.builtins.a"
220 // CHECK-MULTILIB-ARM-A7-HARD: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_hard_neon-vfpv4{{/|\\\\}}libclang_rt.builtins.a"
222 // RUN: %clang %s -### -no-canonical-prefixes --target=arm-linux-ohos -fprofile-instr-generate -v \
223 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
224 // RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=ld -march=armv7-a 2>&1 \
225 // RUN: | FileCheck -check-prefixes=CHECK-PROFILE-RTLIB %s
227 // CHECK-PROFILE-RTLIB: -u__llvm_profile_runtime
228 // CHECK-PROFILE-RTLIB: libclang_rt.profile
230 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
231 // RUN: --target=arm64-linux-ohos -pthread \
232 // RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \
234 // RUN: | FileCheck --check-prefix=CHECK-OHOS-PTHREAD %s
236 // CHECK-OHOS-PTHREAD-NOT: -lpthread