scripts: support extra host compiler flags
authorMichael Hope <michael.hope@linaro.org>
Wed Oct 05 14:19:51 2011 +1300 (2011-10-05)
changeset 270199de89e9acba
parent 2700 e8d25b041de5
child 2702 293d8334b913
scripts: support extra host compiler flags

Allow the user to configure extra flags to pass to the host compiler
at build time. Applies to both C and C++.

Useful on Ubuntu to turn off the stack protector and fortify defaults
so the program stands a better chance of running on other distros.

Signed-off-by: Michael Hope <michael.hope@linaro.org>
[yann.morin.1998@anciens.enib.fr: put the custom flags at the end]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
config/global/build-behave.in
scripts/crosstool-NG.sh.in
     1.1 --- a/config/global/build-behave.in	Thu Sep 29 15:16:48 2011 +1300
     1.2 +++ b/config/global/build-behave.in	Wed Oct 05 14:19:51 2011 +1300
     1.3 @@ -41,6 +41,16 @@
     1.4        Use gcc's option -pipe to use pipes rather than temp files when building
     1.5        the toolchain.
     1.6  
     1.7 +config EXTRA_FLAGS_FOR_HOST
     1.8 +    string
     1.9 +    prompt "Extra host compiler flags"
    1.10 +    default ""
    1.11 +    help
    1.12 +      Extra flags to pass to the host C and C++ compiler.
    1.13 +
    1.14 +      May be used to change the default features of the host
    1.15 +      compiler such as turning off the stack protector or fortify.
    1.16 +
    1.17  choice
    1.18      bool
    1.19      prompt "Shell to use as CONFIG_SHELL"
     2.1 --- a/scripts/crosstool-NG.sh.in	Thu Sep 29 15:16:48 2011 +1300
     2.2 +++ b/scripts/crosstool-NG.sh.in	Wed Oct 05 14:19:51 2011 +1300
     2.3 @@ -476,7 +476,8 @@
     2.4  
     2.5      # Help gcc
     2.6      CT_CFLAGS_FOR_HOST=
     2.7 -    [ "${CT_USE_PIPES}" = "y" ] && CT_CFLAGS_FOR_HOST="${CT_CFLAGS_FOR_HOST} -pipe"
     2.8 +    [ "${CT_USE_PIPES}" = "y" ] && CT_CFLAGS_FOR_HOST+=" -pipe"
     2.9 +    CT_CFLAGS_FOR_HOST+="${CT_EXTRA_FLAGS_FOR_HOST}"
    2.10  
    2.11      # Override the configured jobs with what's been given on the command line
    2.12      [ -n "${CT_JOBS}" ] && CT_PARALLEL_JOBS="${CT_JOBS}"