Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Sat, 31 Dec 2022 23:49:41
Message-Id: 1672529445.288bc9aff2e91f6a443e8c09f080ffc9f633b07e.sam@gentoo
1 commit: 288bc9aff2e91f6a443e8c09f080ffc9f633b07e
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 28 19:17:12 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 31 23:30:45 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=288bc9af
7
8 toolchain.eclass: prepare for USE=hardened => FORTIFY_SOURCE=3, assertions
9
10 USE=hardened will now imply:
11 - default -D_FORTIFY_SOURCE=3 (instead of 2 for normal profiles)
12 - default -D_GLIBCXX_ASSERTIONS
13
14 Bug: https://bugs.gentoo.org/876895
15 Bug: https://bugs.gentoo.org/884417
16 Bug: https://bugs.gentoo.org/847148
17 Bug: https://bugs.gentoo.org/876893
18 Signed-off-by: Sam James <sam <AT> gentoo.org>
19
20 eclass/toolchain.eclass | 4 ++++
21 1 file changed, 4 insertions(+)
22
23 diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
24 index 021db270828c..0dd23d93e383 100644
25 --- a/eclass/toolchain.eclass
26 +++ b/eclass/toolchain.eclass
27 @@ -820,6 +820,10 @@ make_gcc_hard() {
28 # * -z now
29 # See gcc *_all_extra-options.patch patches.
30 gcc_hard_flags+=" -DEXTRA_OPTIONS"
31 + # Default to -D_FORTIFY_SOURCE=3 instead of -D_FORTIFY_SOURCE=2
32 + gcc_hard_flags+=" -DGENTOO_FORTIFY_SOURCE_LEVEL=3"
33 + # Add -D_GLIBCXX_ASSERTIONS
34 + gcc_hard_flags+=" -DDEF_GENTOO_GLIBCXX_ASSERTIONS"
35
36 if _tc_use_if_iuse cet && [[ ${CTARGET} == *x86_64*-linux* ]] ; then
37 gcc_hard_flags+=" -DEXTRA_OPTIONS_CF"