Blame SOURCES/0002-Makefiles-ensure-m32-gets-propogated-to-our-gcc-para.patch

00e791
From 32f71225382ddb7dd1ad51f584bc3d42a7ee39d1 Mon Sep 17 00:00:00 2001
00e791
From: Peter Jones <pjones@redhat.com>
00e791
Date: Thu, 12 Apr 2018 13:24:48 -0400
00e791
Subject: [PATCH 02/62] Makefiles: ensure -m32 gets propogated to our gcc
00e791
 parameter queries
00e791
00e791
'gcc -print-file-name=include' and 'gcc -print-libgcc-file-name' both
00e791
need -m32 when we're building 32-on-64 on some distros, so ensure that
00e791
gets propogated correctly.
00e791
00e791
Signed-off-by: Peter Jones <pjones@redhat.com>
00e791
Upstream-commit-id: 104d6e54ac7
00e791
---
00e791
 Make.defaults | 66 ++++++++++++++++++++++++++-------------------------
00e791
 1 file changed, 34 insertions(+), 32 deletions(-)
00e791
00e791
diff --git a/Make.defaults b/Make.defaults
00e791
index e11ab5a7f2c..bbfc1d7f77b 100644
00e791
--- a/Make.defaults
00e791
+++ b/Make.defaults
00e791
@@ -33,66 +33,46 @@ EFI_INCLUDES	= -nostdinc -I$(TOPDIR)/Cryptlib -I$(TOPDIR)/Cryptlib/Include \
00e791
 		  -I$(EFI_INCLUDE) -I$(EFI_INCLUDE)/$(ARCH) -I$(EFI_INCLUDE)/protocol \
00e791
 		  -I$(TOPDIR)/include -iquote $(TOPDIR) -iquote $(shell pwd)
00e791
 
00e791
-LIB_GCC		= $(shell $(CC) -print-libgcc-file-name)
00e791
-EFI_LIBS	= -lefi -lgnuefi --start-group Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a --end-group $(LIB_GCC)
00e791
-
00e791
 EFI_CRT_OBJS 	= $(EFI_PATH)/crt0-efi-$(ARCH).o
00e791
 EFI_LDS		= $(TOPDIR)/elf_$(ARCH)_efi.lds
00e791
 
00e791
-CFLAGS		= -ggdb -O0 -fno-stack-protector -fno-strict-aliasing -fpic \
00e791
-		  -fshort-wchar -Wall -Wsign-compare -Werror -fno-builtin \
00e791
-		  -Werror=sign-compare -ffreestanding -std=gnu89 \
00e791
-		  -I$(shell $(CC) -print-file-name=include) \
00e791
-		  "-DDEFAULT_LOADER=L\"$(DEFAULT_LOADER)\"" \
00e791
-		  "-DDEFAULT_LOADER_CHAR=\"$(DEFAULT_LOADER)\"" \
00e791
-		  $(EFI_INCLUDES)
00e791
-
00e791
 CLANG_BUGS	= $(if $(findstring gcc,$(CC)),-maccumulate-outgoing-args,)
00e791
 
00e791
 COMMIT_ID ?= $(shell if [ -e .git ] ; then git log -1 --pretty=format:%H ; elif [ -f commit ]; then cat commit ; else echo master; fi)
00e791
 
00e791
-ifneq ($(origin OVERRIDE_SECURITY_POLICY), undefined)
00e791
-	CFLAGS	+= -DOVERRIDE_SECURITY_POLICY
00e791
-endif
00e791
-
00e791
-ifneq ($(origin ENABLE_HTTPBOOT), undefined)
00e791
-	CFLAGS	+= -DENABLE_HTTPBOOT
00e791
-endif
00e791
-
00e791
-ifneq ($(origin REQUIRE_TPM), undefined)
00e791
-	CFLAGS  += -DREQUIRE_TPM
00e791
-endif
00e791
-
00e791
 ifeq ($(ARCH),x86_64)
00e791
-	CFLAGS	+= -mno-mmx -mno-sse -mno-red-zone -nostdinc \
00e791
-		   $(CLANG_BUGS) -m64 \
00e791
-		   -DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI \
00e791
-		   -DNO_BUILTIN_VA_FUNCS -DMDE_CPU_X64 -DPAGE_SIZE=4096
00e791
+	ARCH_CFLAGS		?= -mno-mmx -mno-sse -mno-red-zone -nostdinc \
00e791
+				   $(CLANG_BUGS) -m64 \
00e791
+				   -DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI \
00e791
+				   -DNO_BUILTIN_VA_FUNCS -DMDE_CPU_X64 \
00e791
+				   -DPAGE_SIZE=4096
00e791
 	LIBDIR			?= $(prefix)/lib64
00e791
 	ARCH_SUFFIX		?= x64
00e791
 	ARCH_SUFFIX_UPPER	?= X64
00e791
 	ARCH_LDFLAGS		?=
00e791
 endif
00e791
 ifeq ($(ARCH),ia32)
00e791
-	CFLAGS	+= -mno-mmx -mno-sse -mno-red-zone -nostdinc \
00e791
-		   $(CLANG_BUGS) -m32 \
00e791
-		   -DMDE_CPU_IA32 -DPAGE_SIZE=4096
00e791
+	ARCH_CFLAGS		?= -mno-mmx -mno-sse -mno-red-zone -nostdinc \
00e791
+				   $(CLANG_BUGS) -m32 \
00e791
+				   -DMDE_CPU_IA32 -DPAGE_SIZE=4096
00e791
 	LIBDIR			?= $(prefix)/lib
00e791
 	ARCH_SUFFIX		?= ia32
00e791
 	ARCH_SUFFIX_UPPER	?= IA32
00e791
 	ARCH_LDFLAGS		?=
00e791
+	ARCH_CFLAGS		?= -m32
00e791
 endif
00e791
 ifeq ($(ARCH),aarch64)
00e791
-	CFLAGS += -DMDE_CPU_AARCH64 -DPAGE_SIZE=4096 -mstrict-align
00e791
+	ARCH_CFLAGS		?= -DMDE_CPU_AARCH64 -DPAGE_SIZE=4096 -mstrict-align
00e791
 	LIBDIR			?= $(prefix)/lib64
00e791
 	ARCH_SUFFIX		?= aa64
00e791
 	ARCH_SUFFIX_UPPER	?= AA64
00e791
 	FORMAT			:= -O binary
00e791
 	SUBSYSTEM		:= 0xa
00e791
 	ARCH_LDFLAGS		+= --defsym=EFI_SUBSYSTEM=$(SUBSYSTEM)
00e791
+	ARCH_CFLAGS		?=
00e791
 endif
00e791
 ifeq ($(ARCH),arm)
00e791
-	CFLAGS += -DMDE_CPU_ARM -DPAGE_SIZE=4096 -mstrict-align
00e791
+	ARCH_CFLAGS		?= -DMDE_CPU_ARM -DPAGE_SIZE=4096 -mstrict-align
00e791
 	LIBDIR			?= $(prefix)/lib
00e791
 	ARCH_SUFFIX		?= arm
00e791
 	ARCH_SUFFIX_UPPER	?= ARM
00e791
@@ -101,6 +81,28 @@ ifeq ($(ARCH),arm)
00e791
 	ARCH_LDFLAGS		+= --defsym=EFI_SUBSYSTEM=$(SUBSYSTEM)
00e791
 endif
00e791
 
00e791
+CFLAGS		= -ggdb -O0 -fno-stack-protector -fno-strict-aliasing -fpic \
00e791
+		  -fshort-wchar -Wall -Wsign-compare -Werror -fno-builtin \
00e791
+		  -Werror=sign-compare -ffreestanding -std=gnu89 \
00e791
+		  -I$(shell $(CC) $(ARCH_CFLAGS) -print-file-name=include) \
00e791
+		  "-DDEFAULT_LOADER=L\"$(DEFAULT_LOADER)\"" \
00e791
+		  "-DDEFAULT_LOADER_CHAR=\"$(DEFAULT_LOADER)\"" \
00e791
+		  $(EFI_INCLUDES) $(ARCH_CFLAGS)
00e791
+
00e791
+ifneq ($(origin OVERRIDE_SECURITY_POLICY), undefined)
00e791
+	CFLAGS	+= -DOVERRIDE_SECURITY_POLICY
00e791
+endif
00e791
+
00e791
+ifneq ($(origin ENABLE_HTTPBOOT), undefined)
00e791
+	CFLAGS	+= -DENABLE_HTTPBOOT
00e791
+endif
00e791
+
00e791
+ifneq ($(origin REQUIRE_TPM), undefined)
00e791
+	CFLAGS  += -DREQUIRE_TPM
00e791
+endif
00e791
+
00e791
+LIB_GCC		= $(shell $(CC) $(ARCH_CFLAGS) -print-libgcc-file-name)
00e791
+EFI_LIBS	= -lefi -lgnuefi --start-group Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a --end-group $(LIB_GCC)
00e791
 FORMAT		?= --target efi-app-$(ARCH)
00e791
 EFI_PATH	?= $(LIBDIR)/gnuefi
00e791
 
00e791
-- 
00e791
2.26.2
00e791