about summary refs log tree commit diff
path: root/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs')
-rw-r--r--tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs
new file mode 100644
index 00000000000..eabe0409c9a
--- /dev/null
+++ b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs
@@ -0,0 +1,20 @@
+// Verifies that "kcfi" module flag is added.
+//
+//@ add-core-stubs
+//@ revisions: aarch64 x86_64
+//@ [aarch64] compile-flags: --target aarch64-unknown-none
+//@ [aarch64] needs-llvm-components: aarch64
+//@ [x86_64] compile-flags: --target x86_64-unknown-none
+//@ [x86_64] needs-llvm-components: x86
+//@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi
+
+#![feature(no_core, lang_items)]
+#![crate_type = "lib"]
+#![no_core]
+
+extern crate minicore;
+use minicore::*;
+
+pub fn foo() {}
+
+// CHECK: !{{[0-9]+}} = !{i32 4, !"kcfi", i32 1}