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

b8b9f4
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
691814
From: Peter Jones <pjones@redhat.com>
691814
Date: Tue, 18 Mar 2014 11:41:18 -0400
b8b9f4
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
---
b8b9f4
 libdpe/pe_allocspace.c |  1 +
b8b9f4
 src/efikeygen.c        |  2 +-
664c67
 Make.defaults          |  7 ++++---
664c67
 Make.efirules          |  6 +++---
664c67
 Make.rules             | 10 +++++-----
664c67
 src/Makefile           |  2 +-
664c67
 util/Makefile          |  2 +-
664c67
 7 files changed, 16 insertions(+), 14 deletions(-)
691814
b8b9f4
diff --git a/libdpe/pe_allocspace.c b/libdpe/pe_allocspace.c
b8b9f4
index 716373c..1f0f44a 100644
b8b9f4
--- a/libdpe/pe_allocspace.c
b8b9f4
+++ b/libdpe/pe_allocspace.c
b8b9f4
@@ -19,6 +19,7 @@
b8b9f4
 
b8b9f4
 #include "libdpe.h"
b8b9f4
 
b8b9f4
+#include <assert.h>
b8b9f4
 #include <unistd.h>
b8b9f4
 #include <sys/mman.h>
b8b9f4
 #include <sys/types.h>
b8b9f4
diff --git a/src/efikeygen.c b/src/efikeygen.c
b8b9f4
index ac27acc..45ee5c5 100644
b8b9f4
--- a/src/efikeygen.c
b8b9f4
+++ b/src/efikeygen.c
b8b9f4
@@ -333,7 +333,7 @@ populate_extensions(cms_context *cms, CERTCertificate *cert,
b8b9f4
 
b8b9f4
 	oid = SECOID_FindOIDByTag(SEC_OID_PKCS9_EXTENSION_REQUEST);
b8b9f4
 
b8b9f4
-	for (int i; crq->attributes[i]; i++) {
b8b9f4
+	for (int i = 0 ; crq->attributes[i]; i++) {
b8b9f4
 		attr = crq->attributes[i];
b8b9f4
 		if (attr->attrType.len != oid->oid.len)
b8b9f4
 			continue;
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/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/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