Skip to content

Commit 0e11725

Browse files
committed
Auto merge of #115734 - tmiasko:kcfi-no-core, r=compiler-errors
Use no_core for KCFI tests to exercise them in CI
2 parents 4b91288 + ce19bc3 commit 0e11725

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

Diff for: 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
}

Diff for: tests/ui/sanitize/cfg.rs

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,30 @@
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
10-
//[cfi]compile-flags: -Zsanitizer=cfi --cfg cfi -Clto
11-
//[kcfi]needs-sanitizer-kcfi
12-
//[kcfi]compile-flags: -Zsanitizer=kcfi --cfg kcfi
9+
//[cfi]compile-flags: -Zsanitizer=cfi --cfg cfi
10+
//[cfi]compile-flags: -Clto -Ccodegen-units=1 -Ctarget-feature=-crt-static
11+
//[kcfi]needs-llvm-components: x86
12+
//[kcfi]compile-flags: -Zsanitizer=kcfi --cfg kcfi --target x86_64-unknown-none
1313
//[leak]needs-sanitizer-leak
1414
//[leak]compile-flags: -Zsanitizer=leak --cfg leak
1515
//[memory]needs-sanitizer-memory
1616
//[memory]compile-flags: -Zsanitizer=memory --cfg memory
1717
//[thread]needs-sanitizer-thread
1818
//[thread]compile-flags: -Zsanitizer=thread --cfg thread
1919

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

2229
#[cfg(all(sanitize = "address", address))]
2330
fn main() {}
@@ -36,3 +43,7 @@ fn main() {}
3643

3744
#[cfg(all(sanitize = "thread", thread))]
3845
fn main() {}
46+
47+
pub fn check() {
48+
main();
49+
}

0 commit comments

Comments
 (0)