mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-24 18:03:25 +00:00
Add compile flags to disable the red zone optimization
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
81898362b6
commit
5f35189a51
@ -213,6 +213,11 @@ fn build_kernel_elf(
|
||||
// This is to let rustc know that "cfg(ktest)" is our well-known configuration.
|
||||
// See the [Rust Blog](https://blog.rust-lang.org/2024/05/06/check-cfg.html) for details.
|
||||
"--check-cfg cfg(ktest)",
|
||||
// The red zone is a small area below the stack pointer for optimization, primarily in
|
||||
// user-space applications. This optimization can be problematic in the kernel, as the CPU
|
||||
// or exception handlers may overwrite kernel data in the red zone. Therefore, we disable
|
||||
// this optimization.
|
||||
"-C no-redzone=y",
|
||||
]);
|
||||
|
||||
if matches!(arch, Arch::X86_64) {
|
||||
|
Reference in New Issue
Block a user