fix stack protection detection with Jordan's suggestion

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



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3478 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Stefan Reinauer 2008-08-07 15:28:31 +00:00 committed by Stefan Reinauer
parent c359124ef4
commit 85c7aec73e
1 changed files with 14 additions and 1 deletions

View File

@ -63,8 +63,21 @@ include $(PLATFORM-y) $(BUILD-y)
INCLUDES := -I./include INCLUDES := -I./include
INCLUDES += -I$(shell $(CC) -print-search-dirs | head -n 1 | cut -d' ' -f2)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. # 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 lib: lib/libpayload.a lib/$(ARCHDIR-y)/head.o