[LinuxBIOS] [PATCH][v3] Add automagic detection for -fno-stack-protector

Stefan Reinauer stepan at coresystems.de
Tue Jul 3 05:01:43 CEST 2007


* Jordan Crouse <jordan.crouse at amd.com> [070703 01:38]:
> 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

Hi Jordan,

is there some way we can include this in util/xcompile/xcompile
instead?

That script was meant to be an abstraction for stuff like this at some
point.

Comments/flames/ideas of course welcome!

> [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 at 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 \

> -- 
> linuxbios mailing list
> linuxbios at linuxbios.org
> http://www.linuxbios.org/mailman/listinfo/linuxbios

-- 
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.dehttp://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866




More information about the coreboot mailing list