Yay! You have no idea how happy I am to push this patch up. No more -fno-stack-protector hacks (at least for v3).
Jordan
[PATCH][v3] Add automatic detection for -fno-stack-protector
This borrows the cc-option call from the kernel to check if -fno-stack-protector is supported by the compiler, and if it is, then enable it.
Signed-off-by: Jordan Crouse jordan.crouse@amd.com
Index: LinuxBIOSv3/Makefile =================================================================== --- LinuxBIOSv3.orig/Makefile 2007-07-02 17:21:19.000000000 -0600 +++ LinuxBIOSv3/Makefile 2007-07-02 17:26:32.000000000 -0600 @@ -32,6 +32,19 @@ obj := $(shell pwd)/build export src obj
+# These functions are called by the kernel - we use these below +# to check for -fno-stack-protector + +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)) + # Do not print "Entering directory ...". MAKEFLAGS += --no-print-directory
@@ -42,6 +55,11 @@ -mpreferred-stack-boundary=2 -mregparm=3 -pipe # FIXME: Does stack boundary or regparm break the code on real hardware?
+# Add in automagic detection for -fno-stack-protector +# This is borrowed from the kernel 2.6 scripts + +CFLAGS += $(call cc-option, -fno-stack-protector,) + HOSTCC := gcc HOSTCXX := g++ HOSTCFLAGS := -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \