Merge pull request #608 from stilor/static-no-plugins

Disable LTO for static toolchain
This commit is contained in:
Alexey Neyman 2017-02-19 23:27:21 -08:00 committed by GitHub
commit 6a1b5a3d77
5 changed files with 60 additions and 177 deletions

View File

@ -7,6 +7,7 @@
## select CC_SUPPORT_ADA
## select CC_SUPPORT_OBJC
## select CC_SUPPORT_OBJCXX
## select CC_SUPPORT_GOLANG
##
## help gcc is the full-blown GNU compiler. This is what most people will choose.
## help
@ -128,16 +129,6 @@ endif # ! CC_GCC_CUSTOM
config CC_GCC_4_8
bool
select CC_GCC_4_8_or_later
select CC_GCC_USE_GMP_MPFR
select CC_GCC_USE_MPC
select CC_GCC_HAS_GRAPHITE
select CC_GCC_HAS_LTO
select CC_GCC_HAS_PKGVERSION_BUGURL
select CC_GCC_HAS_BUILD_ID
select CC_GCC_HAS_LNK_HASH_STYLE
select CC_GCC_HAS_LIBQUADMATH
select CC_GCC_HAS_LIBSANITIZER
select CC_SUPPORT_GOLANG
config CC_GCC_4_8_or_later
bool
@ -145,16 +136,6 @@ config CC_GCC_4_8_or_later
config CC_GCC_4_9
bool
select CC_GCC_4_9_or_later
select CC_GCC_USE_GMP_MPFR
select CC_GCC_USE_MPC
select CC_GCC_HAS_GRAPHITE
select CC_GCC_HAS_LTO
select CC_GCC_HAS_PKGVERSION_BUGURL
select CC_GCC_HAS_BUILD_ID
select CC_GCC_HAS_LNK_HASH_STYLE
select CC_GCC_HAS_LIBQUADMATH
select CC_GCC_HAS_LIBSANITIZER
select CC_SUPPORT_GOLANG
config CC_GCC_4_9_or_later
bool
@ -163,17 +144,7 @@ config CC_GCC_4_9_or_later
config CC_GCC_5
bool
select CC_GCC_5_or_later
select CC_GCC_USE_GMP_MPFR
select CC_GCC_USE_MPC
select CC_GCC_HAS_GRAPHITE
select CC_GCC_HAS_LTO
select CC_GCC_HAS_PKGVERSION_BUGURL
select CC_GCC_HAS_BUILD_ID
select CC_GCC_HAS_LNK_HASH_STYLE
select CC_GCC_HAS_LIBQUADMATH
select CC_GCC_HAS_LIBSANITIZER
select CC_GCC_HAS_LIBMPX
select CC_SUPPORT_GOLANG
config CC_GCC_5_or_later
bool
@ -182,17 +153,7 @@ config CC_GCC_5_or_later
config CC_GCC_6
bool
select CC_GCC_6_or_later
select CC_GCC_USE_GMP_MPFR
select CC_GCC_USE_MPC
select CC_GCC_HAS_GRAPHITE
select CC_GCC_HAS_LTO
select CC_GCC_HAS_PKGVERSION_BUGURL
select CC_GCC_HAS_BUILD_ID
select CC_GCC_HAS_LNK_HASH_STYLE
select CC_GCC_HAS_LIBQUADMATH
select CC_GCC_HAS_LIBSANITIZER
select CC_GCC_HAS_LIBMPX
select CC_SUPPORT_GOLANG
config CC_GCC_6_or_later
bool
@ -201,64 +162,7 @@ config CC_GCC_6_or_later
config CC_GCC_latest
bool
select CC_GCC_6_or_later
select CC_GCC_USE_GMP_MPFR
select CC_GCC_USE_MPC
select CC_GCC_HAS_GRAPHITE
select CC_GCC_HAS_LTO
select CC_GCC_HAS_PKGVERSION_BUGURL
select CC_GCC_HAS_BUILD_ID
select CC_GCC_HAS_LNK_HASH_STYLE
select CC_GCC_HAS_LIBQUADMATH
select CC_GCC_HAS_LIBSANITIZER
config CC_GCC_HAS_GRAPHITE
bool
# For graphite: gcc needs cloog and isl
# In >= gcc-5.x, cloog is no longer needed, but isl is.
# Prompt in config/cc/gcc.in.2
config CC_GCC_USE_GRAPHITE
bool
default y
depends on CC_GCC_HAS_GRAPHITE
select CLOOG_NEEDED if !CC_GCC_5_or_later
select ISL_NEEDED
help
Enable the GRAPHITE loop optimsations.
On some systems (eg. Cygwin), CLooG and ISL (required to enable
GRAPHITE) may not build properly (yet), so you'll have to say 'N'
here (or help debug the issues)
TODO: Is this still true on Cygwin?
# 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
# Prompt in config/cc/gcc.in.2
config CC_GCC_USE_LTO
bool
default y
depends on CC_GCC_HAS_LTO
help
Enable the Link Time Optimisations.
config CC_GCC_HAS_PKGVERSION_BUGURL
bool
config CC_GCC_HAS_BUILD_ID
bool
config CC_GCC_HAS_LNK_HASH_STYLE
bool
select CC_GCC_HAS_LIBMPX
# Only enable gcc's support for plugins if binutils has it as well
# They are useful only when doing LTO, but it does no harm enabling
@ -275,21 +179,6 @@ config CC_GCC_GOLD
depends on BINUTILS_GOLD_INSTALLED
default y
config CC_GCC_USE_GMP_MPFR
bool
select GMP_NEEDED
select MPFR_NEEDED
config CC_GCC_USE_MPC
bool
select MPC_NEEDED
config CC_GCC_HAS_LIBQUADMATH
bool
config CC_GCC_HAS_LIBSANITIZER
bool
config CC_GCC_HAS_LIBMPX
bool
@ -315,8 +204,4 @@ config CC_LANG_JAVA_USE_ECJ
default y
depends on CC_LANG_JAVA
# Fortran always requires GMP+MPFR, whatever the gcc version
config CC_LANG_FORTRAN
select CC_GCC_USE_GMP_MPFR
source "config/cc/gcc.in.2"

View File

@ -96,8 +96,22 @@ config CC_GCC_SYSTEM_ZLIB
comment "Optimisation features"
# Defined in config/cc/gcc.in
# For graphite: gcc needs cloog and isl
# In >= gcc-5.x, cloog is no longer needed, but isl is.
# Prompt in config/cc/gcc.in.2
config CC_GCC_USE_GRAPHITE
prompt "Enable GRAPHITE loop optimisations"
bool "Enable GRAPHITE loop optimisations"
default y
select CLOOG_NEEDED if !CC_GCC_5_or_later
select ISL_NEEDED
help
Enable the GRAPHITE loop optimsations.
On some systems (eg. Cygwin), CLooG and ISL (required to enable
GRAPHITE) may not build properly (yet), so you'll have to say 'N'
here (or help debug the issues)
TODO: Is this still true on Cygwin?
# The way LTO works is a bit twisted.
# See: http://gcc.gnu.org/wiki/LinkTimeOptimization#Requirements
@ -107,11 +121,12 @@ config CC_GCC_USE_GRAPHITE
# - 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
# Also, only the 4.5 series needs libelf for LTO; 4.6 has dropped
# the dependency.
# Defined in config/cc/gcc.in
config CC_GCC_USE_LTO
prompt "Enable LTO"
bool "Enable LTO"
default y
depends on ! STATIC_TOOLCHAIN
help
Enable the Link Time Optimisations.
#-----------------------------------------------------------------------------
comment "Settings for libraries running on target"
@ -163,7 +178,6 @@ config CC_GCC_LIBSSP
config CC_GCC_LIBQUADMATH
bool
prompt "Compile libquadmath"
depends on CC_GCC_HAS_LIBQUADMATH
help
libquadmath is a library which provides quad-precision mathematical
functions on targets supporting the __float128 datatype. See:
@ -174,7 +188,6 @@ config CC_GCC_LIBQUADMATH
config CC_GCC_LIBSANITIZER
bool
prompt "Compile libsanitizer"
depends on CC_GCC_HAS_LIBSANITIZER
depends on THREADS_NATIVE
depends on ! LIBC_uClibc && ! LIBC_musl # Currently lacks required headers (like netrom.h)
help
@ -258,7 +271,6 @@ config CC_GCC_LDBL_128
config CC_GCC_BUILD_ID
bool
prompt "Enable build-id"
depends on CC_GCC_HAS_BUILD_ID
help
Tells GCC to pass --build-id option to the linker for all final
links (links performed without the -r or --relocatable option),
@ -271,7 +283,6 @@ config CC_GCC_BUILD_ID
choice CC_GCC_LNK_HASH_STYLE_CHOICE
bool
prompt "linker hash style"
depends on CC_GCC_HAS_LNK_HASH_STYLE
depends on BINUTILS_HAS_HASH_STYLE
config CC_GCC_LNK_HASH_STYLE_DEFAULT

View File

@ -19,12 +19,12 @@ config GETTEXT_NEEDED
select COMPLIBS_NEEDED
config GMP_NEEDED
bool
def_bool y
select GMP
select COMPLIBS_NEEDED
config MPFR_NEEDED
bool
def_bool y
select MPFR
select COMPLIBS_NEEDED
@ -39,7 +39,7 @@ config CLOOG_NEEDED
select COMPLIBS_NEEDED
config MPC_NEEDED
bool
def_bool y
select MPC
select COMPLIBS_NEEDED

View File

@ -140,6 +140,7 @@ config LIBC_NEWLIB_ENABLE_TARGET_OPTSPACE
config LIBC_NEWLIB_LTO
bool
prompt "Enable Link Time Optimization"
depends on CC_GCC_USE_LTO
help
Builds the libraries with -flto to enable more aggressive link time
optimization. You will need to add -flto-partition=one to your

View File

@ -411,10 +411,9 @@ do_gcc_core_backend() {
fi
done
if [ "${CT_CC_GCC_HAS_PKGVERSION_BUGURL}" = "y" ]; then
extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
fi
extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then
extra_config+=("--enable-__cxa_atexit")
else
@ -435,14 +434,12 @@ do_gcc_core_backend() {
else
extra_config+=(--disable-libssp)
fi
if [ "${CT_CC_GCC_HAS_LIBQUADMATH}" = "y" ]; then
if [ "${CT_CC_GCC_LIBQUADMATH}" = "y" ]; then
extra_config+=(--enable-libquadmath)
extra_config+=(--enable-libquadmath-support)
else
extra_config+=(--disable-libquadmath)
extra_config+=(--disable-libquadmath-support)
fi
if [ "${CT_CC_GCC_LIBQUADMATH}" = "y" ]; then
extra_config+=(--enable-libquadmath)
extra_config+=(--enable-libquadmath-support)
else
extra_config+=(--disable-libquadmath)
extra_config+=(--disable-libquadmath-support)
fi
core_LDFLAGS+=("${ldflags}")
@ -479,13 +476,9 @@ do_gcc_core_backend() {
core_LDFLAGS+=("-lm")
fi
if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then
extra_config+=("--with-gmp=${complibs}")
extra_config+=("--with-mpfr=${complibs}")
fi
if [ "${CT_CC_GCC_USE_MPC}" = "y" ]; then
extra_config+=("--with-mpc=${complibs}")
fi
extra_config+=("--with-gmp=${complibs}")
extra_config+=("--with-mpfr=${complibs}")
extra_config+=("--with-mpc=${complibs}")
if [ "${CT_CC_GCC_USE_GRAPHITE}" = "y" ]; then
if [ "${CT_ISL}" = "y" ]; then
extra_config+=("--with-isl=${complibs}")
@ -493,13 +486,13 @@ do_gcc_core_backend() {
if [ "${CT_CLOOG}" = "y" ]; then
extra_config+=("--with-cloog=${complibs}")
fi
elif [ "${CT_CC_GCC_HAS_GRAPHITE}" = "y" ]; then
else
extra_config+=("--with-isl=no")
extra_config+=("--with-cloog=no")
fi
if [ "${CT_CC_GCC_USE_LTO}" = "y" ]; then
extra_config+=("--enable-lto")
elif [ "${CT_CC_GCC_HAS_LTO}" = "y" ]; then
else
extra_config+=("--disable-lto")
fi
@ -893,10 +886,9 @@ do_gcc_backend() {
done
[ "${CT_SHARED_LIBS}" = "y" ] || extra_config+=("--disable-shared")
if [ "${CT_CC_GCC_HAS_PKGVERSION_BUGURL}" = "y" ]; then
extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
fi
extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
case "${CT_CC_GCC_SJLJ_EXCEPTIONS}" in
y) extra_config+=("--enable-sjlj-exceptions");;
m) ;;
@ -930,22 +922,18 @@ do_gcc_backend() {
else
extra_config+=(--disable-libssp)
fi
if [ "${CT_CC_GCC_HAS_LIBQUADMATH}" = "y" ]; then
if [ "${CT_CC_GCC_LIBQUADMATH}" = "y" ]; then
extra_config+=(--enable-libquadmath)
extra_config+=(--enable-libquadmath-support)
else
extra_config+=(--disable-libquadmath)
extra_config+=(--disable-libquadmath-support)
fi
if [ "${CT_CC_GCC_LIBQUADMATH}" = "y" ]; then
extra_config+=(--enable-libquadmath)
extra_config+=(--enable-libquadmath-support)
else
extra_config+=(--disable-libquadmath)
extra_config+=(--disable-libquadmath-support)
fi
if [ "${CT_CC_GCC_HAS_LIBSANITIZER}" = "y" ]; then
if [ "${CT_CC_GCC_LIBSANITIZER}" = "y" ]; then
extra_config+=(--enable-libsanitizer)
else
extra_config+=(--disable-libsanitizer)
fi
if [ "${CT_CC_GCC_LIBSANITIZER}" = "y" ]; then
extra_config+=(--enable-libsanitizer)
else
extra_config+=(--disable-libsanitizer)
fi
if [ "${CT_CC_GCC_HAS_LIBMPX}" = "y" ]; then
@ -990,13 +978,9 @@ do_gcc_backend() {
final_LDFLAGS+=("-lm")
fi
if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then
extra_config+=("--with-gmp=${complibs}")
extra_config+=("--with-mpfr=${complibs}")
fi
if [ "${CT_CC_GCC_USE_MPC}" = "y" ]; then
extra_config+=("--with-mpc=${complibs}")
fi
extra_config+=("--with-gmp=${complibs}")
extra_config+=("--with-mpfr=${complibs}")
extra_config+=("--with-mpc=${complibs}")
if [ "${CT_CC_GCC_USE_GRAPHITE}" = "y" ]; then
if [ "${CT_ISL}" = "y" ]; then
extra_config+=("--with-isl=${complibs}")
@ -1004,13 +988,13 @@ do_gcc_backend() {
if [ "${CT_CLOOG}" = "y" ]; then
extra_config+=("--with-cloog=${complibs}")
fi
elif [ "${CT_CC_GCC_HAS_GRAPHITE}" = "y" ]; then
else
extra_config+=("--with-isl=no")
extra_config+=("--with-cloog=no")
fi
if [ "${CT_CC_GCC_USE_LTO}" = "y" ]; then
extra_config+=("--enable-lto")
elif [ "${CT_CC_GCC_HAS_LTO}" = "y" ]; then
else
extra_config+=("--disable-lto")
fi
@ -1058,6 +1042,8 @@ do_gcc_backend() {
if [ "${CT_CC_GCC_ENABLE_PLUGINS}" = "y" ]; then
extra_config+=( --enable-plugin )
else
extra_config+=( --disable-plugin )
fi
if [ "${CT_CC_GCC_GOLD}" = "y" ]; then
extra_config+=( --enable-gold )