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

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