[clang] [Driver][KCFI] Forward -fsanitize-kcfi-hash= to cc1 (PR #214827)

Sergei Barannikov via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 8 00:19:59 PDT 2026


================
@@ -96,3 +96,35 @@
 
 // RUN: not %clang --target=x86_64-linux-gnu -fsanitize=kcfi,function %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-KCFI-FUNCTION
 // CHECK-KCFI-FUNCTION: error: invalid argument '-fsanitize=kcfi' not allowed with '-fsanitize=function'
+
+// -fsanitize-kcfi-arity is forwarded to cc1 when KCFI is enabled.
+// RUN: %clang --target=x86_64-linux-gnu -fsanitize=kcfi -fsanitize-kcfi-arity %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-KCFI-ARITY
+// CHECK-KCFI-ARITY: "-fsanitize-kcfi-arity"
+
+// Without -fsanitize=kcfi, -fsanitize-kcfi-arity is unused.
+// RUN: %clang --target=x86_64-linux-gnu -fsanitize-kcfi-arity -c %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-KCFI-ARITY-UNUSED
----------------
s-barannikov wrote:

Is the `-c` required here? The test now needs `REQUIRES: x86-registered-target`, otherwise it will fail if `X86` is not in `LLVM_TARGETS_TO_BUILD`.


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


More information about the cfe-commits mailing list