[coreboot] Patch set updated: 4e39840 mkelfImage: Use -fno-stack-protector if supported by gcc

Patrick Georgi (patrick@georgi-clan.de) gerrit at coreboot.org
Fri Sep 2 23:41:41 CEST 2011


Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/112

-gerrit

commit 4e39840e7dcc5c6e1e63359db630b6cde64ce236
Author: Patrick Georgi <patrick at georgi-clan.de>
Date:   Fri Sep 2 23:40:31 2011 +0200

    mkelfImage: Use -fno-stack-protector if supported by gcc
    
    Gcc 4.1 comes with an SSP https://wiki.ubuntu.com/GccSsp
    This is disabled to work around '__stack_chk_fail' symbol not found failures
    http://www.coreboot.org/FAQ/Obsolete#How_do_I_fix_stack_chk_fail_errors.3F
    
    The presence of -fno-stack-protector is tested for automatically
    
    Change-Id: I28ef158829f5935f985cfd5a5440733685cf479a
    Reported-by: Raymond Danks <raymonddanks at gmail.com>
    Signed-off-by: Patrick Georgi <patrick at georgi-clan.de>
---
 util/mkelfImage/Makefile |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/util/mkelfImage/Makefile b/util/mkelfImage/Makefile
index cd265cf..63569a9 100644
--- a/util/mkelfImage/Makefile
+++ b/util/mkelfImage/Makefile
@@ -14,7 +14,16 @@ pkgdatadir = $(datadir)/$(PACKAGE)
 pkglibdir = $(libdir)/$(PACKAGE)
 pkgincludedir = $(includedir)/$(PACKAGE)
 
-CPPFLAGS=-DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(RELEASE_DATE)"' -I include
+# $1 CC
+# $2 flag to test
+# $3 make statement to evaluate
+testcc=$(if $(shell echo "_start(void) {}" | \
+	$(1) -x c -nostdlib $(2) - -o /dev/null > /dev/null 2> /dev/null && echo success),\
+	$(eval $(3)))
+
+CPPFLAGS=-DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(RELEASE_DATE)"' -I include $(CFLAGS) $(LDFLAGS)
+$(call testcc,$(CC),-f-nostack-protector,CPPFLAGS+=-fno-stack-protector)
+
 HOST_CPPFLAGS=$(CPPFLAGS)
 I386_CPPFLAGS=$(CPPFLAGS) -I arch/i386/include
 IA64_CPPFLAGS=$(CPPFLAGS) -I arch/ia64/include




More information about the coreboot mailing list