Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Makefile: Always use -mno-red-zone for EFI
This option is mandatory when compiling for EFI as some event handlers
may interupt the running code and use the space just above the reserved
stack space.

Signed-off-by: Sylvain Gault <sylvain.gault@gmail.com>
  • Loading branch information
Sylvain Gault committed Nov 27, 2015
1 parent 2d14923 commit 7d70885
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 3 additions & 1 deletion mk/com32.mk
Expand Up @@ -48,7 +48,9 @@ GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)

ifndef EFI_BUILD
ifdef EFI_BUILD
GCCOPT += -mno-red-zone
else
GCCOPT += -mregparm=3 -DREGPARM=3
endif

Expand Down
6 changes: 4 additions & 2 deletions mk/elf.mk
Expand Up @@ -60,8 +60,10 @@ CFLAGS = $(GCCOPT) $(GCCWARN) -W -Wall \
-I$(com32)/libutil/include -I$(com32)/include \
-I$(com32)/include/sys $(GPLINCLUDE) -I$(core)/include \
-I$(objdir) -DLDLINUX=\"$(LDLINUX)\"
ifndef EFI_BUILD
CFLAGS += -mregparm=3 -DREGPARM=3
ifdef EFI_BUILD
GCCOPT += -mno-red-zone
else
GCCOPT += -mregparm=3 -DREGPARM=3
endif

SFLAGS = $(GCCOPT) -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__
Expand Down
5 changes: 2 additions & 3 deletions mk/embedded.mk
Expand Up @@ -39,10 +39,9 @@ GCCOPT += $(call gcc_ok,-fno-stack-protector,)
GCCOPT += $(call gcc_ok,-fwrapv,)
GCCOPT += $(call gcc_ok,-freg-struct-return,)
ifdef EFI_BUILD
GCCOPT += -Os -fomit-frame-pointer -msoft-float
GCCOPT += -Os -fomit-frame-pointer -msoft-float -mno-red-zone
else
GCCOPT += -Os -fomit-frame-pointer -mregparm=3 -DREGPARM=3 \
-msoft-float
GCCOPT += -Os -fomit-frame-pointer -mregparm=3 -DREGPARM=3 -msoft-float
endif
GCCOPT += $(call gcc_ok,-fno-exceptions,)
GCCOPT += $(call gcc_ok,-fno-asynchronous-unwind-tables,)
Expand Down
4 changes: 3 additions & 1 deletion mk/lib.mk
Expand Up @@ -54,7 +54,9 @@ WARNFLAGS = $(GCCWARN) -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winl

CFLAGS = $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) $(LIBFLAGS)

ifndef EFI_BUILD
ifdef EFI_BUILD
CFLAGS += -mno-red-zone
else
CFLAGS += -mregparm=3 -DREGPARM=3
endif

Expand Down

0 comments on commit 7d70885

Please sign in to comment.