Blame SOURCES/0001-PATCH-Disable-AVX-instruction-set-on-IA32-and-x86_64.patch

67650e
From 99d94682de590719f9333fcf091910a9581b44c0 Mon Sep 17 00:00:00 2001
67650e
From: Nigel Croxon <ncroxon@redhat.com>
67650e
Date: Thu, 13 Jul 2017 08:43:16 -0400
67650e
Subject: [PATCH 01/25] [PATCH] Disable AVX instruction set on IA32 and x86_64
67650e
 platforms
67650e
67650e
If gnu-efi is compiled with "-march=native" on a host that supports AVX, both
67650e
gcc and clang will use AVX instructions freely which is currently not supported
67650e
and will result in a non-functional gnu-efi build (e.g. black screen, hangs).
67650e
67650e
For now, disable AVX on IA32 and x86_64 by checking first if the compiler does
67650e
actually support the appropriate flag (-mno-avx) and use it if possible.
67650e
67650e
Credit for the compiler command line to check if a flag is supported goes to
67650e
Gentoo's awesome flag-o-matic eclass, where it is taken from. Thanks.
67650e
67650e
Signed-off-by: Matthias Dahl <matthias.dahl@binary-island.eu>
67650e
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
67650e
---
67650e
 Make.defaults | 8 ++++++++
67650e
 1 file changed, 8 insertions(+)
67650e
67650e
diff --git a/Make.defaults b/Make.defaults
67650e
index 16f1fd21848..446e676dc14 100755
67650e
--- a/Make.defaults
67650e
+++ b/Make.defaults
67650e
@@ -120,6 +120,14 @@ ifeq ($(ARCH),x86_64)
67650e
   endif
67650e
 endif
67650e
 
67650e
+ifneq (,$(filter $(ARCH),ia32 x86_64))
67650e
+  # Disable AVX, if the compiler supports that.
67650e
+  CC_CAN_DISABLE_AVX=$(shell $(CC) -Werror -c -o /dev/null -xc -mno-avx - </dev/null >/dev/null 2>&1 && echo 1)
67650e
+  ifeq ($(CC_CAN_DISABLE_AVX), 1)
67650e
+    CFLAGS += -mno-avx
67650e
+  endif
67650e
+endif
67650e
+
67650e
 ifeq ($(ARCH),mips64el)
67650e
   CFLAGS += -march=mips64r2
67650e
   ARCH3264 = -mabi=64
67650e
-- 
67650e
2.15.0
67650e