1 |
commit: 0402657947045ebe81a9806e8dfdeaf69591e6a0 |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Dec 7 22:53:01 2018 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Dec 7 22:53:01 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=04026579 |
7 |
|
8 |
7.4.0: pull 10_all_default-fortify-source.patch from Debian, bug #621036 |
9 |
|
10 |
Reported-by: Martin Kletzander |
11 |
Bug: https://bugs.gentoo.org/621036 |
12 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
13 |
|
14 |
7.4.0/gentoo/01_all_default-fortify-source.patch | 17 ++++++++++++----- |
15 |
7.4.0/gentoo/README.history | 5 ++++- |
16 |
2 files changed, 16 insertions(+), 6 deletions(-) |
17 |
|
18 |
diff --git a/7.4.0/gentoo/01_all_default-fortify-source.patch b/7.4.0/gentoo/01_all_default-fortify-source.patch |
19 |
index 36c5762..d307474 100644 |
20 |
--- a/7.4.0/gentoo/01_all_default-fortify-source.patch |
21 |
+++ b/7.4.0/gentoo/01_all_default-fortify-source.patch |
22 |
@@ -1,14 +1,21 @@ |
23 |
-Enable -D_FORTIFY_SOURCE=2 by default. |
24 |
- |
25 |
+Taken Debian's patch and removed docs matches: |
26 |
+ https://salsa.debian.org/toolchain-team/gcc.git |
27 |
+Also see https://bugs.gentoo.org/621036 where |
28 |
+initially Gentoo used too complicated macro. |
29 |
|
30 |
+# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++, |
31 |
+# DP: if the optimization level is > 0 |
32 |
--- a/gcc/c-family/c-cppbuiltin.c |
33 |
+++ b/gcc/c-family/c-cppbuiltin.c |
34 |
-@@ -951,6 +951,9 @@ c_cpp_builtins (cpp_reader *pfile) |
35 |
+@@ -951,6 +951,12 @@ c_cpp_builtins (cpp_reader *pfile) |
36 |
builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0); |
37 |
builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0); |
38 |
|
39 |
-+ /* Fortify Source enabled by default w/optimization. */ |
40 |
-+ cpp_define (pfile, "_FORTIFY_SOURCE=((defined __OPTIMIZE__ && __OPTIMIZE__ > 0) ? 2 : 0)"); |
41 |
++#if !defined(ACCEL_COMPILER) |
42 |
++ /* Fortify Source enabled by default for optimization levels > 0 */ |
43 |
++ if (optimize) |
44 |
++ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2); |
45 |
++#endif |
46 |
+ |
47 |
/* Misc. */ |
48 |
if (flag_gnu89_inline) |
49 |
|
50 |
diff --git a/7.4.0/gentoo/README.history b/7.4.0/gentoo/README.history |
51 |
index 14581f5..57a1e8f 100644 |
52 |
--- a/7.4.0/gentoo/README.history |
53 |
+++ b/7.4.0/gentoo/README.history |
54 |
@@ -1,4 +1,7 @@ |
55 |
-1.0 TODO |
56 |
+1.1 TODO |
57 |
+ U 01_all_default-fortify-source.patch |
58 |
+ |
59 |
+1.0 [not released, a copy of 8.2.0] |
60 |
+ 01_all_default-fortify-source.patch |
61 |
+ 02_all_default-warn-format-security.patch |
62 |
+ 03_all_default-warn-trampolines.patch |