Gentoo Archives: gentoo-dev

From: Sam James <sam@g.o>
To: gentoo-dev@l.g.o
Cc: toolchain@g.o, Sam James <sam@g.o>
Subject: [gentoo-dev] [PATCH 3/5] toolchain-funcs.eclass: include CXXFLAGS in various tc-enables-* checks
Date: Mon, 30 Jan 2023 01:48:08
Message-Id: 20230130014708.2898311-3-sam@gentoo.org
In Reply to: [gentoo-dev] [PATCH 1/5] toolchain-funcs.eclass: add tc-enables-fortify-source for FORTIFY_SOURCE by Sam James
1 SSP and PIE are relevant to C++ too.
2
3 Signed-off-by: Sam James <sam@g.o>
4 ---
5 eclass/toolchain-funcs.eclass | 8 ++++----
6 1 file changed, 4 insertions(+), 4 deletions(-)
7
8 diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
9 index d46104275f8e6..840111f6cc30d 100644
10 --- a/eclass/toolchain-funcs.eclass
11 +++ b/eclass/toolchain-funcs.eclass
12 @@ -1012,7 +1012,7 @@ tc-enables-cxx-assertions() {
13 # Return truth if the current compiler generates position-independent code (PIC)
14 # which can be linked into executables.
15 tc-enables-pie() {
16 - tc-cpp-is-true "defined(__PIE__)" ${CPPFLAGS} ${CFLAGS}
17 + tc-cpp-is-true "defined(__PIE__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
18 }
19
20 # @FUNCTION: tc-enables-fortify-source
21 @@ -1033,7 +1033,7 @@ tc-enables-fortify-source() {
22 # -fstack-protector-strong
23 # -fstack-protector-all
24 tc-enables-ssp() {
25 - tc-cpp-is-true "defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
26 + tc-cpp-is-true "defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
27 }
28
29 # @FUNCTION: tc-enables-ssp-strong
30 @@ -1044,7 +1044,7 @@ tc-enables-ssp() {
31 # -fstack-protector-strong
32 # -fstack-protector-all
33 tc-enables-ssp-strong() {
34 - tc-cpp-is-true "defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
35 + tc-cpp-is-true "defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
36 }
37
38 # @FUNCTION: tc-enables-ssp-all
39 @@ -1054,7 +1054,7 @@ tc-enables-ssp-strong() {
40 # on level corresponding to any of the following options:
41 # -fstack-protector-all
42 tc-enables-ssp-all() {
43 - tc-cpp-is-true "defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
44 + tc-cpp-is-true "defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
45 }
46
47
48 --
49 2.39.1