summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Granberg <zorry@gentoo.org>2016-09-13 00:34:03 +0200
committerMagnus Granberg <zorry@gentoo.org>2016-09-13 00:34:03 +0200
commit34b8344e45e74a732b75612d8b3d54db53db6fee (patch)
tree31a1ce555b2dab8274dadcd2b054c1dab1ba10c0 /eclass/toolchain.eclass
parenttoolchain.eclass: add use pch for gcc 6.x support (diff)
downloadgentoo-34b8344e45e74a732b75612d8b3d54db53db6fee.tar.gz
gentoo-34b8344e45e74a732b75612d8b3d54db53db6fee.tar.bz2
gentoo-34b8344e45e74a732b75612d8b3d54db53db6fee.zip
toolchain.eclass: add support for gcc 6.x with no spec files
Diffstat (limited to 'eclass/toolchain.eclass')
-rw-r--r--eclass/toolchain.eclass87
1 files changed, 56 insertions, 31 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 054d487a8866..55249b00249b 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -154,7 +154,7 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
tc_version_is_at_least 4.8 && IUSE+=" graphite" IUSE_DEF+=( sanitize )
tc_version_is_at_least 4.9 && IUSE+=" cilk +vtv"
tc_version_is_at_least 5.0 && IUSE+=" jit mpx"
- tc_version_is_at_least 6.0 && IUSE+=" pie +ssp +pch"
+ tc_version_is_at_least 6.0 && IUSE+=" pie ssp +pch"
fi
IUSE+=" ${IUSE_DEF[*]/#/+}"
@@ -626,6 +626,50 @@ do_gcc_PIE_patches() {
# configure to build with the hardened GCC specs as the default
make_gcc_hard() {
+
+ local gcc_hard_flags=""
+ # Gcc >= 6.X we can use configurations options to turn pie/ssp on as default
+ if tc_version_is_at_least 6.0 ; then
+ if use pie ; then
+ einfo "Updating gcc to use automatic PIE building ..."
+ fi
+ if use ssp ; then
+ einfo "Updating gcc to use automatic SSP building ..."
+ fi
+ if use hardened ; then
+ # Will add some optimatizion as default.
+ gcc_hard_flags+=" -DEXTRA_OPTIONS"
+ # rebrand to make bug reports easier
+ BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
+ fi
+ else
+ if use hardened ; then
+ # rebrand to make bug reports easier
+ BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
+ if hardened_gcc_works ; then
+ einfo "Updating gcc to use automatic PIE + SSP building ..."
+ gcc_hard_flags+=" -DEFAULT_PIE_SSP"
+ elif hardened_gcc_works pie ; then
+ einfo "Updating gcc to use automatic PIE building ..."
+ ewarn "SSP has not been enabled by default"
+ gcc_hard_flags+=" -DEFAULT_PIE"
+ elif hardened_gcc_works ssp ; then
+ einfo "Updating gcc to use automatic SSP building ..."
+ ewarn "PIE has not been enabled by default"
+ gcc_hard_flags+=" -DEFAULT_SSP"
+ else
+ # do nothing if hardened isn't supported, but don't die either
+ ewarn "hardened is not supported for this arch in this gcc version"
+ return 0
+ fi
+ else
+ if hardened_gcc_works ssp ; then
+ einfo "Updating gcc to use automatic SSP building ..."
+ gcc_hard_flags+=" -DEFAULT_SSP"
+ fi
+ fi
+ fi
+
# we want to be able to control the pie patch logic via something other
# than ALL_CFLAGS...
sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
@@ -634,36 +678,8 @@ make_gcc_hard() {
# Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
if tc_version_is_at_least 4.7 ; then
sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
- -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
- -i "${S}"/gcc/Makefile.in
- fi
-
- # defaults to enable for all toolchains
- local gcc_hard_flags=""
- if use hardened ; then
- if hardened_gcc_works ; then
- einfo "Updating gcc to use automatic PIE + SSP building ..."
- gcc_hard_flags+=" -DEFAULT_PIE_SSP"
- elif hardened_gcc_works pie ; then
- einfo "Updating gcc to use automatic PIE building ..."
- ewarn "SSP has not been enabled by default"
- gcc_hard_flags+=" -DEFAULT_PIE"
- elif hardened_gcc_works ssp ; then
- einfo "Updating gcc to use automatic SSP building ..."
- ewarn "PIE has not been enabled by default"
- gcc_hard_flags+=" -DEFAULT_SSP"
- else
- # do nothing if hardened isn't supported, but don't die either
- ewarn "hardened is not supported for this arch in this gcc version"
- return 0
- fi
- # rebrand to make bug reports easier
- BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
- else
- if hardened_gcc_works ssp ; then
- einfo "Updating gcc to use automatic SSP building ..."
- gcc_hard_flags+=" -DEFAULT_SSP"
- fi
+ -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
+ -i "${S}"/gcc/Makefile.in
fi
sed -i \
@@ -1967,6 +1983,11 @@ create_gcc_env_entry() {
}
copy_minispecs_gcc_specs() {
+ # on gcc 6 we don't need minispecs
+ if tc_version_is_at_least 6.0 ; then
+ return 0
+ fi
+
# setup the hardenedno* specs files and the vanilla specs file.
if hardened_gcc_works ; then
create_gcc_env_entry hardenednopiessp
@@ -2307,6 +2328,10 @@ hardened_gcc_is_stable() {
}
want_minispecs() {
+ # on gcc 6 we don't need minispecs
+ if tc_version_is_at_least 6.0 ; then
+ return 0
+ fi
if tc_version_is_at_least 4.3.2 && use hardened ; then
if ! want_pie ; then
ewarn "PIE_VER or SPECS_VER is not defined in the GCC ebuild."