wok-next annotate gcc/stuff/patches/003_all_default-fortify-source.patch @ rev 21159

updated diffutils (3.6 -> 3.7)
author Hans-G?nter Theisgen
date Wed Feb 20 08:46:59 2019 +0100 (2019-02-20)
parents
children
rev   line source
al@21060 1 # DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++,
al@21060 2 # DP: if the optimization level is > 0
al@21060 3
al@21060 4 ---
al@21060 5 gcc/doc/invoke.texi | 6 ++++++
al@21060 6 gcc/c-family/c-cppbuiltin.c | 3 +
al@21060 7 2 files changed, 9 insertions(+), 0 deletions(-)
al@21060 8
al@21060 9 Index: b/gcc/doc/invoke.texi
al@21060 10 ===================================================================
al@21060 11 --- a/gcc/doc/invoke.texi
al@21060 12 +++ b/gcc/doc/invoke.texi
al@21060 13 @@ -7840,6 +7840,12 @@ also turns on the following optimization
al@21060 14 Please note the warning under @option{-fgcse} about
al@21060 15 invoking @option{-O2} on programs that use computed gotos.
al@21060 16
al@21060 17 +NOTE: In Alpine Linux, @option{-D_FORTIFY_SOURCE=2} is
al@21060 18 +set by default, and is activated when @option{-O} is set to 2 or higher.
al@21060 19 +This enables additional compile-time and run-time checks for several libc
al@21060 20 +functions. To disable, specify either @option{-U_FORTIFY_SOURCE} or
al@21060 21 +@option{-D_FORTIFY_SOURCE=0}.
al@21060 22 +
al@21060 23 @item -O3
al@21060 24 @opindex O3
al@21060 25 Optimize yet more. @option{-O3} turns on all optimizations specified
al@21060 26 Index: b/gcc/c-family/c-cppbuiltin.c
al@21060 27 ===================================================================
al@21060 28 --- a/gcc/c-family/c-cppbuiltin.c
al@21060 29 +++ b/gcc/c-family/c-cppbuiltin.c
al@21060 30 @@ -1176,6 +1176,10 @@ c_cpp_builtins (cpp_reader *pfile)
al@21060 31 builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
al@21060 32 builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
al@21060 33
al@21060 34 + /* Fortify Source enabled by default for optimization levels > 0 */
al@21060 35 + if (optimize)
al@21060 36 + builtin_define_with_int_value ("_FORTIFY_SOURCE", 2);
al@21060 37 +
al@21060 38 /* Misc. */
al@21060 39 if (flag_gnu89_inline)
al@21060 40 cpp_define (pfile, "__GNUC_GNU_INLINE__");