[clang] [Clang][Driver] Link nsan runtime (PR #97364)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 1 17:28:33 PDT 2024


================
@@ -627,6 +627,20 @@
 // CHECK-COV-LINUX: "-lpthread"
 // CHECK-COV-LINUX: "-lresolv"
 
+// RUN: %clang -### %s 2>&1 \
+// RUN:     --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=numerical \
+// RUN:     -resource-dir=%S/Inputs/resource_dir \
+// RUN:     --sysroot=%S/Inputs/basic_linux_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-NSAN-LINUX %s
+//
+// CHECK-NSAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-NSAN-LINUX-NOT: "-lc"
+// CHECK-NSAN-LINUX-NOT: libclang_rt.ubsan
+// CHECK-NSAN-LINUX: libclang_rt.nsan.a"
+// CHECK-NSAN-LINUX: "-lpthread"
----------------
MaskRay wrote:

If the three `-l` are consecutive, it's recommended to place them on the same line like `"-lx" "-ly" "-lz"`

https://github.com/llvm/llvm-project/pull/97364


More information about the cfe-commits mailing list