summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/patchsets/gcc/7.3.0/10_all_default-fortify-source.patch')
-rw-r--r--src/patchsets/gcc/7.3.0/10_all_default-fortify-source.patch15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/patchsets/gcc/7.3.0/10_all_default-fortify-source.patch b/src/patchsets/gcc/7.3.0/10_all_default-fortify-source.patch
new file mode 100644
index 0000000000..36c576211d
--- /dev/null
+++ b/src/patchsets/gcc/7.3.0/10_all_default-fortify-source.patch
@@ -0,0 +1,15 @@
+Enable -D_FORTIFY_SOURCE=2 by default.
+
+
+--- a/gcc/c-family/c-cppbuiltin.c
++++ b/gcc/c-family/c-cppbuiltin.c
+@@ -951,6 +951,9 @@ 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)");
++
+ /* Misc. */
+ if (flag_gnu89_inline)
+ cpp_define (pfile, "__GNUC_GNU_INLINE__");