aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Langasek <steve.langasek@canonical.com>2012-07-20 01:35:36 -0700
committerMatt Fleming <matt.fleming@intel.com>2012-07-20 10:13:49 +0100
commit562349fbf5ee542e96feae675aaa507ab56ef346 (patch)
tree1f9a18192ae40df628ed9b6a7afcc5085abdc719
parent8947b2fb371be0838ce83fbb9e55c5e87fe72e85 (diff)
downloadefilinux-562349fbf5ee542e96feae675aaa507ab56ef346.tar.gz
Pass -mno-red-zone to gcc to be compatible with the UEFI ABI
gcc by default outputs code using the SysV AMD64 ABI. We need to pass -mno-red-zone to ensure compatibility with the Microsoft ABI, which is what UEFI uses. Matthew Garrett explains, "The red zone is part of the AMD64 System V ABI and consists of 128 bytes at the bottom of the stack frame. This region is guaranteed to be left untouched by any interrupt or signal handlers, so it's available for functions to use as scratch space. UEFI uses the Microsoft AMD64 ABI rather than the System V one, and the Microsoft ABI doesn't define a red zone. UEFI executables built on Linux tend to use System V because that means we can link in static libraries built for Linux, rather than needing an entirely separate toolchain and libraries to build UEFI executables. The problem arises when we run one of these executables and there's a UEFI interrupt handler still running. Take an interrupt, Microsoft ABI interrupt handler gets called and the red zone gets overwritten." Signed-off-by: Steve Langasek <steve.langasek@canonical.com> Cc: Matthew Garrett <mjg@redhat.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--Makefile3
1 files changed, 3 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 75936c6..3b02abe 100644
--- a/Makefile
+++ b/Makefile
@@ -63,6 +63,9 @@ ifeq ($(ARCH),ia32)
CFLAGS += -m32
endif
endif
+ifeq ($(ARCH),x86_64)
+ CFLAGS += -mno-red-zone
+endif
LDFLAGS=-T $(LDSCRIPT) -Bsymbolic -shared -nostdlib -znocombreloc \
-L$(LIBDIR) $(CRT0)