summaryrefslogtreecommitdiff
path: root/eclass/toolchain.eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/toolchain.eclass')
-rw-r--r--eclass/toolchain.eclass9
1 files changed, 5 insertions, 4 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 2acfad8162ac..59d51d9c1e38 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -677,6 +677,11 @@ tc_enable_hardened_gcc() {
hardened_gcc_flags+=" -DDEF_GENTOO_ZNOW"
fi
+ if _tc_use_if_iuse cet && [[ ${CTARGET} == *x86_64*-linux-gnu* ]] ; then
+ einfo "Updating gcc to use x86-64 control flow protection by default ..."
+ hardened_gcc_flags+=" -DEXTRA_OPTIONS_CF"
+ fi
+
if _tc_use_if_iuse hardened ; then
# Will add some hardened options as default, e.g. for gcc-12
# * -fstack-clash-protection
@@ -688,10 +693,6 @@ tc_enable_hardened_gcc() {
# Add -D_GLIBCXX_ASSERTIONS
hardened_gcc_flags+=" -DDEF_GENTOO_GLIBCXX_ASSERTIONS"
- if _tc_use_if_iuse cet && [[ ${CTARGET} == *x86_64*-linux* ]] ; then
- hardened_gcc_flags+=" -DEXTRA_OPTIONS_CF"
- fi
-
# Rebrand to make bug reports easier
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
fi