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>
diff --git a/Makefile b/Makefile
index 75936c6..3b02abe 100644
--- a/Makefile
+++ b/Makefile
@@ -63,6 +63,9 @@
 		CFLAGS += -m32
 	endif
 endif
+ifeq ($(ARCH),x86_64)
+	CFLAGS += -mno-red-zone
+endif
 
 LDFLAGS=-T $(LDSCRIPT) -Bsymbolic -shared -nostdlib -znocombreloc \
 		-L$(LIBDIR) $(CRT0)