1 // Test sanitizers ld flags. 2 3 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 4 // RUN: -target i386-unknown-linux -fsanitize=address \ 5 // RUN: -resource-dir=%S/Inputs/resource_dir \ 6 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 7 // RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX %s 8 // 9 // CHECK-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 10 // CHECK-ASAN-LINUX-NOT: "-lc" 11 // CHECK-ASAN-LINUX: libclang_rt.asan-i386.a" 12 // CHECK-ASAN-LINUX-NOT: "-export-dynamic" 13 // CHECK-ASAN-LINUX: "--dynamic-list={{.*}}libclang_rt.asan-i386.a.syms" 14 // CHECK-ASAN-LINUX-NOT: "-export-dynamic" 15 // CHECK-ASAN-LINUX: "-lpthread" 16 // CHECK-ASAN-LINUX: "-lrt" 17 // CHECK-ASAN-LINUX: "-ldl" 18 19 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 20 // RUN: -target i386-unknown-linux -fsanitize=address -shared-libasan \ 21 // RUN: -resource-dir=%S/Inputs/resource_dir \ 22 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 23 // RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s 24 // 25 // CHECK-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 26 // CHECK-SHARED-ASAN-LINUX-NOT: "-lc" 27 // CHECK-SHARED-ASAN-LINUX-NOT: libclang_rt.asan-i386.a" 28 // CHECK-SHARED-ASAN-LINUX: libclang_rt.asan-i386.so" 29 // CHECK-SHARED-ASAN-LINUX: "-whole-archive" "{{.*}}libclang_rt.asan-preinit-i386.a" "-no-whole-archive" 30 // CHECK-SHARED-ASAN-LINUX-NOT: "-lpthread" 31 // CHECK-SHARED-ASAN-LINUX-NOT: "-lrt" 32 // CHECK-SHARED-ASAN-LINUX-NOT: "-ldl" 33 // CHECK-SHARED-ASAN-LINUX-NOT: "-export-dynamic" 34 // CHECK-SHARED-ASAN-LINUX-NOT: "--dynamic-list" 35 36 // RUN: %clang -no-canonical-prefixes %s -### -o %t.so -shared 2>&1 \ 37 // RUN: -target i386-unknown-linux -fsanitize=address -shared-libasan \ 38 // RUN: -resource-dir=%S/Inputs/resource_dir \ 39 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 40 // RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-ASAN-LINUX %s 41 // 42 // CHECK-DSO-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 43 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lc" 44 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: libclang_rt.asan-i386.a" 45 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "libclang_rt.asan-preinit-i386.a" 46 // CHECK-DSO-SHARED-ASAN-LINUX: libclang_rt.asan-i386.so" 47 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lpthread" 48 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lrt" 49 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-ldl" 50 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-export-dynamic" 51 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "--dynamic-list" 52 53 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 54 // RUN: -target i386-unknown-freebsd -fsanitize=address \ 55 // RUN: -resource-dir=%S/Inputs/resource_dir \ 56 // RUN: --sysroot=%S/Inputs/basic_freebsd_tree \ 57 // RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD %s 58 // 59 // CHECK-ASAN-FREEBSD: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 60 // CHECK-ASAN-FREEBSD-NOT: "-lc" 61 // CHECK-ASAN-FREEBSD-NOT: libclang_rt.asan_cxx 62 // CHECK-ASAN-FREEBSD: freebsd{{/|\\+}}libclang_rt.asan-i386.a" 63 // CHECK-ASAN-FREEBSD-NOT: libclang_rt.asan_cxx 64 // CHECK-ASAN-FREEBSD-NOT: "--dynamic-list" 65 // CHECK-ASAN-FREEBSD: "-export-dynamic" 66 // CHECK-ASAN-FREEBSD: "-lpthread" 67 // CHECK-ASAN-FREEBSD: "-lrt" 68 69 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 70 // RUN: -target i386-unknown-freebsd -fsanitize=address \ 71 // RUN: -resource-dir=%S/Inputs/resource_dir \ 72 // RUN: --sysroot=%S/Inputs/basic_freebsd_tree \ 73 // RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD-LDL %s 74 // 75 // CHECK-ASAN-FREEBSD-LDL: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 76 // CHECK-ASAN-FREEBSD-LDL-NOT: "-ldl" 77 78 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 79 // RUN: -target i386-unknown-linux -fsanitize=address \ 80 // RUN: -resource-dir=%S/Inputs/empty_resource_dir \ 81 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 82 // RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX %s 83 // 84 // CHECK-ASAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 85 // CHECK-ASAN-LINUX-CXX-NOT: "-lc" 86 // CHECK-ASAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.asan-i386.a" "-no-whole-archive" 87 // CHECK-ASAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.asan_cxx-i386.a" "-no-whole-archive" 88 // CHECK-ASAN-LINUX-CXX-NOT: "--dynamic-list" 89 // CHECK-ASAN-LINUX-CXX: "-export-dynamic" 90 // CHECK-ASAN-LINUX-CXX: stdc++ 91 // CHECK-ASAN-LINUX-CXX: "-lpthread" 92 // CHECK-ASAN-LINUX-CXX: "-lrt" 93 // CHECK-ASAN-LINUX-CXX: "-ldl" 94 95 // RUN: %clang -no-canonical-prefixes %s -### -o /dev/null -fsanitize=address \ 96 // RUN: -target i386-unknown-linux --sysroot=%S/Inputs/basic_linux_tree \ 97 // RUN: -lstdc++ -static 2>&1 \ 98 // RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX-STATIC %s 99 // 100 // CHECK-ASAN-LINUX-CXX-STATIC: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 101 // CHECK-ASAN-LINUX-CXX-STATIC-NOT: stdc++ 102 // CHECK-ASAN-LINUX-CXX-STATIC: "-whole-archive" "{{.*}}libclang_rt.asan-i386.a" "-no-whole-archive" 103 // CHECK-ASAN-LINUX-CXX-STATIC: stdc++ 104 105 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 106 // RUN: -target arm-linux-gnueabi -fsanitize=address \ 107 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ 108 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ARM %s 109 // 110 // CHECK-ASAN-ARM: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 111 // CHECK-ASAN-ARM-NOT: "-lc" 112 // CHECK-ASAN-ARM: libclang_rt.asan-arm.a" 113 // 114 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 115 // RUN: -target armv7l-linux-gnueabi -fsanitize=address \ 116 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ 117 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ARMv7 %s 118 // 119 // CHECK-ASAN-ARMv7: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 120 // CHECK-ASAN-ARMv7-NOT: "-lc" 121 // CHECK-ASAN-ARMv7: libclang_rt.asan-arm.a" 122 123 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 124 // RUN: -target arm-linux-androideabi -fsanitize=address \ 125 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ 126 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID %s 127 // 128 // CHECK-ASAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 129 // CHECK-ASAN-ANDROID-NOT: "-lc" 130 // CHECK-ASAN-ANDROID: "-pie" 131 // CHECK-ASAN-ANDROID-NOT: "-lpthread" 132 // CHECK-ASAN-ANDROID: libclang_rt.asan-arm-android.so" 133 // CHECK-ASAN-ANDROID-NOT: "-lpthread" 134 // 135 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 136 // RUN: -target arm-linux-androideabi -fsanitize=address \ 137 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ 138 // RUN: -shared-libasan \ 139 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED-LIBASAN %s 140 // 141 // CHECK-ASAN-ANDROID-SHARED-LIBASAN-NOT: argument unused during compilation: '-shared-libasan' 142 // 143 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 144 // RUN: -target arm-linux-androideabi -fsanitize=address \ 145 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ 146 // RUN: -shared \ 147 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED %s 148 // 149 // CHECK-ASAN-ANDROID-SHARED: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 150 // CHECK-ASAN-ANDROID-SHARED-NOT: "-lc" 151 // CHECK-ASAN-ANDROID-SHARED: libclang_rt.asan-arm-android.so" 152 // CHECK-ASAN-ANDROID-SHARED-NOT: "-lpthread" 153 154 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 155 // RUN: -target x86_64-unknown-linux -lstdc++ -fsanitize=thread \ 156 // RUN: -resource-dir=%S/Inputs/resource_dir \ 157 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 158 // RUN: | FileCheck --check-prefix=CHECK-TSAN-LINUX-CXX %s 159 // 160 // CHECK-TSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 161 // CHECK-TSAN-LINUX-CXX-NOT: stdc++ 162 // CHECK-TSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.tsan-x86_64.a" "-no-whole-archive" 163 // CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan-x86_64.a.syms" 164 // CHECK-TSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.tsan_cxx-x86_64.a" "-no-whole-archive" 165 // CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan_cxx-x86_64.a.syms" 166 // CHECK-TSAN-LINUX-CXX-NOT: "-export-dynamic" 167 // CHECK-TSAN-LINUX-CXX: stdc++ 168 // CHECK-TSAN-LINUX-CXX: "-lpthread" 169 // CHECK-TSAN-LINUX-CXX: "-lrt" 170 // CHECK-TSAN-LINUX-CXX: "-ldl" 171 172 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 173 // RUN: -target x86_64-unknown-linux -lstdc++ -fsanitize=memory \ 174 // RUN: -resource-dir=%S/Inputs/resource_dir \ 175 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 176 // RUN: | FileCheck --check-prefix=CHECK-MSAN-LINUX-CXX %s 177 // 178 // CHECK-MSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 179 // CHECK-MSAN-LINUX-CXX-NOT: stdc++ 180 // CHECK-MSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "-no-whole-archive" 181 // CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan-x86_64.a.syms" 182 // CHECK-MSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.msan_cxx-x86_64.a" "-no-whole-archive" 183 // CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan_cxx-x86_64.a.syms" 184 // CHECK-MSAN-LINUX-CXX-NOT: "-export-dynamic" 185 // CHECK-MSAN-LINUX-CXX: stdc++ 186 // CHECK-MSAN-LINUX-CXX: "-lpthread" 187 // CHECK-MSAN-LINUX-CXX: "-lrt" 188 // CHECK-MSAN-LINUX-CXX: "-ldl" 189 190 // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \ 191 // RUN: -target i386-unknown-linux \ 192 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 193 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s 194 // CHECK-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}" 195 // CHECK-UBSAN-LINUX-NOT: libclang_rt.asan 196 // CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx 197 // CHECK-UBSAN-LINUX: "-whole-archive" "{{.*}}libclang_rt.ubsan_standalone-i386.a" "-no-whole-archive" 198 // CHECK-UBSAN-LINUX-NOT: libclang_rt.asan 199 // CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx 200 // CHECK-UBSAN-LINUX-NOT: "-lstdc++" 201 // CHECK-UBSAN-LINUX: "-lpthread" 202 203 // RUN: %clang -fsanitize=undefined -fsanitize-link-c++-runtime %s -### -o %t.o 2>&1 \ 204 // RUN: -target i386-unknown-linux \ 205 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 206 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-LINK-CXX %s 207 // CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++" 208 // CHECK-UBSAN-LINUX-LINK-CXX: "-whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx-i386.a" "-no-whole-archive" 209 // CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++" 210 211 // RUN: %clangxx -fsanitize=undefined %s -### -o %t.o 2>&1 \ 212 // RUN: -target i386-unknown-linux \ 213 // RUN: -resource-dir=%S/Inputs/resource_dir \ 214 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 215 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-CXX %s 216 // CHECK-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}" 217 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan 218 // CHECK-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.ubsan_standalone-i386.a" "-no-whole-archive" 219 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan 220 // CHECK-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx-i386.a" "-no-whole-archive" 221 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan 222 // CHECK-UBSAN-LINUX-CXX: "-lstdc++" 223 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan 224 // CHECK-UBSAN-LINUX-CXX: "-lpthread" 225 226 // RUN: %clang -fsanitize=address,undefined %s -### -o %t.o 2>&1 \ 227 // RUN: -target i386-unknown-linux \ 228 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 229 // RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX %s 230 // CHECK-ASAN-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}" 231 // CHECK-ASAN-UBSAN-LINUX: "-whole-archive" "{{.*}}libclang_rt.asan-i386.a" "-no-whole-archive" 232 // CHECK-ASAN-UBSAN-LINUX-NOT: libclang_rt.ubsan 233 // CHECK-ASAN-UBSAN-LINUX-NOT: "-lstdc++" 234 // CHECK-ASAN-UBSAN-LINUX: "-lpthread" 235 236 // RUN: %clangxx -fsanitize=address,undefined %s -### -o %t.o 2>&1 \ 237 // RUN: -target i386-unknown-linux \ 238 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 239 // RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX-CXX %s 240 // CHECK-ASAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}" 241 // CHECK-ASAN-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.asan-i386.a" "-no-whole-archive" 242 // CHECK-ASAN-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.asan_cxx-i386.a" "-no-whole-archive" 243 // CHECK-ASAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan 244 // CHECK-ASAN-UBSAN-LINUX-CXX: "-lstdc++" 245 // CHECK-ASAN-UBSAN-LINUX-CXX: "-lpthread" 246 247 // RUN: %clangxx -fsanitize=memory,undefined %s -### -o %t.o 2>&1 \ 248 // RUN: -target x86_64-unknown-linux \ 249 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 250 // RUN: | FileCheck --check-prefix=CHECK-MSAN-UBSAN-LINUX-CXX %s 251 // CHECK-MSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}" 252 // CHECK-MSAN-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "-no-whole-archive" 253 // CHECK-MSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan 254 255 // RUN: %clangxx -fsanitize=thread,undefined %s -### -o %t.o 2>&1 \ 256 // RUN: -target x86_64-unknown-linux \ 257 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 258 // RUN: | FileCheck --check-prefix=CHECK-TSAN-UBSAN-LINUX-CXX %s 259 // CHECK-TSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}" 260 // CHECK-TSAN-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.tsan-x86_64.a" "-no-whole-archive" 261 // CHECK-TSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan 262 263 // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \ 264 // RUN: -target i386-unknown-linux \ 265 // RUN: -resource-dir=%S/Inputs/resource_dir \ 266 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 267 // RUN: -shared \ 268 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHARED %s 269 // CHECK-UBSAN-LINUX-SHARED: "{{.*}}ld{{(.exe)?}}" 270 // CHECK-UBSAN-LINUX-SHARED-NOT: --export-dynamic 271 // CHECK-UBSAN-LINUX-SHARED-NOT: --dynamic-list 272 // CHECK-UBSAN-LINUX-SHARED-NOT: libclang_rt.ubsan 273 274 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 275 // RUN: -target x86_64-unknown-linux -fsanitize=leak \ 276 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 277 // RUN: | FileCheck --check-prefix=CHECK-LSAN-LINUX %s 278 // 279 // CHECK-LSAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 280 // CHECK-LSAN-LINUX-NOT: "-lc" 281 // CHECK-LSAN-LINUX: libclang_rt.lsan-x86_64.a" 282 // CHECK-LSAN-LINUX: "-lpthread" 283 // CHECK-LSAN-LINUX: "-ldl" 284 285 // RUN: %clang -fsanitize=leak,address %s -### -o %t.o 2>&1 \ 286 // RUN: -target x86_64-unknown-linux \ 287 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 288 // RUN: | FileCheck --check-prefix=CHECK-LSAN-ASAN-LINUX %s 289 // CHECK-LSAN-ASAN-LINUX: "{{.*}}ld{{(.exe)?}}" 290 // CHECK-LSAN-ASAN-LINUX-NOT: libclang_rt.lsan 291 // CHECK-LSAN-ASAN-LINUX: libclang_rt.asan-x86_64 292 // CHECK-LSAN-ASAN-LINUX-NOT: libclang_rt.lsan 293 294 // CFI by itself does not link runtime libraries. 295 // RUN: %clang -fsanitize=cfi %s -### -o %t.o 2>&1 \ 296 // RUN: -target x86_64-unknown-linux \ 297 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 298 // RUN: | FileCheck --check-prefix=CHECK-CFI-LINUX %s 299 // CHECK-CFI-LINUX: "{{.*}}ld{{(.exe)?}}" 300 // CHECK-CFI-LINUX-NOT: libclang_rt. 301 302 // CFI with diagnostics links the UBSan runtime. 303 // RUN: %clang -fsanitize=cfi -fno-sanitize-trap=cfi -fsanitize-recover=cfi \ 304 // RUN: %s -### -o %t.o 2>&1\ 305 // RUN: -target x86_64-unknown-linux \ 306 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 307 // RUN: | FileCheck --check-prefix=CHECK-CFI-DIAG-LINUX %s 308 // CHECK-CFI-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}" 309 // CHECK-CFI-DIAG-LINUX: "-whole-archive" "{{[^"]*}}libclang_rt.ubsan_standalone-x86_64.a" "-no-whole-archive" 310 311 // Cross-DSO CFI links the CFI runtime. 312 // RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso %s -### -o %t.o 2>&1 \ 313 // RUN: -target x86_64-unknown-linux \ 314 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 315 // RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-LINUX %s 316 // CHECK-CFI-CROSS-DSO-LINUX: "{{.*}}ld{{(.exe)?}}" 317 // CHECK-CFI-CROSS-DSO-LINUX: "-whole-archive" "{{[^"]*}}libclang_rt.cfi-x86_64.a" "-no-whole-archive" 318 319 // Cross-DSO CFI with diagnostics links just the CFI runtime. 320 // RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso %s -### -o %t.o 2>&1 \ 321 // RUN: -fno-sanitize-trap=cfi -fsanitize-recover=cfi \ 322 // RUN: -target x86_64-unknown-linux \ 323 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 324 // RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-LINUX %s 325 // CHECK-CFI-CROSS-DSO-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}" 326 // CHECK-CFI-CROSS-DSO-DIAG-LINUX: "-whole-archive" "{{[^"]*}}libclang_rt.cfi_diag-x86_64.a" "-no-whole-archive" 327 328 // RUN: %clangxx -fsanitize=address %s -### -o %t.o 2>&1 \ 329 // RUN: -mmacosx-version-min=10.6 \ 330 // RUN: -target x86_64-apple-darwin13.4.0 \ 331 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 332 // RUN: | FileCheck --check-prefix=CHECK-ASAN-DARWIN106-CXX %s 333 // CHECK-ASAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}" 334 // CHECK-ASAN-DARWIN106-CXX: libclang_rt.asan_osx_dynamic.dylib 335 // CHECK-ASAN-DARWIN106-CXX-NOT: -lc++abi 336 337 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 338 // RUN: -target x86_64-unknown-linux -fsanitize=safe-stack \ 339 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ 340 // RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-LINUX %s 341 // 342 // CHECK-SAFESTACK-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 343 // CHECK-SAFESTACK-LINUX-NOT: "-lc" 344 // CHECK-SAFESTACK-LINUX: libclang_rt.safestack-x86_64.a" 345 // CHECK-SAFESTACK-LINUX: "-lpthread" 346 // CHECK-SAFESTACK-LINUX: "-ldl" 347 348 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 349 // RUN: -target arm-linux-androideabi -fsanitize=safe-stack \ 350 // RUN: --sysroot=%S/Inputs/basic_android_tree \ 351 // RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-ARM %s 352 // 353 // CHECK-SAFESTACK-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 354 // CHECK-SAFESTACK-ANDROID-ARM-NOT: libclang_rt.safestack 355 356 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o -shared 2>&1 \ 357 // RUN: -target arm-linux-androideabi -fsanitize=safe-stack \ 358 // RUN: --sysroot=%S/Inputs/basic_android_tree \ 359 // RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-ARM %s 360 // 361 // CHECK-SAFESTACK-SHARED-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 362 // CHECK-SAFESTACK-SHARED-ANDROID-ARM-NOT: libclang_rt.safestack 363 364 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 365 // RUN: -target aarch64-linux-android -fsanitize=safe-stack \ 366 // RUN: --sysroot=%S/Inputs/basic_android_tree \ 367 // RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-AARCH64 %s 368 // 369 // CHECK-SAFESTACK-ANDROID-AARCH64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" 370 // CHECK-SAFESTACK-ANDROID-AARCH64-NOT: libclang_rt.safestack 371 372 // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \ 373 // RUN: -target x86_64-scei-ps4 \ 374 // RUN: -shared \ 375 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-PS4 %s 376 // CHECK-UBSAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}" 377 // CHECK-UBSAN-PS4: -lSceDbgUBSanitizer_stub_weak 378 379 // RUN: %clang -fsanitize=address %s -### -o %t.o 2>&1 \ 380 // RUN: -target x86_64-scei-ps4 \ 381 // RUN: -shared \ 382 // RUN: | FileCheck --check-prefix=CHECK-ASAN-PS4 %s 383 // CHECK-ASAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}" 384 // CHECK-ASAN-PS4: -lSceDbgAddressSanitizer_stub_weak 385 386 // RUN: %clang -fsanitize=address,undefined %s -### -o %t.o 2>&1 \ 387 // RUN: -target x86_64-scei-ps4 \ 388 // RUN: -shared \ 389 // RUN: | FileCheck --check-prefix=CHECK-AUBSAN-PS4 %s 390 // CHECK-AUBSAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}" 391 // CHECK-AUBSAN-PS4: -lSceDbgAddressSanitizer_stub_weak 392