cc/gcc: enable plugins if needed
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Jan 28 18:53:37 2011 +0100 (2011-01-28)
changeset 228761608c9365ab
parent 2286 4960f5d9f829
child 2288 e5a0fe2dae5f
cc/gcc: enable plugins if needed

Enabling plugins in binutils is not enough, and gcc also
needs to be ./configured with --enable-plugins, although
this is not documented anywhere... :-/

Reported-by: karthik duraisami <kdconstant@hotmail.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
config/cc/gcc.in
config/cc/gcc.in.2
scripts/build/cc/gcc.sh
     1.1 --- a/config/cc/gcc.in	Wed Jan 26 19:13:18 2011 +0100
     1.2 +++ b/config/cc/gcc.in	Fri Jan 28 18:53:37 2011 +0100
     1.3 @@ -164,10 +164,32 @@
     1.4      bool
     1.5      default n
     1.6  
     1.7 +# The way LTO works is a bit twisted.
     1.8 +# See: http://gcc.gnu.org/wiki/LinkTimeOptimization#Requirements
     1.9 +# Basically:
    1.10 +#   - if binutils has plugins: LTO is handled by ld/gold by loading
    1.11 +#     the plugin when linking
    1.12 +#   - if binutils does not have plugins: LTO is handled by collect2
    1.13 +# In any case, LTO support does not depend on plugins, but takes
    1.14 +# advantage of it
    1.15  config CC_GCC_HAS_LTO
    1.16      bool
    1.17      default n
    1.18  
    1.19 +# Only enable gcc's support for plugins if binutils has it as well
    1.20 +# They are usefull only when doing LTO, but it does no harm enabling
    1.21 +# them even without LTO.
    1.22 +config CC_GCC_ENABLE_PLUGINS
    1.23 +    bool
    1.24 +    depends on BINUTILS_PLUGINS
    1.25 +    default y
    1.26 +
    1.27 +# If binutils installs gold, enable support for gold in gcc
    1.28 +config CC_GCC_GOLD
    1.29 +    bool
    1.30 +    depends on BINUTILS_GOLD_INSTALLED
    1.31 +    default y
    1.32 +
    1.33  config CC_GCC_USE_GMP_MPFR
    1.34      bool
    1.35      default n
     2.1 --- a/config/cc/gcc.in.2	Wed Jan 26 19:13:18 2011 +0100
     2.2 +++ b/config/cc/gcc.in.2	Fri Jan 28 18:53:37 2011 +0100
     2.3 @@ -24,6 +24,14 @@
     2.4        On some systems (eg. Cygwin), PPL and/or CLooG may not
     2.5        build properly (yet), so you'll have to say 'N' here.
     2.6  
     2.7 +# The way LTO works is a bit twisted.
     2.8 +# See: http://gcc.gnu.org/wiki/LinkTimeOptimization#Requirements
     2.9 +# Basically:
    2.10 +#   - if binutils has plugins: LTO is handled by ld/gold by loading
    2.11 +#     the plugin when linking
    2.12 +#   - if binutils does not have plugins: LTO is handled by collect2
    2.13 +# In any case, LTO support does not depend on plugins, but takes
    2.14 +# advantage of it
    2.15  config CC_GCC_USE_LTO
    2.16      bool
    2.17      prompt "Enable LTO"
     3.1 --- a/scripts/build/cc/gcc.sh	Wed Jan 26 19:13:18 2011 +0100
     3.2 +++ b/scripts/build/cc/gcc.sh	Fri Jan 28 18:53:37 2011 +0100
     3.3 @@ -481,13 +481,10 @@
     3.4          "") extra_config+=("--without-long-double-128");;
     3.5      esac
     3.6  
     3.7 -    # If LTO is selected and binutils has gold, then enable
     3.8 -    # building the lto plugin with the --enable-gold option,
     3.9 -    # but only if gold has support for plugins.
    3.10 -    if [    "${CT_BINUTILS_GOLD_INSTALLED}" = "y"   \
    3.11 -         -a "${CT_BINUTILS_GOLD_PLUGINS}" = "y"     \
    3.12 -         -a "${CT_CC_GCC_USE_LTO}" = "y"            \
    3.13 -       ]; then
    3.14 +    if [ "${CT_CC_GCC_ENABLE_PLUGINS}" = "y" ]; then
    3.15 +        extra_config+=( --enable-plugin )
    3.16 +    fi
    3.17 +    if [ "${CT_CC_GCC_GOLD}" = "y" ]; then
    3.18          extra_config+=( --enable-gold )
    3.19      fi
    3.20