about summary refs log tree commit diff
path: root/tests/codegen/sanitizer
diff options
context:
space:
mode:
authorRamon de C Valle <rcvalle@users.noreply.github.com>2025-03-11 19:04:35 +0000
committerRamon de C Valle <rcvalle@users.noreply.github.com>2025-04-05 04:05:04 +0000
commita98546b961a7fc707155aecbde094fbcecce81fd (patch)
treeda6b071ea5c57fbc3fc9e44c4edac62eee00fb5f /tests/codegen/sanitizer
parentbad13a970a136389187dd1cf2f2fc737a8bea5fc (diff)
KCFI: Add KCFI arity indicator support
Adds KCFI arity indicator support to the Rust compiler (see rust-lang/rust#138311,
https://github.com/llvm/llvm-project/pull/121070, and
https://lore.kernel.org/lkml/CANiq72=3ghFxy8E=AU9p+0imFxKr5iU3sd0hVUXed5BA+KjdNQ@mail.gmail.com/).
Diffstat (limited to 'tests/codegen/sanitizer')
-rw-r--r--tests/codegen/sanitizer/kcfi/add-kcfi-arity-flag.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/codegen/sanitizer/kcfi/add-kcfi-arity-flag.rs b/tests/codegen/sanitizer/kcfi/add-kcfi-arity-flag.rs
new file mode 100644
index 00000000000..9a2290901d6
--- /dev/null
+++ b/tests/codegen/sanitizer/kcfi/add-kcfi-arity-flag.rs
@@ -0,0 +1,19 @@
+// Verifies that "kcfi-arity" module flag is added.
+//
+//@ add-core-stubs
+//@ revisions: x86_64
+//@ [x86_64] compile-flags: --target x86_64-unknown-none
+//@ [x86_64] needs-llvm-components: x86
+//@ compile-flags: -Ctarget-feature=-crt-static -Cpanic=abort -Zsanitizer=kcfi -Zsanitizer-kcfi-arity
+//@ min-llvm-version: 21.0.0
+
+#![feature(no_core, lang_items)]
+#![crate_type = "lib"]
+#![no_core]
+
+extern crate minicore;
+use minicore::*;
+
+pub fn foo() {}
+
+// CHECK: !{{[0-9]+}} = !{i32 4, !"kcfi-arity", i32 1}