toolchain.eclass: prepare for USE=hardened => FORTIFY_SOURCE=3, assertions

USE=hardened will now imply:
- default -D_FORTIFY_SOURCE=3 (instead of 2 for normal profiles)
- default -D_GLIBCXX_ASSERTIONS

Bug: https://bugs.gentoo.org/876895
Bug: https://bugs.gentoo.org/884417
Bug: https://bugs.gentoo.org/847148
Bug: https://bugs.gentoo.org/876893
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2022-12-31 23:30:45 +00:00
parent 5bb8ad7050
commit 288bc9aff2
+4
View File
@@ -820,6 +820,10 @@ make_gcc_hard() {
# * -z now
# See gcc *_all_extra-options.patch patches.
gcc_hard_flags+=" -DEXTRA_OPTIONS"
# Default to -D_FORTIFY_SOURCE=3 instead of -D_FORTIFY_SOURCE=2
gcc_hard_flags+=" -DGENTOO_FORTIFY_SOURCE_LEVEL=3"
# Add -D_GLIBCXX_ASSERTIONS
gcc_hard_flags+=" -DDEF_GENTOO_GLIBCXX_ASSERTIONS"
if _tc_use_if_iuse cet && [[ ${CTARGET} == *x86_64*-linux* ]] ; then
gcc_hard_flags+=" -DEXTRA_OPTIONS_CF"