public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/5] toolchain-funcs.eclass: add tc-enables-fortify-source for FORTIFY_SOURCE
@ 2023-01-30  1:47 Sam James
  2023-01-30  1:47 ` [gentoo-dev] [PATCH 2/5] toolchain-funcs.eclass: add tc-enables-cxx-assertions Sam James
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sam James @ 2023-01-30  1:47 UTC (permalink / raw
  To: gentoo-dev; +Cc: toolchain, Sam James

As Zero_Chaos reported on IRC, the check we had wasn't good enough in systemd*
(before we were able to remove it), as it wouldn't fire for e.g. -Os. While we
could've changed it to fail safe (always unset, then set a lower F_S if possible),
let's add a proper helper instead to the eclass.

Bug: https://bugs.gentoo.org/841770
Bug: https://bugs.gentoo.org/847148
Bug: https://bugs.gentoo.org/876893
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/toolchain-funcs.eclass | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index bfcd6819ed0b0..b9e956098b3e2 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1,4 +1,4 @@
-# Copyright 2002-2022 Gentoo Authors
+# Copyright 2002-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: toolchain-funcs.eclass
@@ -1006,6 +1006,15 @@ tc-enables-pie() {
 	tc-cpp-is-true "defined(__PIE__)" ${CPPFLAGS} ${CFLAGS}
 }
 
+# @FUNCTION: tc-enables-fortify-source
+# @RETURN: Truth if the current compiler enables FORTIFY_SOURCE at any level
+# @DESCRIPTION:
+# Return truth if the current compiler enables fortification (FORTIFY_SOURCE)
+# at any level (-D_FORTIFY_SOURCE).
+tc-enables-fortify-source() {
+	tc-cpp-is-true "defined(_FORTIFY_SOURCE)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
+}
+
 # @FUNCTION: tc-enables-ssp
 # @RETURN: Truth if the current compiler enables stack smashing protection (SSP) on at least minimal level
 # @DESCRIPTION:
-- 
2.39.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-01-30  1:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-30  1:47 [gentoo-dev] [PATCH 1/5] toolchain-funcs.eclass: add tc-enables-fortify-source for FORTIFY_SOURCE Sam James
2023-01-30  1:47 ` [gentoo-dev] [PATCH 2/5] toolchain-funcs.eclass: add tc-enables-cxx-assertions Sam James
2023-01-30  1:47 ` [gentoo-dev] [PATCH 3/5] toolchain-funcs.eclass: include CXXFLAGS in various tc-enables-* checks Sam James
2023-01-30  1:47 ` [gentoo-dev] [PATCH 4/5] toolchain-funcs.eclass: style tweaks Sam James
2023-01-30  1:47 ` [gentoo-dev] [PATCH 5/5] toolchain-funcs.eclass: consistently pass CPPFLAGS before C{,XX}FLAGS Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox