From d703c370c78578b63e7b5e04a3801c7f5fbf0c94 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 31 May 2013 15:00:11 -0400 Subject: [PATCH] Disable MMX and SSE. GCC 4.8.0 adds some optimizations that will use movups/movaps (and use %xmm* registers) when they're faster, and of course that won't work at all since UEFI firmwares aren't guaranteed to initialize the mmx/sse instructions. This will be even more annoying, since most UEFI firmwares don't initialize the #DE or #UD trap handlers, and your backtrace will be a random path through uninitialized memory, occasionally including whatever address the IDT has for #UD, but also addresses like "0x4" and "0x507" that you don't normally expect to see in your call path. --- Make.defaults | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Make.defaults b/Make.defaults index 0585915..ea7513e 100644 --- a/Make.defaults +++ b/Make.defaults @@ -60,7 +60,9 @@ CPPFLAGS = -DCONFIG_$(ARCH) ifeq ($(GCCNEWENOUGH),1) CPPFLAGS += -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11 endif -CFLAGS = $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -ffreestanding -fno-stack-protector -fno-stack-check +CFLAGS = $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing \ + -fno-merge-constants -ffreestanding -fno-stack-protector \ + -fno-stack-check ASFLAGS = $(ARCH3264) LDFLAGS = -nostdlib --no-undefined INSTALL = install @@ -78,13 +80,14 @@ ifeq ($(ARCH),ia64) endif ifeq ($(ARCH), ia32) + CFLAGS += -mno-mmx -mno-sse ifeq ($(HOSTARCH), x86_64) ARCH3264 = -m32 endif endif ifeq ($(ARCH), x86_64) - CFLAGS += -mno-red-zone + CFLAGS += -mno-red-zone -mno-mmx -mno-sse ifeq ($(HOSTARCH), ia32) ARCH3264 = -m64 endif -- 1.8.2.1