Add __chkstk for aarch64-unknown-uefi

This is based on compiler-rt/lib/builtins/aarch64/chkstk.S:
f8e19b3799
This commit is contained in:
Nicholas Bishop 2023-07-22 15:05:30 -04:00
parent 05ca9048ad
commit da05233935
2 changed files with 25 additions and 0 deletions

View file

@ -0,0 +1,22 @@
#![allow(unused_imports)]
use core::intrinsics;
intrinsics! {
#[naked]
#[cfg(all(target_os = "uefi", not(feature = "no-asm")))]
pub unsafe extern "C" fn __chkstk() {
core::arch::asm!(
".p2align 2",
"lsl x16, x15, #4",
"mov x17, sp",
"1:",
"sub x17, x17, 4096",
"subs x16, x16, 4096",
"ldr xzr, [x17]",
"b.gt 1b",
"ret",
options(noreturn)
);
}
}

View file

@ -58,6 +58,9 @@ pub mod mem;
#[cfg(target_arch = "arm")]
pub mod arm;
#[cfg(target_arch = "aarch64")]
pub mod aarch64;
#[cfg(all(target_arch = "aarch64", target_os = "linux", not(feature = "no-asm"),))]
pub mod aarch64_linux;