Add -mno-red-zone to the kernel CCFLAGS/C++FLAGS.

The red zone is a 128-byte area below the stack pointer specified by the
AMD64 ABI that can be used by leaf functions for their stack frame without
modifying the stack pointer. It is guaranteed not to be modified by signal
handlers. This cannot be used in kernel mode code, as an interrupt handler
could overwrite it, so stop GCC from generating code that uses it.
This commit is contained in:
Alex Smith 2012-06-15 20:05:25 +01:00
parent 73f27ecd3a
commit 8c0e3c951a
1 changed files with 5 additions and 3 deletions

View File

@ -383,9 +383,11 @@ switch $(HAIKU_ARCH) {
} }
case x86_64 : case x86_64 :
{ {
# Kernel lives in the top 2GB of the address space, use kernel code model. # Kernel lives in the top 2GB of the address space, use kernel code
HAIKU_KERNEL_CCFLAGS += -mcmodel=kernel ; # model. Also disable the red zone, which cannot be used in kernel
HAIKU_KERNEL_C++FLAGS += -mcmodel=kernel ; # code due to interrupts.
HAIKU_KERNEL_CCFLAGS += -mcmodel=kernel -mno-red-zone ;
HAIKU_KERNEL_C++FLAGS += -mcmodel=kernel -mno-red-zone ;
# Bootloader is 32-bit. # Bootloader is 32-bit.
HAIKU_BOOT_LINKFLAGS += -m elf_i386_haiku ; HAIKU_BOOT_LINKFLAGS += -m elf_i386_haiku ;