Blame SOURCES/0001-Changes-to-make-sure-we-inherit-CFLAGS-properly-from.patch

691814
From f209086af1f0e11b41fdfb24a64bd6fdc4420b2a Mon Sep 17 00:00:00 2001
691814
From: Peter Jones <pjones@redhat.com>
691814
Date: Tue, 18 Mar 2014 11:41:18 -0400
691814
Subject: [PATCH] Changes to make sure we inherit CFLAGS properly from
691814
 rpmbuild.
691814
691814
This makes sure we build with -fstack-protector-strong when invoked
691814
correctly with it in CFLAGS="" from make.
691814
691814
Signed-off-by: Peter Jones <pesign-owner@fedoraproject.org>
691814
---
691814
 Make.defaults                          |   7 ++++---
691814
 Make.efirules                          |   6 +++---
691814
 Make.rules                             |  10 +++++-----
691814
 libdpe/pe_allocspace.c                 |   1 +
691814
 src/Makefile                           |   2 +-
691814
 src/efikeygen.c                        |   2 +-
691814
 util/Makefile                          |   2 +-
691814
 10 files changed, 16 insertions(+), 14 deletions(-)
691814
691814
diff --git a/Make.defaults b/Make.defaults
691814
index e2c967b..0995e5b 100644
691814
--- a/Make.defaults
691814
+++ b/Make.defaults
691814
@@ -5,7 +5,8 @@ HOSTARCH   = $(shell uname -m | sed s,i[3456789]86,ia32,)
691814
 ARCH	   := $(shell uname -m | sed s,i[3456789]86,ia32,)
691814
 INCDIR	   = -I$(TOPDIR)/include
691814
 CPPFLAGS   = -DCONFIG_$(ARCH)
691814
-CFLAGS	   = $(ARCH3264) -g -O0 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants --std=gnu99 -D_GNU_SOURCE
691814
+CFLAGS	   = -g -O0
691814
+BUILDFLAGS := $(CFLAGS) $(ARCH3264) -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants --std=gnu99 -D_GNU_SOURCE -Wno-unused-result -Wno-unused-function
691814
 ASFLAGS    = $(ARCH3264)
691814
 LDFLAGS	   = -nostdlib
691814
 CCLDFLAGS  = -shared
691814
@@ -21,7 +22,7 @@ RANLIB        = $(bindir)ranlib
691814
 OBJCOPY       = $(bindir)objcopy
691814
 
691814
 ifeq ($(ARCH),ia64)
691814
-  CFLAGS += -mfixed-range=f32-f127
691814
+  BUILDFLAGS += -mfixed-range=f32-f127
691814
   LIBDIR = $(PREFIX)/lib64
691814
 endif
691814
 
691814
@@ -33,7 +34,7 @@ ifeq ($(ARCH), ia32)
691814
 endif
691814
 
691814
 ifeq ($(ARCH), x86_64)
691814
-  CFLAGS += -mno-red-zone
691814
+  BUILDFLAGS += -mno-red-zone
691814
   LIBDIR := $(PREFIX)/lib64
691814
   ifeq ($(HOSTARCH), ia32)
691814
     ARCH3264 := -m64
691814
diff --git a/Make.efirules b/Make.efirules
691814
index 9aa4b5b..bed36b1 100644
691814
--- a/Make.efirules
691814
+++ b/Make.efirules
691814
@@ -6,10 +6,10 @@
691814
 	$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
691814
 
691814
 %.o: %.c
691814
-	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -D__UEFI__ -c $< -o $@
691814
+	$(CC) $(INCDIR) $(BUILDFLAGS) $(CPPFLAGS) -D__UEFI__ -c $< -o $@
691814
 
691814
 %.S: %.c
691814
-	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -D__UEFI__ -S $< -o $@
691814
+	$(CC) $(INCDIR) $(BUILDFLAGS) $(CPPFLAGS) -D__UEFI__ -S $< -o $@
691814
 
691814
 %.E: %.c
691814
-	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -D__UEFI__ -E $< -o $@
691814
+	$(CC) $(INCDIR) $(BUILDFLAGS) $(CPPFLAGS) -D__UEFI__ -E $< -o $@
691814
diff --git a/Make.rules b/Make.rules
691814
index 999d717..2749521 100644
691814
--- a/Make.rules
691814
+++ b/Make.rules
691814
@@ -5,18 +5,18 @@
691814
 	$(CC) $(CCLDFLAGS) -o $@ $^ $(foreach lib,$(LIBS),-l$(lib)) $(foreach pklib,$(PKLIBS), $(shell pkg-config --libs-only-l --libs-only-other $(pklib))) -lpthread
691814
 
691814
 %.so : 
691814
-	$(CC) $(INCDIR) $(CFLAGS) -Wl,-soname,$(SONAME) $(CCLDFLAGS) $^ -o $@
691814
+	$(CC) $(INCDIR) $(BUILDFLAGS) -Wl,-soname,$(SONAME) $(CCLDFLAGS) $^ -o $@
691814
 
691814
 %.o: %.c
691814
-	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
691814
+	$(CC) $(INCDIR) $(BUILDFLAGS) $(CPPFLAGS) -c $< -o $@
691814
 
691814
 .%.P : %.c
691814
-	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -M -MM -MF $@ $^
691814
+	$(CC) $(INCDIR) $(BUILDFLAGS) $(CPPFLAGS) -M -MM -MF $@ $^
691814
 
691814
 %.S: %.c
691814
-	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -S $< -o $@
691814
+	$(CC) $(INCDIR) $(BUILDFLAGS) $(CPPFLAGS) -S $< -o $@
691814
 
691814
 %.E: %.c
691814
-	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -E $< -o $@
691814
+	$(CC) $(INCDIR) $(BUILDFLAGS) $(CPPFLAGS) -E $< -o $@
691814
 
691814
 %.c : %.h
691814
diff --git a/libdpe/pe_allocspace.c b/libdpe/pe_allocspace.c
691814
index 716373c..1f0f44a 100644
691814
--- a/libdpe/pe_allocspace.c
691814
+++ b/libdpe/pe_allocspace.c
691814
@@ -19,6 +19,7 @@
691814
 
691814
 #include "libdpe.h"
691814
 
691814
+#include <assert.h>
691814
 #include <unistd.h>
691814
 #include <sys/mman.h>
691814
 #include <sys/types.h>
691814
diff --git a/src/Makefile b/src/Makefile
691814
index f478aa6..e45d2a3 100644
691814
--- a/src/Makefile
691814
+++ b/src/Makefile
691814
@@ -8,7 +8,7 @@ LIBS = popt
691814
 STATIC_LIBS = $(TOPDIR)/libdpe/libdpe.a
691814
 LDFLAGS =
691814
 CCLDFLAGS = -L../libdpe $(foreach pklib,$(PKLIBS), $(shell pkg-config --libs-only-L $(pklib)))
691814
-CFLAGS += -I../include/ $(foreach pklib,$(PKLIBS), $(shell pkg-config --cflags $(pklib))) -Werror
691814
+BUILDFLAGS += -I../include/ $(foreach pklib,$(PKLIBS), $(shell pkg-config --cflags $(pklib))) -Werror
691814
 
691814
 TARGETS = pesign authvar client efisiglist efikeygen peverify
691814
 
691814
diff --git a/src/efikeygen.c b/src/efikeygen.c
691814
index ac27acc..45ee5c5 100644
691814
--- a/src/efikeygen.c
691814
+++ b/src/efikeygen.c
691814
@@ -333,7 +333,7 @@ populate_extensions(cms_context *cms, CERTCertificate *cert,
691814
 
691814
 	oid = SECOID_FindOIDByTag(SEC_OID_PKCS9_EXTENSION_REQUEST);
691814
 
691814
-	for (int i; crq->attributes[i]; i++) {
691814
+	for (int i = 0 ; crq->attributes[i]; i++) {
691814
 		attr = crq->attributes[i];
691814
 		if (attr->attrType.len != oid->oid.len)
691814
 			continue;
691814
diff --git a/util/Makefile b/util/Makefile
691814
index 1cf782c..ff11cb8 100644
691814
--- a/util/Makefile
691814
+++ b/util/Makefile
691814
@@ -7,7 +7,7 @@ FORMAT=efi-app-$(HOSTARCH)
691814
 LDFLAGS = -nostdlib -T $(LIBDIR)/gnuefi/elf_$(HOSTARCH)_efi.lds -shared -Bsymbolic $(LIBDIR)/gnuefi/crt0-efi-$(HOSTARCH).o -L$(LIBDIR)
691814
 LIBS=-lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name)
691814
 CCLDFLAGS =
691814
-CFLAGS = -I/usr/include/efi/ -I/usr/include/efi/$(HOSTARCH)/ -I/usr/include/efi/protocol -fpic -fshort-wchar -fno-reorder-functions -fno-strict-aliasing -fno-merge-constants -mno-red-zone -Wimplicit-function-declaration
691814
+BUILDFLAGS = -I/usr/include/efi/ -I/usr/include/efi/$(HOSTARCH)/ -I/usr/include/efi/protocol -fpic -fshort-wchar -fno-reorder-functions -fno-strict-aliasing -fno-merge-constants -mno-red-zone -Wimplicit-function-declaration
691814
 
691814
 TARGETS = setupsb.efi dumpsb.efi clearpk.efi
691814
 
691814
-- 
691814
1.8.5.3
691814