[clang] [Clang][Sanitizers] Enable NSAN on Linux only (PR #96120)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 19 15:51:24 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-driver
Author: Alexander Shaposhnikov (alexander-shaposhnikov)
<details>
<summary>Changes</summary>
Enable nsan on Linux only.
Adding support for X86_64 MacOS requires minimal efforts
(might need to copy some bits from other sanitizers (in compiler-rt)).
Currently the functionality has been tested on Linux only.
---
Full diff: https://github.com/llvm/llvm-project/pull/96120.diff
2 Files Affected:
- (modified) clang/lib/Driver/ToolChains/Darwin.cpp (-3)
- (modified) clang/test/Driver/fsanitize.c (+2-2)
``````````diff
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 64ab328a6d25f..ec509831bf60c 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -3474,9 +3474,6 @@ SanitizerMask Darwin::getSupportedSanitizers() const {
Res |= SanitizerKind::Thread;
}
- if (IsX86_64)
- Res |= SanitizerKind::NumericalStability;
-
return Res;
}
diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c
index db14f6e195c64..aaea518aa634e 100644
--- a/clang/test/Driver/fsanitize.c
+++ b/clang/test/Driver/fsanitize.c
@@ -468,8 +468,8 @@
// RUN: not %clang --target=mips-unknown-linux -fsanitize=numerical %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NSAN-MIPS-LINUX
// CHECK-NSAN-MIPS-LINUX: error: unsupported option '-fsanitize=numerical' for target 'mips-unknown-linux'
-// RUN: %clang --target=x86_64-apple-macos -fsanitize=numerical %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NSAN-X86-64-MACOS
-// CHECK-NSAN-X86-64-MACOS: "-fsanitize=numerical"
+// RUN: not %clang --target=x86_64-apple-macos -fsanitize=numerical %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NSAN-X86-64-MACOS
+// CHECK-NSAN-X86-64-MACOS: error: unsupported option '-fsanitize=numerical' for target 'x86_64-apple-macos'
// RUN: not %clang --target=arm64-apple-macos -fsanitize=numerical %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NSAN-ARM64-MACOS
// CHECK-NSAN-ARM64-MACOS: error: unsupported option '-fsanitize=numerical' for target 'arm64-apple-macos'
``````````
</details>
https://github.com/llvm/llvm-project/pull/96120
More information about the cfe-commits
mailing list