[coreboot] r3478 - trunk/payloads/libpayload

svn at coreboot.org svn at coreboot.org
Thu Aug 7 17:28:31 CEST 2008


Author: stepan
Date: 2008-08-07 17:28:31 +0200 (Thu, 07 Aug 2008)
New Revision: 3478

Modified:
   trunk/payloads/libpayload/Makefile
Log:
fix stack protection detection with Jordan's suggestion

Signed-off-by: Stefan Reinauer <stepan at coresystems.de>
Acked-by: Stefan Reinauer <stepan at coresystems.de>



Modified: trunk/payloads/libpayload/Makefile
===================================================================
--- trunk/payloads/libpayload/Makefile	2008-08-07 15:22:01 UTC (rev 3477)
+++ trunk/payloads/libpayload/Makefile	2008-08-07 15:28:31 UTC (rev 3478)
@@ -63,8 +63,21 @@
 
 INCLUDES := -I./include
 INCLUDES += -I$(shell $(CC) -print-search-dirs | head -n 1 | cut -d' ' -f2)include
+
+try-run= $(shell set -e; \
+TMP=".$$$$.tmp"; \
+if ($(1)) > /dev/null 2>&1; \
+then echo "$(2)"; \
+else echo "$(3)"; \
+fi; rm -rf "$$TMP")
+
+cc-option= $(call try-run,\
+$(CC) $(1) -S -xc /dev/null -o "$$TMP", $(1), $(2))
+
+STACKPROTECT += $(call cc-option, -fno-stack-protector,)
+
 # TODO: Re-add -Os as soon as we find out why it caused problems.
-CFLAGS := -Wall -Werror -fno-stack-protector -nostdinc $(INCLUDES)
+CFLAGS := -Wall -Werror $(STACKPROTECT) -nostdinc $(INCLUDES)
 
 lib: lib/libpayload.a lib/$(ARCHDIR-y)/head.o
 





More information about the coreboot mailing list