commit: 0402657947045ebe81a9806e8dfdeaf69591e6a0 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> AuthorDate: Fri Dec 7 22:53:01 2018 +0000 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> CommitDate: Fri Dec 7 22:53:01 2018 +0000 URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=04026579
7.4.0: pull 10_all_default-fortify-source.patch from Debian, bug #621036 Reported-by: Martin Kletzander Bug: https://bugs.gentoo.org/621036 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> 7.4.0/gentoo/01_all_default-fortify-source.patch | 17 ++++++++++++----- 7.4.0/gentoo/README.history | 5 ++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/7.4.0/gentoo/01_all_default-fortify-source.patch b/7.4.0/gentoo/01_all_default-fortify-source.patch index 36c5762..d307474 100644 --- a/7.4.0/gentoo/01_all_default-fortify-source.patch +++ b/7.4.0/gentoo/01_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/7.4.0/gentoo/README.history b/7.4.0/gentoo/README.history index 14581f5..57a1e8f 100644 --- a/7.4.0/gentoo/README.history +++ b/7.4.0/gentoo/README.history @@ -1,4 +1,7 @@ -1.0 TODO +1.1 TODO + U 01_all_default-fortify-source.patch + +1.0 [not released, a copy of 8.2.0] + 01_all_default-fortify-source.patch + 02_all_default-warn-format-security.patch + 03_all_default-warn-trampolines.patch