commit: 86549c2ffccd36fbf393a3574167278a412a4d6d
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 22 23:52:23 2018 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Nov 22 23:52:23 2018 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=86549c2f
8.2.0: pull 10_all_default-fortify-source.patch from Debian, bug #621036
glibc and other packages expect _FORTIFY_SOURCE define to be a number.
Before the patch _FORTIFY_SOURCE was
((defined __OPTIMIZE__ && __OPTIMIZE__ > 0) ? 2 : 0)
After the patch it's
2
(or not set if build is unoptimised).
Reported-by: Martin Kletzander
Bug: https://bugs.gentoo.org/621036
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
8.2.0/gentoo/10_all_default-fortify-source.patch | 17 ++++++++++++-----
8.2.0/gentoo/README.history | 3 +++
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/8.2.0/gentoo/10_all_default-fortify-source.patch
b/8.2.0/gentoo/10_all_default-fortify-source.patch
index 36c5762..d307474 100644
--- a/8.2.0/gentoo/10_all_default-fortify-source.patch
+++ b/8.2.0/gentoo/10_all_default-fortify-source.patch
@@ -1,14 +1,21 @@
-Enable -D_FORTIFY_SOURCE=2 by default.
-
+Taken Debian's patch and removed docs matches:
+ https://salsa.debian.org/toolchain-team/gcc.git
+Also see https://bugs.gentoo.org/621036 where
+initially Gentoo used too complicated macro.
+# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++,
+# DP: if the optimization level is > 0
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
-@@ -951,6 +951,9 @@ c_cpp_builtins (cpp_reader *pfile)
+@@ -951,6 +951,12 @@ c_cpp_builtins (cpp_reader *pfile)
builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
-+ /* Fortify Source enabled by default w/optimization. */
-+ cpp_define (pfile, "_FORTIFY_SOURCE=((defined __OPTIMIZE__ && __OPTIMIZE__
> 0) ? 2 : 0)");
++#if !defined(ACCEL_COMPILER)
++ /* Fortify Source enabled by default for optimization levels > 0 */
++ if (optimize)
++ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2);
++#endif
+
/* Misc. */
if (flag_gnu89_inline)
diff --git a/8.2.0/gentoo/README.history b/8.2.0/gentoo/README.history
index a2e8c1b..52c8a22 100644
--- a/8.2.0/gentoo/README.history
+++ b/8.2.0/gentoo/README.history
@@ -1,3 +1,6 @@
+1.6 TODO
+ U 10_all_default-fortify-source.patch
+
1.5 27 Oct 2018
+ 111_all_ubd-hog-PR85704.patch
U 105_all_libgfortran-Werror.patch