commit:     98e481cd2d539c32a7a094d0e5ca6de36f9a0639
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 27 19:41:34 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 27 19:46:28 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=98e481cd

toolchain.eclass: enable CET by default on hardened for >= gcc 11.2.1

11.2.1 will include a patch to enable CET by default if:
- USE=cet is enabled, and
- USE=hardened is enabled, and
- building for x86_64.

See: https://github.com/gentoo/gentoo/pull/21588
Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/toolchain.eclass | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index d80873fcd2e7..f2f16b7f804e 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -626,6 +626,11 @@ make_gcc_hard() {
                        # -z now
                        # see *_all_extra-options.patch gcc patches.
                        gcc_hard_flags+=" -DEXTRA_OPTIONS"
+
+                       if _tc_use_if_iuse cet && [[ ${CTARGET} == 
*x86_64*-linux* ]] ; then
+                               gcc_hard_flags+=" -DEXTRA_OPTIONS_CF"
+                       fi
+
                        # rebrand to make bug reports easier
                        
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
                fi

Reply via email to