Skip to content

Commit 75df501

Browse files
committed
Modify the test code to accommodate the #[no_std] pattern to resolve the 'ABI mismatch' issue.
1 parent 931349d commit 75df501

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tests/assembly-llvm/stack-protector/stack-protector-safe-stack.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@
99
//@ [strong] compile-flags: -Z stack-protector=strong
1010
//@ [none] compile-flags: -Z stack-protector=none
1111
//@ [safestack] compile-flags: -Z stack-protector=none -Z sanitizer=safestack
12-
// RUSTFLAGS: -Cunsafe-allow-abi-mismatch=sanitizer
1312
//@ [safestack_strong] compile-flags: -Z stack-protector=strong -Z sanitizer=safestack
14-
// RUSTFLAGS: -Cunsafe-allow-abi-mismatch=sanitizer
1513
//@ [safestack_all] compile-flags: -Z stack-protector=all -Z sanitizer=safestack
16-
// RUSTFLAGS: -Cunsafe-allow-abi-mismatch=sanitizer
1714
//@ compile-flags: -C opt-level=2 -Z merge-functions=disabled
1815

16+
#![no_std]
1917
#![crate_type = "lib"]
2018
#![allow(internal_features)]
2119
#![feature(unsized_fn_params)]
@@ -25,7 +23,7 @@
2523
#[no_mangle]
2624
pub unsafe fn test1(src: *const u8, len: usize) -> u8 {
2725
let mut buf = [0u8; 64];
28-
std::ptr::copy_nonoverlapping(src, buf.as_mut_ptr(), len.min(buf.len()));
26+
core::ptr::copy_nonoverlapping(src, buf.as_mut_ptr(), len.min(buf.len()));
2927
buf[0]
3028

3129
// none-NOT: __stack_chk_fail

0 commit comments

Comments
 (0)