commit:     288bc9aff2e91f6a443e8c09f080ffc9f633b07e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 28 19:17:12 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Dec 31 23:30:45 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=288bc9af

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 <AT> gentoo.org>

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

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 021db270828c..0dd23d93e383 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -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"

Reply via email to