Skip to content

Commit 4aa50ef

Browse files
authored
Rollup merge of rust-lang#115734 - tmiasko:kcfi-no-core, r=compiler-errors
Use no_core for KCFI tests to exercise them in CI
2 parents b982fc3 + 4b06c21 commit 4aa50ef

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
// Verifies that "kcfi" module flag is added.
22
//
3-
// needs-sanitizer-kcfi
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: x86
48
// compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi
59

10+
#![feature(no_core, lang_items)]
611
#![crate_type="lib"]
12+
#![no_core]
13+
14+
#[lang="sized"]
15+
trait Sized { }
16+
#[lang="copy"]
17+
trait Copy { }
718

819
pub fn foo() {
920
}

tests/ui/sanitize/cfg.rs

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
// Verifies that when compiling with -Zsanitizer=option,
22
// the `#[cfg(sanitize = "option")]` attribute is configured.
33

4-
// needs-sanitizer-support
54
// check-pass
65
// revisions: address cfi kcfi leak memory thread
76
//[address]needs-sanitizer-address
87
//[address]compile-flags: -Zsanitizer=address --cfg address
98
//[cfi]needs-sanitizer-cfi
109
//[cfi]compile-flags: -Zsanitizer=cfi --cfg cfi -Clto
11-
//[kcfi]needs-sanitizer-kcfi
12-
//[kcfi]compile-flags: -Zsanitizer=kcfi --cfg kcfi
10+
//[kcfi]needs-llvm-components: x86
11+
//[kcfi]compile-flags: -Zsanitizer=kcfi --cfg kcfi --target x86_64-unknown-none
1312
//[leak]needs-sanitizer-leak
1413
//[leak]compile-flags: -Zsanitizer=leak --cfg leak
1514
//[memory]needs-sanitizer-memory
1615
//[memory]compile-flags: -Zsanitizer=memory --cfg memory
1716
//[thread]needs-sanitizer-thread
1817
//[thread]compile-flags: -Zsanitizer=thread --cfg thread
1918

20-
#![feature(cfg_sanitize)]
19+
#![feature(cfg_sanitize, no_core, lang_items)]
20+
#![crate_type="lib"]
21+
#![no_core]
22+
23+
#[lang="sized"]
24+
trait Sized { }
25+
#[lang="copy"]
26+
trait Copy { }
2127

2228
#[cfg(all(sanitize = "address", address))]
2329
fn main() {}
@@ -36,3 +42,7 @@ fn main() {}
3642

3743
#[cfg(all(sanitize = "thread", thread))]
3844
fn main() {}
45+
46+
fn check() {
47+
main();
48+
}

0 commit comments

Comments
 (0)