1 // Verifies that KCFI operand bundles are omitted.
2 //
3 // revisions: aarch64 x86_64
4 // [aarch64] compile-flags: --target aarch64-unknown-none
5 // [aarch64] needs-llvm-components: aarch64
6 // [x86_64] compile-flags: --target x86_64-unknown-none
7 // [x86_64] needs-llvm-components:
8 // compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0
9
10 #![crate_type="lib"]
11 #![feature(no_core, no_sanitize, lang_items)]
12 #![no_core]
13
14 #[lang="sized"]
15 trait Sized { }
16 #[lang="copy"]
17 trait Copy { }
18
19 impl Copy for i32 {}
20
21 #[no_sanitize(kcfi)]
foo(f: fn(i32) -> i32, arg: i32) -> i3222 pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
23 // CHECK-LABEL: sanitizer_kcfi_emit_kcfi_operand_bundle_attr_no_sanitize::foo
24 // CHECK: Function Attrs: {{.*}}
25 // CHECK-LABEL: define{{.*}}foo{{.*}}!{{<unknown kind #36>|kcfi_type}} !{{[0-9]+}}
26 // CHECK: start:
27 // CHECK-NOT: {{%.+}} = call {{(noundef )*}}i32 %f(i32 {{(noundef )*}}%arg){{.*}}[ "kcfi"(i32 {{[-0-9]+}}) ]
28 // CHECK: ret i32 {{%.+}}
29 f(arg)
30 }
31