aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-01-30 01:17:33 +0000
committerSam James <sam@gentoo.org>2023-01-30 01:17:33 +0000
commit34cb2fd271320c1ba9699d146e98c7fdfac541bb (patch)
treef29bc3ab0bc5afafd2beb9d1e3f3ad421104ec60
parent12.2.0: delete old stale nocross patch (diff)
downloadgcc-patches-34cb2fd2.tar.gz
gcc-patches-34cb2fd2.tar.bz2
gcc-patches-34cb2fd2.zip
13.1.0: update for default hardening as in 12.x
See: 224f6241ec785ccc386eb191df36d919e9b62351 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--13.1.0/gentoo/01_all_default-fortify-source.patch8
-rw-r--r--13.1.0/gentoo/15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch14
-rw-r--r--13.1.0/gentoo/README.history4
3 files changed, 24 insertions, 2 deletions
diff --git a/13.1.0/gentoo/01_all_default-fortify-source.patch b/13.1.0/gentoo/01_all_default-fortify-source.patch
index d9f001a..79d6639 100644
--- a/13.1.0/gentoo/01_all_default-fortify-source.patch
+++ b/13.1.0/gentoo/01_all_default-fortify-source.patch
@@ -7,14 +7,18 @@ initially Gentoo used too complicated macro.
# DP: if the optimization level is > 0
--- a/gcc/c-family/c-cppbuiltin.cc
+++ b/gcc/c-family/c-cppbuiltin.cc
-@@ -1510,6 +1510,12 @@ c_cpp_builtins (cpp_reader *pfile)
+@@ -1510,6 +1510,16 @@ 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);
+#if !defined(ACCEL_COMPILER)
++ #ifndef GENTOO_FORTIFY_SOURCE_LEVEL
++ #define GENTOO_FORTIFY_SOURCE_LEVEL 2
++ #endif
++
+ /* Fortify Source enabled by default for optimization levels > 0 */
+ if (optimize)
-+ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2);
++ builtin_define_with_int_value ("_FORTIFY_SOURCE", GENTOO_FORTIFY_SOURCE_LEVEL);
+#endif
+
/* Misc. */
diff --git a/13.1.0/gentoo/15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch b/13.1.0/gentoo/15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch
new file mode 100644
index 0000000..2daf73b
--- /dev/null
+++ b/13.1.0/gentoo/15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch
@@ -0,0 +1,14 @@
+https://bugs.gentoo.org/876895
+--- a/gcc/c-family/c-cppbuiltin.cc
++++ b/gcc/c-family/c-cppbuiltin.cc
+@@ -957,6 +957,10 @@ c_cpp_builtins (cpp_reader *pfile)
+ cpp_define (pfile, "__cpp_rtti=199711L");
+ }
+
++ #ifdef DEF_GENTOO_GLIBCXX_ASSERTIONS
++ cpp_define (pfile, "_GLIBCXX_ASSERTIONS");
++ #endif
++
+ if (cxx_dialect >= cxx11)
+ cpp_define (pfile, "__GXX_EXPERIMENTAL_CXX0X__");
+
diff --git a/13.1.0/gentoo/README.history b/13.1.0/gentoo/README.history
index 43b714e..1564ee1 100644
--- a/13.1.0/gentoo/README.history
+++ b/13.1.0/gentoo/README.history
@@ -1,3 +1,7 @@
+6 30 Jan 2023
+ U 01_all_default-fortify-source.patch
+ + 15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch
+
5 17 Dec 2022
U 30_all_tar_libstdc++-link.patch