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>
This commit is contained in:
Yann E. MORIN" 2011-01-28 18:53:37 +01:00
parent a2e31b9c53
commit adbf0ff180
3 changed files with 34 additions and 7 deletions

View File

@ -164,10 +164,32 @@ config CC_GCC_HAS_GRAPHITE
bool
default n
# The way LTO works is a bit twisted.
# See: http://gcc.gnu.org/wiki/LinkTimeOptimization#Requirements
# Basically:
# - if binutils has plugins: LTO is handled by ld/gold by loading
# the plugin when linking
# - if binutils does not have plugins: LTO is handled by collect2
# In any case, LTO support does not depend on plugins, but takes
# advantage of it
config CC_GCC_HAS_LTO
bool
default n
# Only enable gcc's support for plugins if binutils has it as well
# They are usefull only when doing LTO, but it does no harm enabling
# them even without LTO.
config CC_GCC_ENABLE_PLUGINS
bool
depends on BINUTILS_PLUGINS
default y
# If binutils installs gold, enable support for gold in gcc
config CC_GCC_GOLD
bool
depends on BINUTILS_GOLD_INSTALLED
default y
config CC_GCC_USE_GMP_MPFR
bool
default n

View File

@ -24,6 +24,14 @@ config CC_GCC_USE_GRAPHITE
On some systems (eg. Cygwin), PPL and/or CLooG may not
build properly (yet), so you'll have to say 'N' here.
# The way LTO works is a bit twisted.
# See: http://gcc.gnu.org/wiki/LinkTimeOptimization#Requirements
# Basically:
# - if binutils has plugins: LTO is handled by ld/gold by loading
# the plugin when linking
# - if binutils does not have plugins: LTO is handled by collect2
# In any case, LTO support does not depend on plugins, but takes
# advantage of it
config CC_GCC_USE_LTO
bool
prompt "Enable LTO"

View File

@ -481,13 +481,10 @@ do_cc() {
"") extra_config+=("--without-long-double-128");;
esac
# If LTO is selected and binutils has gold, then enable
# building the lto plugin with the --enable-gold option,
# but only if gold has support for plugins.
if [ "${CT_BINUTILS_GOLD_INSTALLED}" = "y" \
-a "${CT_BINUTILS_GOLD_PLUGINS}" = "y" \
-a "${CT_CC_GCC_USE_LTO}" = "y" \
]; then
if [ "${CT_CC_GCC_ENABLE_PLUGINS}" = "y" ]; then
extra_config+=( --enable-plugin )
fi
if [ "${CT_CC_GCC_GOLD}" = "y" ]; then
extra_config+=( --enable-gold )
fi