]> git.ipfire.org Git - people/pmueller/ipfire-3.x.git/blob - gcc/patches/10_all_gcc49_default-fortify-source.patch
gcc: Update to version 4.9.1
[people/pmueller/ipfire-3.x.git] / gcc / patches / 10_all_gcc49_default-fortify-source.patch
1 Enable -D_FORTIFY_SOURCE=2 by default.
2
3
4 --- a/gcc/c-family/c-cppbuiltin.c
5 +++ b/gcc/c-family/c-cppbuiltin.c
6 @@ -951,6 +951,9 @@ c_cpp_builtins (cpp_reader *pfile)
7 builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
8 builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
9
10 + /* Fortify Source enabled by default w/optimization. */
11 + cpp_define (pfile, "_FORTIFY_SOURCE=((defined __OPTIMIZE__ && __OPTIMIZE__ > 0) ? 2 : 0)");
12 +
13 /* Misc. */
14 if (flag_gnu89_inline)
15 cpp_define (pfile, "__GNUC_GNU_INLINE__");
16 --- a/gcc/doc/gcc.info
17 +++ b/gcc/doc/gcc.info
18 @@ -6255,6 +6255,11 @@ find out the exact set of optimizations that are enabled at each level.
19 Please note the warning under '-fgcse' about invoking '-O2' on
20 programs that use computed gotos.
21
22 + NOTE: In Gentoo, `-D_FORTIFY_SOURCE=2' is set by default, and is
23 + activated when `-O' is set to 2 or higher. This enables additional
24 + compile-time and run-time checks for several libc functions. To disable,
25 + specify either `-U_FORTIFY_SOURCE' or `-D_FORTIFY_SOURCE=0'.
26 +
27 '-O3'
28 Optimize yet more. '-O3' turns on all optimizations specified by
29 '-O2' and also turns on the '-finline-functions',