public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gcc-patches:master commit in: 10.5.0/gentoo/
@ 2022-08-22  1:52 Sam James
  0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2022-08-22  1:52 UTC (permalink / raw
  To: gentoo-commits

commit:     3c8b78411dd61a11f6c45d2d3972d5965c440b3b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 22 01:51:59 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 22 01:52:35 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=3c8b7841

10.5.0: clone of 10.4.0 modulo glibc-2.36 patch

Signed-off-by: Sam James <sam <AT> gentoo.org>

 10.5.0/gentoo/01_all_default-fortify-source.patch  |  22 ++++
 .../02_all_default-warn-format-security.patch      |  22 ++++
 .../gentoo/03_all_default-warn-trampolines.patch   |  13 ++
 10.5.0/gentoo/04_all_nossp-on-nostdlib.patch       |  27 ++++
 10.5.0/gentoo/05_all_alpha-mieee-default.patch     |  39 ++++++
 10.5.0/gentoo/06_all_ia64_note.GNU-stack.patch     |  92 +++++++++++++
 .../gentoo/07_all_i386_libgcc_note.GNU-stack.patch |  54 ++++++++
 10.5.0/gentoo/08_all_libiberty-asprintf.patch      |  18 +++
 10.5.0/gentoo/09_all_libiberty-pic.patch           |  10 ++
 10.5.0/gentoo/10_all_nopie-all-flags.patch         |  18 +++
 10.5.0/gentoo/11_all_sh-drop-sysroot-suffix.patch  |  32 +++++
 10.5.0/gentoo/12_all_ia64-TEXTREL.patch            |  22 ++++
 .../gentoo/13_all_disable-systemtap-switch.patch   | 122 ++++++++++++++++++
 10.5.0/gentoo/14_all_m68k-textrel-on-libgcc.patch  |  93 ++++++++++++++
 10.5.0/gentoo/15_all_respect-build-cxxflags.patch  |  39 ++++++
 10.5.0/gentoo/16_all_libgfortran-Werror.patch      |  28 ++++
 10.5.0/gentoo/17_all_libgomp-Werror.patch          |  26 ++++
 10.5.0/gentoo/18_all_libitm-Werror.patch           |  25 ++++
 10.5.0/gentoo/19_all_libatomic-Werror.patch        |  25 ++++
 10.5.0/gentoo/20_all_libbacktrace-Werror.patch     |  17 +++
 10.5.0/gentoo/21_all_libsanitizer-Werror.patch     |  17 +++
 10.5.0/gentoo/22_all_libstdcxx-no-vtv.patch        |  79 ++++++++++++
 10.5.0/gentoo/23_all_disable-riscv32-ABIs.patch    |  53 ++++++++
 10.5.0/gentoo/24_all_default_ssp-buffer-size.patch |  14 ++
 10.5.0/gentoo/25_all_hppa-faster-synth_mult.patch  |  44 +++++++
 10.5.0/gentoo/26_all_libcpp-ar.patch               | 143 +++++++++++++++++++++
 10.5.0/gentoo/27_all_EXTRA_OPTIONS-z-now.patch     |  26 ++++
 ...all_EXTRA_OPTIONS-fstack-clash-protection.patch |  65 ++++++++++
 .../29_all_lto-intl-workaround-PR95194.patch       |  20 +++
 10.5.0/gentoo/30_all_plugin-objdump.patch          |  34 +++++
 10.5.0/gentoo/31_all_fno-delayed-branch.patch      |  40 ++++++
 10.5.0/gentoo/32_all_vtv-slibtool.patch            |  62 +++++++++
 10.5.0/gentoo/33_all_msgfmt-libstdc++-link.patch   |  39 ++++++
 .../gentoo/75_all_d_compiler_for_build_pie.patch   |  63 +++++++++
 10.5.0/gentoo/README.history                       |  35 +++++
 35 files changed, 1478 insertions(+)

diff --git a/10.5.0/gentoo/01_all_default-fortify-source.patch b/10.5.0/gentoo/01_all_default-fortify-source.patch
new file mode 100644
index 0000000..d307474
--- /dev/null
+++ b/10.5.0/gentoo/01_all_default-fortify-source.patch
@@ -0,0 +1,22 @@
+Taken Debian's patch and removed docs matches:
+    https://salsa.debian.org/toolchain-team/gcc.git
+Also see https://bugs.gentoo.org/621036 where
+initially Gentoo used too complicated macro.
+
+# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++,
+# DP: if the optimization level is > 0
+--- a/gcc/c-family/c-cppbuiltin.c
++++ b/gcc/c-family/c-cppbuiltin.c
+@@ -951,6 +951,12 @@ 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)
++  /* Fortify Source enabled by default for optimization levels > 0 */
++  if (optimize)
++    builtin_define_with_int_value ("_FORTIFY_SOURCE", 2);
++#endif
++
+   /* Misc.  */
+   if (flag_gnu89_inline)
+     cpp_define (pfile, "__GNUC_GNU_INLINE__");

diff --git a/10.5.0/gentoo/02_all_default-warn-format-security.patch b/10.5.0/gentoo/02_all_default-warn-format-security.patch
new file mode 100644
index 0000000..36201dc
--- /dev/null
+++ b/10.5.0/gentoo/02_all_default-warn-format-security.patch
@@ -0,0 +1,22 @@
+Enable -Wformat and -Wformat-security by default.
+
+--- a/gcc/c-family/c.opt
++++ b/gcc/c-family/c.opt
+@@ -599,7 +599,7 @@
+ of the destination region.  Same as -Wformat-overflow=1.
+ 
+ Wformat-security
+-C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
++C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
+ Warn about possible security problems with format functions.
+ 
+ Wformat-signedness
+@@ -620,7 +620,7 @@
+ Warn about zero-length formats.
+ 
+ Wformat=
+-C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2)
++C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2)
+ Warn about printf/scanf/strftime/strfmon format string anomalies.
+ 
+ Wformat-overflow=

diff --git a/10.5.0/gentoo/03_all_default-warn-trampolines.patch b/10.5.0/gentoo/03_all_default-warn-trampolines.patch
new file mode 100644
index 0000000..7a644cb
--- /dev/null
+++ b/10.5.0/gentoo/03_all_default-warn-trampolines.patch
@@ -0,0 +1,13 @@
+Enable -Wtrampolines by default.
+
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -712,7 +712,7 @@ Common Var(warn_system_headers) Warning
+ Do not suppress warnings from system headers.
+ 
+ Wtrampolines
+-Common Var(warn_trampolines) Warning
++Common Var(warn_trampolines) Init(1) Warning
+ Warn whenever a trampoline is generated.
+ 
+ Wtype-limits

diff --git a/10.5.0/gentoo/04_all_nossp-on-nostdlib.patch b/10.5.0/gentoo/04_all_nossp-on-nostdlib.patch
new file mode 100644
index 0000000..6d9f00a
--- /dev/null
+++ b/10.5.0/gentoo/04_all_nossp-on-nostdlib.patch
@@ -0,0 +1,27 @@
+Disable ssp on -nostdlib, -nodefaultlibs and -ffreestanding 
+
+https://bugs.gentoo.org/484714
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -874,6 +874,12 @@
+ #define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}"
+ #endif
+ 
++#ifdef ENABLE_DEFAULT_SSP
++#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} "
++#else
++#define NO_SSP_SPEC ""
++#endif
++
+ #ifndef LINK_SSP_SPEC
+ #ifdef TARGET_LIBC_PROVIDES_SSP
+ #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+@@ -1155,7 +1161,7 @@
+  %{-version:--version}\
+  %{-help=*:--help=%*}\
+  %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
+- %{fsyntax-only:-o %j} %{-param*}\
++ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\
+  %{coverage:-fprofile-arcs -ftest-coverage}\
+  %{fprofile-arcs|fprofile-generate*|coverage:\
+    %{!fprofile-update=single:\

diff --git a/10.5.0/gentoo/05_all_alpha-mieee-default.patch b/10.5.0/gentoo/05_all_alpha-mieee-default.patch
new file mode 100644
index 0000000..b266d77
--- /dev/null
+++ b/10.5.0/gentoo/05_all_alpha-mieee-default.patch
@@ -0,0 +1,39 @@
+Set the default behavior on alpha to use -mieee since the large majority of
+time we want this (bad/weird things can happen with packages built without
+it).
+
+To satisfy those people who may not want -mieee forced on them all the time,
+we also provide -mno-ieee.
+
+Patch by Mike Frysinger <vapier@gentoo.org>
+
+Note: upstream doesn't want to take this due to long standing behavior, and
+because it'd make behavior across OS's inconsistent:
+	https://gcc.gnu.org/ml/gcc-patches/2003-07/msg02144.html
+
+This makes sense for upstream, but Gentoo is more concerned about packages
+behaving the same across arches under Linux.
+
+--- a/gcc/config/alpha/alpha.h
++++ b/gcc/config/alpha/alpha.h
+@@ -96,6 +96,8 @@ along with GCC; see the file COPYING3.  If not see
+   while (0)
+ #endif
+ 
++#define CPP_SPEC "%{!no-ieee:-mieee}"
++
+ /* Run-time compilation parameters selecting different hardware subsets.  */
+ 
+ /* Which processor to schedule for. The cpu attribute defines a list that
+--- a/gcc/config/alpha/alpha.opt
++++ b/gcc/config/alpha/alpha.opt
+@@ -35,7 +35,7 @@
+ Request IEEE-conformant math library routines (OSF/1).
+ 
+ mieee
+-Target Report RejectNegative Mask(IEEE)
++Target Report Mask(IEEE)
+ Emit IEEE-conformant code, without inexact exceptions.
+ 
+ mieee-with-inexact
+

diff --git a/10.5.0/gentoo/06_all_ia64_note.GNU-stack.patch b/10.5.0/gentoo/06_all_ia64_note.GNU-stack.patch
new file mode 100644
index 0000000..66a787e
--- /dev/null
+++ b/10.5.0/gentoo/06_all_ia64_note.GNU-stack.patch
@@ -0,0 +1,92 @@
+http://gcc.gnu.org/PR21098
+
+
+2004-09-20  Jakub Jelinek  <jakub@redhat.com>
+
+	* config/rs6000/ppc-asm.h: Add .note.GNU-stack section also
+	on ppc64-linux.
+
+	* config/ia64/lib1funcs.asm: Add .note.GNU-stack section on
+	ia64-linux.
+	* config/ia64/crtbegin.asm: Likewise.
+	* config/ia64/crtend.asm: Likewise.
+	* config/ia64/crti.asm: Likewise.
+	* config/ia64/crtn.asm: Likewise.
+
+2004-05-14  Jakub Jelinek  <jakub@redhat.com>
+
+	* config/ia64/linux.h (TARGET_ASM_FILE_END): Define.
+
+
+--- a/gcc/config/ia64/linux.h
++++ b/gcc/config/ia64/linux.h
+@@ -24,6 +24,8 @@ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+ <http://www.gnu.org/licenses/>.  */
+ 
++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
++
+ /* This is for -profile to use -lc_p instead of -lc.  */
+ #undef CC1_SPEC
+ #define CC1_SPEC "%{profile:-p} %{G*}"
+--- a/gcc/config/rs6000/ppc-asm.h
++++ b/gcc/config/rs6000/ppc-asm.h
+@@ -352,7 +352,7 @@ GLUE(.L,name): \
+ #endif
+ #endif
+ 
+-#if defined __linux__ && !defined __powerpc64__
++#if defined __linux__
+ 	.section .note.GNU-stack
+ 	.previous
+ #endif
+--- a/libgcc/config/ia64/crtbegin.S
++++ b/libgcc/config/ia64/crtbegin.S
+@@ -252,3 +252,7 @@ __do_jv_register_classes:
+ .weak __cxa_finalize
+ #endif
+ .weak _Jv_RegisterClasses
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+--- a/libgcc/config/ia64/crtend.S
++++ b/libgcc/config/ia64/crtend.S
+@@ -119,3 +119,6 @@ __do_global_ctors_aux:
+ 
+ 	br.ret.sptk.many rp
+ 	.endp __do_global_ctors_aux
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+--- a/libgcc/config/ia64/crti.S
++++ b/libgcc/config/ia64/crti.S
+@@ -49,5 +49,8 @@ _fini:
+ 	.save rp, r33
+ 	mov	r33 = b0
+ 	.body
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+ 
+ # end of crti.S
+--- a/libgcc/config/ia64/crtn.S
++++ b/libgcc/config/ia64/crtn.S
+@@ -39,5 +39,8 @@
+ 	.restore sp
+ 	mov	r12 = r35
+ 	br.ret.sptk.many b0
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+ 
+ # end of crtn.S
+--- a/libgcc/config/ia64/lib1funcs.S
++++ b/libgcc/config/ia64/lib1funcs.S
+@@ -793,3 +793,6 @@ __floattitf:
+ 	.endp __floattitf
+ #endif
+ #endif
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif

diff --git a/10.5.0/gentoo/07_all_i386_libgcc_note.GNU-stack.patch b/10.5.0/gentoo/07_all_i386_libgcc_note.GNU-stack.patch
new file mode 100644
index 0000000..7f74945
--- /dev/null
+++ b/10.5.0/gentoo/07_all_i386_libgcc_note.GNU-stack.patch
@@ -0,0 +1,54 @@
+--- a/libgcc/config/i386/resms64.h	2018-01-03 11:03:58.000000000 +0100
++++ b/libgcc/config/i386/resms64.h	2018-05-01 12:59:48.942833419 +0200
+@@ -57,3 +57,6 @@ MS2SYSV_STUB_END(resms64_17)
+ MS2SYSV_STUB_END(resms64_18)
+ 
+ #endif /* __x86_64__ */
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+--- a/libgcc/config/i386/resms64f.h	2018-01-03 11:03:58.000000000 +0100
++++ b/libgcc/config/i386/resms64f.h	2018-05-01 13:00:23.422832853 +0200
+@@ -55,3 +55,6 @@ MS2SYSV_STUB_END(resms64f_16)
+ MS2SYSV_STUB_END(resms64f_17)
+ 
+ #endif /* __x86_64__ */
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+--- a/libgcc/config/i386/resms64fx.h	2018-02-26 20:46:34.000000000 +0100
++++ b/libgcc/config/i386/resms64fx.h	2018-05-01 13:06:49.682826518 +0200
+@@ -62,3 +62,6 @@ MS2SYSV_STUB_END(resms64fx_16)
+ MS2SYSV_STUB_END(resms64fx_17)
+ 
+ #endif /* __x86_64__ */
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+--- a/libgcc/config/i386/resms64x.h	2018-02-26 20:46:34.000000000 +0100
++++ b/libgcc/config/i386/resms64x.h	2018-05-01 13:07:21.702825993 +0200
+@@ -63,3 +63,6 @@ MS2SYSV_STUB_END(resms64x_17)
+ MS2SYSV_STUB_END(resms64x_18)
+ 
+ #endif /* __x86_64__ */
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+--- a/libgcc/config/i386/savms64.h	2018-01-03 11:03:58.000000000 +0100
++++ b/libgcc/config/i386/savms64.h	2018-05-01 13:07:48.952825546 +0200
+@@ -57,3 +57,6 @@ MS2SYSV_STUB_END(savms64_17)
+ MS2SYSV_STUB_END(savms64_18)
+ 
+ #endif /* __x86_64__ */
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+--- a/libgcc/config/i386/savms64f.h	2018-01-03 11:03:58.000000000 +0100
++++ b/libgcc/config/i386/savms64f.h	2018-05-01 13:08:30.082824871 +0200
+@@ -55,3 +55,6 @@ MS2SYSV_STUB_END(savms64f_16)
+ MS2SYSV_STUB_END(savms64f_17)
+ 
+ #endif /* __x86_64__ */
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif

diff --git a/10.5.0/gentoo/08_all_libiberty-asprintf.patch b/10.5.0/gentoo/08_all_libiberty-asprintf.patch
new file mode 100644
index 0000000..83ae56e
--- /dev/null
+++ b/10.5.0/gentoo/08_all_libiberty-asprintf.patch
@@ -0,0 +1,18 @@
+2008-07-25  Magnus Granberg  <zorry@ume.nu>
+
+	* include/libiberty.h (asprintf): Don't declare if defined as a macro
+
+--- a/include/libiberty.h
++++ b/include/libiberty.h
+@@ -645,8 +645,11 @@
+ /* Like sprintf but provides a pointer to malloc'd storage, which must
+    be freed by the caller.  */
+ 
++/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL.  */
++#ifndef asprintf
+ extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
+ #endif
++#endif
+ 
+ /* Like asprintf but allocates memory without fail. This works like
+    xmalloc.  */

diff --git a/10.5.0/gentoo/09_all_libiberty-pic.patch b/10.5.0/gentoo/09_all_libiberty-pic.patch
new file mode 100644
index 0000000..b6160a7
--- /dev/null
+++ b/10.5.0/gentoo/09_all_libiberty-pic.patch
@@ -0,0 +1,10 @@
+--- a/libiberty/Makefile.in
++++ b/libiberty/Makefile.in
+@@ -246,6 +246,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
+ 	  $(AR) $(AR_FLAGS) $(TARGETLIB) \
+ 	    $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
+ 	  $(RANLIB) $(TARGETLIB); \
++	  cp $(TARGETLIB) ../ ; \
+ 	  cd ..; \
+ 	else true; fi
+ 

diff --git a/10.5.0/gentoo/10_all_nopie-all-flags.patch b/10.5.0/gentoo/10_all_nopie-all-flags.patch
new file mode 100644
index 0000000..48536e6
--- /dev/null
+++ b/10.5.0/gentoo/10_all_nopie-all-flags.patch
@@ -0,0 +1,18 @@
+We need to pass NO_PIE_CFLAGS to ALL_* so gcc don't fail when
+we compile it with older gcc and pie.
+
+--- a/gcc/Makefile.in	2015-06-25 19:18:12.000000000 +0200
++++ b/gcc/Makefile.in	2016-04-22 00:12:54.029178860 +0200
+@@ -991,10 +991,10 @@ ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@)
+ ALL_CPPFLAGS = $(INCLUDES) $(CPPFLAGS)
+ 
+ # This is the variable to use when using $(COMPILER).
+-ALL_COMPILERFLAGS = $(ALL_CXXFLAGS)
++ALL_COMPILERFLAGS = $(NO_PIE_CFLAGS) $(ALL_CXXFLAGS)
+ 
+ # This is the variable to use when using $(LINKER).
+-ALL_LINKERFLAGS = $(ALL_CXXFLAGS)
++ALL_LINKERFLAGS = $(NO_PIE_CFLAGS) $(ALL_CXXFLAGS)
+ 
+ # Build and host support libraries.
+ 

diff --git a/10.5.0/gentoo/11_all_sh-drop-sysroot-suffix.patch b/10.5.0/gentoo/11_all_sh-drop-sysroot-suffix.patch
new file mode 100644
index 0000000..3dadd4c
--- /dev/null
+++ b/10.5.0/gentoo/11_all_sh-drop-sysroot-suffix.patch
@@ -0,0 +1,32 @@
+From 5eeeff19bb4978a8d3c0d53bc81744bc25d82993 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Sat, 14 Apr 2018 13:07:39 +0100
+Subject: [PATCH] gcc/config.gcc: sh-*: Disable sysroot-suffix (PR42947)
+
+sh-* is a multilib target. It is also one of 2 sysroot-prefix targets.
+Unfortunately two options do not mix well. Attempt to use default
+multilib flavour always prepends sysroot-prefix.
+
+Bug: https://bugs.gentoo.org/511548
+Bug: https://gcc.gnu.org/PR42947
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ gcc/config.gcc | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/gcc/config.gcc b/gcc/config.gcc
+index 55c314afdbd..c320f24f123 100644
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -2866,8 +2866,6 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
+ 	if test x${enable_incomplete_targets} = xyes ; then
+ 		tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1"
+ 	fi
+-	tm_file="$tm_file ./sysroot-suffix.h"
+-	tmake_file="$tmake_file t-sysroot-suffix"
+ 	;;
+ sh-*-rtems*)
+ 	tmake_file="${tmake_file} sh/t-sh sh/t-rtems"
+-- 
+2.17.0
+

diff --git a/10.5.0/gentoo/12_all_ia64-TEXTREL.patch b/10.5.0/gentoo/12_all_ia64-TEXTREL.patch
new file mode 100644
index 0000000..706dbe5
--- /dev/null
+++ b/10.5.0/gentoo/12_all_ia64-TEXTREL.patch
@@ -0,0 +1,22 @@
+Fix textrels on -rdynamic binaries:
+Bug: https://gcc.gnu.org/PR84553
+Bug: https://bugs.gentoo.org/566118
+--- a/gcc/config/ia64/ia64.c
++++ a/gcc/config/ia64/ia64.c
+@@ -10838,12 +10838,14 @@ ia64_hpux_reloc_rw_mask (void)
+ 
+ /* For others, relax this so that relocations to local data goes in
+    read-only segments, but we still cannot allow global relocations
+-   in read-only segments.  */
++   in read-only segments.  Except that use of -rdynamic at link time
++   may make any local data global, so we can't allow local data in
++   read-only segments either.  */
+ 
+ static int
+ ia64_reloc_rw_mask (void)
+ {
+-  return flag_pic ? 3 : 2;
++  return flag_pic ? 3 : 3;
+ }
+ 
+ /* Return the section to use for X.  The only special thing we do here

diff --git a/10.5.0/gentoo/13_all_disable-systemtap-switch.patch b/10.5.0/gentoo/13_all_disable-systemtap-switch.patch
new file mode 100644
index 0000000..d5ae8d0
--- /dev/null
+++ b/10.5.0/gentoo/13_all_disable-systemtap-switch.patch
@@ -0,0 +1,122 @@
+From bb510ed7ea82093c924b027489db6f92250a85b3 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Sat, 12 May 2018 12:56:46 +0100
+Subject: [PATCH] gcc/configure.ac: add --disable-systemtap switch
+
+Before the change systemtap probes were enabled
+if target headers had sys/sdt.h at ./configure time.
+
+After the change explicitly ask to enable or disable
+for probe support and not rely on automagic dependency
+discovery.
+
+Bug: https://bugs.gentoo.org/654748
+Bug: https://gcc.gnu.org/bugzilla/PR61257
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ gcc/configure    | 34 ++++++++++++++++++++++++++--------
+ gcc/configure.ac | 30 ++++++++++++++++++++++--------
+ 2 files changed, 48 insertions(+), 16 deletions(-)
+
+diff --git a/gcc/configure b/gcc/configure
+index 3dcf7752b..c2049f117 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -988,6 +988,7 @@ enable_gnu_unique_object
+ enable_linker_build_id
+ enable_libssp
+ enable_default_ssp
++enable_systemtap
+ with_long_double_128
+ with_long_double_format
+ with_gc
+@@ -1740,6 +1741,7 @@ Optional Features:
+                           compiler will always pass --build-id to linker
+   --enable-libssp         enable linking against libssp
+   --enable-default-ssp    enable Stack Smashing Protection as default
++  --disable-systemtap     enable systemtap static probe points [default=auto]
+   --enable-maintainer-mode
+                           enable make rules and dependencies not useful (and
+                           sometimes confusing) to the casual installer
+@@ -29330,17 +29332,33 @@ fi
+ 
+ # Test for <sys/sdt.h> on the target.
+ 
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
++
++# Check whether --enable-systemtap was given.
++if test "${enable_systemtap+set}" = set; then :
++  enableval=$enable_systemtap; enable_systemtap=$enableval
++else
++  enable_systemtap=auto
++fi
++
++
++if test x$enable_systemtap != xno; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
+ $as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
+-have_sys_sdt_h=no
+-if test -f $target_header_dir/sys/sdt.h; then
+-  have_sys_sdt_h=yes
++  have_sys_sdt_h=no
++  if test -f $target_header_dir/sys/sdt.h ; then
++    have_sys_sdt_h=yes
+ 
+ $as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
+ 
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
++  fi
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
+ $as_echo "$have_sys_sdt_h" >&6; }
++  if test x$enable_systemtap = xyes ; then
++    if test x$have_sys_sdt_h = xno ; then
++      as_fn_error $? "sys/sdt.h was not found" "$LINENO" 5
++    fi
++  fi
++fi
+ 
+ # Check if TFmode long double should be used by default or not.
+ # Some glibc targets used DFmode long double, but with glibc 2.4
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -6000,14 +6000,28 @@ AC_SUBST([enable_default_ssp])
+ 
+ # Test for <sys/sdt.h> on the target.
+ GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
+-AC_MSG_CHECKING(sys/sdt.h in the target C library)
+-have_sys_sdt_h=no
+-if test -f $target_header_dir/sys/sdt.h; then
+-  have_sys_sdt_h=yes
+-  AC_DEFINE(HAVE_SYS_SDT_H, 1,
+-            [Define if your target C library provides sys/sdt.h])
+-fi
+-AC_MSG_RESULT($have_sys_sdt_h)
++
++AC_ARG_ENABLE(systemtap,
++[AS_HELP_STRING([--disable-systemtap],
++  [enable systemtap static probe points [default=auto]])],
++      enable_systemtap=$enableval,
++      enable_systemtap=auto)
++
++if test x$enable_systemtap != xno; then
++  AC_MSG_CHECKING(sys/sdt.h in the target C library)
++  have_sys_sdt_h=no
++  if test -f $target_header_dir/sys/sdt.h ; then
++    have_sys_sdt_h=yes
++    AC_DEFINE(HAVE_SYS_SDT_H, 1,
++              [Define if your target C library provides sys/sdt.h])
++  fi
++  AC_MSG_RESULT($have_sys_sdt_h)
++  if test x$enable_systemtap = xyes ; then
++    if test x$have_sys_sdt_h = xno ; then
++      AC_MSG_ERROR([sys/sdt.h was not found])
++    fi
++  fi
++fi
+ 
+ # Check if TFmode long double should be used by default or not.
+ # Some glibc targets used DFmode long double, but with glibc 2.4
+-- 
+2.17.0
+

diff --git a/10.5.0/gentoo/14_all_m68k-textrel-on-libgcc.patch b/10.5.0/gentoo/14_all_m68k-textrel-on-libgcc.patch
new file mode 100644
index 0000000..a2aa100
--- /dev/null
+++ b/10.5.0/gentoo/14_all_m68k-textrel-on-libgcc.patch
@@ -0,0 +1,93 @@
+https://gcc.gnu.org/PR86224
+
+From 1d89df42bdaf0745fd2a0d294471ac16f0553707 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Sat, 28 Jul 2018 11:33:27 +0100
+Subject: [PATCH] libgcc: m68k: avoid absolute relocation in shared library
+
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ libgcc/config/m68k/lb1sf68.S | 19 ++++++++++++++-----
+ 1 file changed, 14 insertions(+), 5 deletions(-)
+
+diff --git a/libgcc/config/m68k/lb1sf68.S b/libgcc/config/m68k/lb1sf68.S
+index 325a7c17d9b..16c6dc3f5a7 100644
+--- a/libgcc/config/m68k/lb1sf68.S
++++ b/libgcc/config/m68k/lb1sf68.S
+@@ -435,7 +435,10 @@ $_exception_handler:
+ 	.text
+ 	FUNC(__mulsi3)
+ 	.globl	SYM (__mulsi3)
++	.globl	SYM (__mulsi3_internal)
++	.hidden	SYM (__mulsi3_internal)
+ SYM (__mulsi3):
++SYM (__mulsi3_internal):
+ 	movew	sp@(4), d0	/* x0 -> d0 */
+ 	muluw	sp@(10), d0	/* x0*y1 */
+ 	movew	sp@(6), d1	/* x1 -> d1 */
+@@ -458,7 +461,10 @@ SYM (__mulsi3):
+ 	.text
+ 	FUNC(__udivsi3)
+ 	.globl	SYM (__udivsi3)
++	.globl	SYM (__udivsi3_internal)
++	.hidden	SYM (__udivsi3_internal)
+ SYM (__udivsi3):
++SYM (__udivsi3_internal):
+ #ifndef __mcoldfire__
+ 	movel	d2, sp@-
+ 	movel	sp@(12), d1	/* d1 = divisor */
+@@ -534,7 +540,10 @@ L2:	subql	IMM (1),d4
+ 	.text
+ 	FUNC(__divsi3)
+ 	.globl	SYM (__divsi3)
++	.globl	SYM (__divsi3_internal)
++	.hidden	SYM (__divsi3_internal)
+ SYM (__divsi3):
++SYM (__divsi3_internal):
+ 	movel	d2, sp@-
+ 
+ 	moveq	IMM (1), d2	/* sign of result stored in d2 (=1 or =-1) */
+@@ -557,7 +566,7 @@ L1:	movel	sp@(8), d0	/* d0 = dividend */
+ 
+ L2:	movel	d1, sp@-
+ 	movel	d0, sp@-
+-	PICCALL	SYM (__udivsi3)	/* divide abs(dividend) by abs(divisor) */
++	PICCALL	SYM (__udivsi3_internal)	/* divide abs(dividend) by abs(divisor) */
+ 	addql	IMM (8), sp
+ 
+ 	tstb	d2
+@@ -577,13 +586,13 @@ SYM (__umodsi3):
+ 	movel	sp@(4), d0	/* d0 = dividend */
+ 	movel	d1, sp@-
+ 	movel	d0, sp@-
+-	PICCALL	SYM (__udivsi3)
++	PICCALL	SYM (__udivsi3_internal)
+ 	addql	IMM (8), sp
+ 	movel	sp@(8), d1	/* d1 = divisor */
+ #ifndef __mcoldfire__
+ 	movel	d1, sp@-
+ 	movel	d0, sp@-
+-	PICCALL	SYM (__mulsi3)	/* d0 = (a/b)*b */
++	PICCALL	SYM (__mulsi3_internal)	/* d0 = (a/b)*b */
+ 	addql	IMM (8), sp
+ #else
+ 	mulsl	d1,d0
+@@ -603,13 +612,13 @@ SYM (__modsi3):
+ 	movel	sp@(4), d0	/* d0 = dividend */
+ 	movel	d1, sp@-
+ 	movel	d0, sp@-
+-	PICCALL	SYM (__divsi3)
++	PICCALL	SYM (__divsi3_internal)
+ 	addql	IMM (8), sp
+ 	movel	sp@(8), d1	/* d1 = divisor */
+ #ifndef __mcoldfire__
+ 	movel	d1, sp@-
+ 	movel	d0, sp@-
+-	PICCALL	SYM (__mulsi3)	/* d0 = (a/b)*b */
++	PICCALL	SYM (__mulsi3_internal)	/* d0 = (a/b)*b */
+ 	addql	IMM (8), sp
+ #else
+ 	mulsl	d1,d0
+-- 
+2.18.0
+

diff --git a/10.5.0/gentoo/15_all_respect-build-cxxflags.patch b/10.5.0/gentoo/15_all_respect-build-cxxflags.patch
new file mode 100644
index 0000000..14139ea
--- /dev/null
+++ b/10.5.0/gentoo/15_all_respect-build-cxxflags.patch
@@ -0,0 +1,39 @@
+Pass CXXFLAGS as CXXFLAGS_FOR_BUILD to stage1.
+
+Fixes build failure when CXXFLAGS contains
+TARGET-specific flags.
+
+Tested on x86_64-pc-linux-gnu host as:
+    # CFLAGS='-O2 -mfpu=neon-vfpv4' CXXFLAGS='-O2 -mfpu=neon-vfpv4' \
+        armv7a-unknown-linux-gnueabihf-emerge -v1 sys-devel/gcc --quiet-build=n
+
+Fix by Peter Levine.
+https://bugs.gentoo.org/581406
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -170,6 +170,7 @@
+ # built for the build system to override those in BASE_FLAGS_TO_PASS.
+ EXTRA_BUILD_FLAGS = \
+ 	CFLAGS="$(CFLAGS_FOR_BUILD)" \
++	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
+ 	LDFLAGS="$(LDFLAGS_FOR_BUILD)"
+ 
+ # This is the list of directories to built for the host system.
+@@ -710,6 +711,7 @@
+ 	"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
+ 	"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
+ 	"CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
++	"CXXFLAGS_FOR_BUILD=$(CXXFLAGS_FOR_BUILD)" \
+ 	"EXPECT=$(EXPECT)" \
+ 	"FLEX=$(FLEX)" \
+ 	"INSTALL=$(INSTALL)" \
+--- a/Makefile.tpl
++++ b/Makefile.tpl
+@@ -172,6 +172,7 @@
+ # built for the build system to override those in BASE_FLAGS_TO_PASS.
+ EXTRA_BUILD_FLAGS = \
+ 	CFLAGS="$(CFLAGS_FOR_BUILD)" \
++	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
+ 	LDFLAGS="$(LDFLAGS_FOR_BUILD)"
+ 
+ # This is the list of directories to built for the host system.

diff --git a/10.5.0/gentoo/16_all_libgfortran-Werror.patch b/10.5.0/gentoo/16_all_libgfortran-Werror.patch
new file mode 100644
index 0000000..1501057
--- /dev/null
+++ b/10.5.0/gentoo/16_all_libgfortran-Werror.patch
@@ -0,0 +1,28 @@
+libgfortran does not respect --disable-werror
+
+https://bugs.gentoo.org/433435
+http://gcc.gnu.org/PR54724
+
+
+--- a/libgfortran/configure.ac
++++ b/libgfortran/configure.ac
+@@ -146,7 +146,7 @@
+ 
+ # Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC.
+ if test "x$GCC" = "xyes"; then
+-  AM_FCFLAGS="-I . -Wall -Werror -fimplicit-none -fno-repack-arrays -fno-underscoring"
++  AM_FCFLAGS="-I . -Wall -fimplicit-none -fno-repack-arrays -fno-underscoring"
+   ## We like to use C11 and C99 routines when available.  This makes
+   ## sure that
+   ## __STDC_VERSION__ is set such that libc includes make them available.
+--- a/libgfortran/configure
++++ b/libgfortran/configure
+@@ -5981,7 +5981,7 @@
+ 
+ # Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC.
+ if test "x$GCC" = "xyes"; then
+-  AM_FCFLAGS="-I . -Wall -Werror -fimplicit-none -fno-repack-arrays -fno-underscoring"
++  AM_FCFLAGS="-I . -Wall -fimplicit-none -fno-repack-arrays -fno-underscoring"
+   ## We like to use C11 and C99 routines when available.  This makes
+   ## sure that
+   ## __STDC_VERSION__ is set such that libc includes make them available.

diff --git a/10.5.0/gentoo/17_all_libgomp-Werror.patch b/10.5.0/gentoo/17_all_libgomp-Werror.patch
new file mode 100644
index 0000000..ffcb076
--- /dev/null
+++ b/10.5.0/gentoo/17_all_libgomp-Werror.patch
@@ -0,0 +1,26 @@
+libgomp does not respect --disable-werror
+
+https://bugs.gentoo.org/229059
+http://gcc.gnu.org/PR38436
+--- a/libgomp/configure.ac
++++ b/libgomp/configure.ac
+@@ -123,7 +123,7 @@
+ 
+ # Add -Wall -Werror if we are using GCC.
+ if test "x$GCC" = "xyes"; then
+-  XCFLAGS="$XCFLAGS -Wall -Werror"
++  XCFLAGS="$XCFLAGS -Wall"
+ fi
+ 
+ # Find other programs we need.
+--- a/libgomp/configure
++++ b/libgomp/configure
+@@ -4616,7 +4616,7 @@
+ 
+ # Add -Wall -Werror if we are using GCC.
+ if test "x$GCC" = "xyes"; then
+-  XCFLAGS="$XCFLAGS -Wall -Werror"
++  XCFLAGS="$XCFLAGS -Wall"
+ fi
+ 
+ # Find other programs we need.

diff --git a/10.5.0/gentoo/18_all_libitm-Werror.patch b/10.5.0/gentoo/18_all_libitm-Werror.patch
new file mode 100644
index 0000000..c2b9164
--- /dev/null
+++ b/10.5.0/gentoo/18_all_libitm-Werror.patch
@@ -0,0 +1,25 @@
+libitm does not respect --disable-werror
+
+https://bugs.gentoo.org/475350
+--- a/libitm/configure.ac
++++ b/libitm/configure.ac
+@@ -263,7 +263,7 @@
+ 
+ # Add -Wall -Werror if we are using GCC.
+ if test "x$GCC" = "xyes"; then
+-  XCFLAGS="$XCFLAGS -Wall -Werror"
++  XCFLAGS="$XCFLAGS -Wall"
+ fi
+ 
+ XCFLAGS="$XCFLAGS $XPCFLAGS"
+--- a/libitm/configure
++++ b/libitm/configure
+@@ -17864,7 +17864,7 @@
+ 
+ # Add -Wall -Werror if we are using GCC.
+ if test "x$GCC" = "xyes"; then
+-  XCFLAGS="$XCFLAGS -Wall -Werror"
++  XCFLAGS="$XCFLAGS -Wall"
+ fi
+ 
+ XCFLAGS="$XCFLAGS $XPCFLAGS"

diff --git a/10.5.0/gentoo/19_all_libatomic-Werror.patch b/10.5.0/gentoo/19_all_libatomic-Werror.patch
new file mode 100644
index 0000000..c39ca37
--- /dev/null
+++ b/10.5.0/gentoo/19_all_libatomic-Werror.patch
@@ -0,0 +1,25 @@
+libatomic does not respect --disable-werror
+
+https://bugs.gentoo.org/475350
+--- a/libatomic/configure.ac
++++ b/libatomic/configure.ac
+@@ -253,7 +253,7 @@
+ 
+ # Add -Wall -Werror if we are using GCC.
+ if test "x$GCC" = "xyes"; then
+-  XCFLAGS="$XCFLAGS -Wall -Werror"
++  XCFLAGS="$XCFLAGS -Wall"
+ fi
+ 
+ # Add CET specific flags if CET is enabled
+--- a/libatomic/configure
++++ b/libatomic/configure
+@@ -15571,7 +15571,7 @@
+ 
+ # Add -Wall -Werror if we are using GCC.
+ if test "x$GCC" = "xyes"; then
+-  XCFLAGS="$XCFLAGS -Wall -Werror"
++  XCFLAGS="$XCFLAGS -Wall"
+ fi
+ 
+ # Add CET specific flags if CET is enabled

diff --git a/10.5.0/gentoo/20_all_libbacktrace-Werror.patch b/10.5.0/gentoo/20_all_libbacktrace-Werror.patch
new file mode 100644
index 0000000..57dd284
--- /dev/null
+++ b/10.5.0/gentoo/20_all_libbacktrace-Werror.patch
@@ -0,0 +1,17 @@
+libbacktrace does not respect --disable-werror
+
+https://bugs.gentoo.org/667104
+--- a/libbacktrace/configure
++++ b/libbacktrace/configure
+@@ -11634,3 +11634,3 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ if test -n "${with_target_subdir}"; then
+-  WARN_FLAGS="$WARN_FLAGS -Werror"
++  WARN_FLAGS="$WARN_FLAGS"
+ fi
+--- a/libbacktrace/configure.ac
++++ b/libbacktrace/configure.ac
+@@ -138,3 +138,3 @@ ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
+ if test -n "${with_target_subdir}"; then
+-  WARN_FLAGS="$WARN_FLAGS -Werror"
++  WARN_FLAGS="$WARN_FLAGS"
+ fi

diff --git a/10.5.0/gentoo/21_all_libsanitizer-Werror.patch b/10.5.0/gentoo/21_all_libsanitizer-Werror.patch
new file mode 100644
index 0000000..0e484a4
--- /dev/null
+++ b/10.5.0/gentoo/21_all_libsanitizer-Werror.patch
@@ -0,0 +1,17 @@
+libsanitizer does not respect --disable-werror
+
+https://bugs.gentoo.org/667104
+--- a/libsanitizer/libbacktrace/Makefile.am
++++ b/libsanitizer/libbacktrace/Makefile.am
+@@ -37,3 +37,3 @@ AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
+ WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \
+-	     -Wcast-qual -Werror
++	     -Wcast-qual
+ C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
+--- a/libsanitizer/libbacktrace/Makefile.in
++++ b/libsanitizer/libbacktrace/Makefile.in
+@@ -297,3 +297,3 @@ AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
+ WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \
+-	     -Wcast-qual -Werror
++	     -Wcast-qual
+ 

diff --git a/10.5.0/gentoo/22_all_libstdcxx-no-vtv.patch b/10.5.0/gentoo/22_all_libstdcxx-no-vtv.patch
new file mode 100644
index 0000000..4526af1
--- /dev/null
+++ b/10.5.0/gentoo/22_all_libstdcxx-no-vtv.patch
@@ -0,0 +1,79 @@
+Final libstdc++.so should not contain rpath to make libvtv usable.
+It's up to final binaries to link against proper libvtv.
+
+Bug: https://bugs.gentoo.org/582524
+Bug: https://gcc.gnu.org/PR85884
+--- a/libstdc++-v3/src/Makefile.am
++++ b/libstdc++-v3/src/Makefile.am
+@@ -221,7 +221,6 @@ CXXLINK = \
+ 	$(LIBTOOL) --tag CXX \
+ 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ 	--mode=link $(CXX) \
+-	$(VTV_CXXLINKFLAGS) \
+ 	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) \
+ 	$(LTLDFLAGS) $(LTLIBICONV) \
+ 	-o $@
+--- a/libstdc++-v3/src/Makefile.in
++++ b/libstdc++-v3/src/Makefile.in
+@@ -596,7 +596,6 @@ CXXLINK = \
+ 	$(LIBTOOL) --tag CXX \
+ 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ 	--mode=link $(CXX) \
+-	$(VTV_CXXLINKFLAGS) \
+ 	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) \
+ 	$(LTLDFLAGS) $(LTLIBICONV) \
+ 	-o $@
+--- a/libstdc++-v3/src/c++11/Makefile.am
++++ b/libstdc++-v3/src/c++11/Makefile.am
+@@ -214,5 +214,4 @@ CXXLINK = \
+ 	$(LIBTOOL) --tag CXX --tag disable-shared \
+ 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ 	--mode=link $(CXX) \
+-	$(VTV_CXXLINKFLAGS) \
+ 	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
+--- a/libstdc++-v3/src/c++11/Makefile.in
++++ b/libstdc++-v3/src/c++11/Makefile.in
+@@ -575,7 +575,6 @@ CXXLINK = \
+ 	$(LIBTOOL) --tag CXX --tag disable-shared \
+ 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ 	--mode=link $(CXX) \
+-	$(VTV_CXXLINKFLAGS) \
+ 	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
+ 
+ all: all-am
+--- a/libstdc++-v3/src/c++17/Makefile.am
++++ b/libstdc++-v3/src/c++17/Makefile.am
+@@ -119,5 +119,4 @@ CXXLINK = \
+ 	$(LIBTOOL) --tag CXX --tag disable-shared \
+ 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ 	--mode=link $(CXX) \
+-	$(VTV_CXXLINKFLAGS) \
+ 	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
+--- a/libstdc++-v3/src/c++17/Makefile.in
++++ b/libstdc++-v3/src/c++17/Makefile.in
+@@ -502,7 +502,6 @@ CXXLINK = \
+ 	$(LIBTOOL) --tag CXX --tag disable-shared \
+ 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ 	--mode=link $(CXX) \
+-	$(VTV_CXXLINKFLAGS) \
+ 	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
+ 
+ all: all-am
+--- a/libstdc++-v3/src/c++98/Makefile.am
++++ b/libstdc++-v3/src/c++98/Makefile.am
+@@ -268,5 +268,4 @@ CXXLINK = \
+ 	$(LIBTOOL) --tag CXX --tag disable-shared \
+ 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ 	--mode=link $(CXX) \
+-	$(VTV_CXXLINKFLAGS) \
+ 	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
+--- a/libstdc++-v3/src/c++98/Makefile.in
++++ b/libstdc++-v3/src/c++98/Makefile.in
+@@ -577,7 +577,6 @@ CXXLINK = \
+ 	$(LIBTOOL) --tag CXX --tag disable-shared \
+ 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ 	--mode=link $(CXX) \
+-	$(VTV_CXXLINKFLAGS) \
+ 	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
+ 
+ all: all-am

diff --git a/10.5.0/gentoo/23_all_disable-riscv32-ABIs.patch b/10.5.0/gentoo/23_all_disable-riscv32-ABIs.patch
new file mode 100644
index 0000000..ad0128a
--- /dev/null
+++ b/10.5.0/gentoo/23_all_disable-riscv32-ABIs.patch
@@ -0,0 +1,53 @@
+Autogenerated patch disabling the 32bit RISCV support
+See https://gcc.gnu.org/PR90419
+
+diff -ruN gcc-9.1.0.orig/gcc/config/riscv/t-linux-multilib gcc-9.1.0/gcc/config/riscv/t-linux-multilib
+--- gcc-9.1.0.orig/gcc/config/riscv/t-linux-multilib	2017-02-06 22:38:37.000000000 +0100
++++ gcc-9.1.0/gcc/config/riscv/t-linux-multilib	2019-05-18 23:04:54.849400774 +0200
+@@ -1,40 +1,18 @@
+ # This file was generated by multilib-generator with the command:
+-#  ./multilib-generator rv32imac-ilp32-rv32ima,rv32imaf,rv32imafd,rv32imafc,rv32imafdc- rv32imafdc-ilp32d-rv32imafd- rv64imac-lp64-rv64ima,rv64imaf,rv64imafd,rv64imafc,rv64imafdc- rv64imafdc-lp64d-rv64imafd-
+-MULTILIB_OPTIONS = march=rv32imac/march=rv32ima/march=rv32imaf/march=rv32imafd/march=rv32imafc/march=rv32imafdc/march=rv32g/march=rv32gc/march=rv64imac/march=rv64ima/march=rv64imaf/march=rv64imafd/march=rv64imafc/march=rv64imafdc/march=rv64g/march=rv64gc mabi=ilp32/mabi=ilp32d/mabi=lp64/mabi=lp64d
+-MULTILIB_DIRNAMES = rv32imac \
+-rv32ima \
+-rv32imaf \
+-rv32imafd \
+-rv32imafc \
+-rv32imafdc \
+-rv32g \
+-rv32gc \
+-rv64imac \
++#  ./multilib-generator rv64imac-lp64-rv64ima,rv64imaf,rv64imafd,rv64imafc,rv64imafdc- rv64imafdc-lp64d-rv64imafd-
++MULTILIB_OPTIONS = march=rv64imac/march=rv64ima/march=rv64imaf/march=rv64imafd/march=rv64imafc/march=rv64imafdc/march=rv64g/march=rv64gc mabi=lp64/mabi=lp64d
++MULTILIB_DIRNAMES = rv64imac \
+ rv64ima \
+ rv64imaf \
+ rv64imafd \
+ rv64imafc \
+ rv64imafdc \
+ rv64g \
+-rv64gc ilp32 \
+-ilp32d \
+-lp64 \
++rv64gc lp64 \
+ lp64d
+-MULTILIB_REQUIRED = march=rv32imac/mabi=ilp32 \
+-march=rv32imafdc/mabi=ilp32d \
+-march=rv64imac/mabi=lp64 \
++MULTILIB_REQUIRED = march=rv64imac/mabi=lp64 \
+ march=rv64imafdc/mabi=lp64d
+-MULTILIB_REUSE = march.rv32imac/mabi.ilp32=march.rv32ima/mabi.ilp32 \
+-march.rv32imac/mabi.ilp32=march.rv32imaf/mabi.ilp32 \
+-march.rv32imac/mabi.ilp32=march.rv32imafd/mabi.ilp32 \
+-march.rv32imac/mabi.ilp32=march.rv32imafc/mabi.ilp32 \
+-march.rv32imac/mabi.ilp32=march.rv32imafdc/mabi.ilp32 \
+-march.rv32imac/mabi.ilp32=march.rv32g/mabi.ilp32 \
+-march.rv32imac/mabi.ilp32=march.rv32gc/mabi.ilp32 \
+-march.rv32imafdc/mabi.ilp32d=march.rv32imafd/mabi.ilp32d \
+-march.rv32imafdc/mabi.ilp32d=march.rv32gc/mabi.ilp32d \
+-march.rv32imafdc/mabi.ilp32d=march.rv32g/mabi.ilp32d \
+-march.rv64imac/mabi.lp64=march.rv64ima/mabi.lp64 \
++MULTILIB_REUSE = march.rv64imac/mabi.lp64=march.rv64ima/mabi.lp64 \
+ march.rv64imac/mabi.lp64=march.rv64imaf/mabi.lp64 \
+ march.rv64imac/mabi.lp64=march.rv64imafd/mabi.lp64 \
+ march.rv64imac/mabi.lp64=march.rv64imafc/mabi.lp64 \

diff --git a/10.5.0/gentoo/24_all_default_ssp-buffer-size.patch b/10.5.0/gentoo/24_all_default_ssp-buffer-size.patch
new file mode 100644
index 0000000..ae5a707
--- /dev/null
+++ b/10.5.0/gentoo/24_all_default_ssp-buffer-size.patch
@@ -0,0 +1,14 @@
+Change the minimal SSP buffer size.
+
+https://bugs.gentoo.org/484714
+--- a/gcc/params.opt
++++ b/gcc/params.opt
+@@ -849,7 +849,7 @@ Common Joined UInteger Var(param_ssa_name_def_chain_limit) Init(512) Param Optim
+ The maximum number of SSA_NAME assignments to follow in determining a value.
+ 
+ -param=ssp-buffer-size=
+-Common Joined UInteger Var(param_ssp_buffer_size) Init(8) IntegerRange(1, 65536) Param Optimization
++Common Joined UInteger Var(param_ssp_buffer_size) Init(4) IntegerRange(1, 65536) Param Optimization
+ The lower bound for a buffer to be considered for stack smashing protection.
+ 
+ -param=stack-clash-protection-guard-size=

diff --git a/10.5.0/gentoo/25_all_hppa-faster-synth_mult.patch b/10.5.0/gentoo/25_all_hppa-faster-synth_mult.patch
new file mode 100644
index 0000000..e93aa40
--- /dev/null
+++ b/10.5.0/gentoo/25_all_hppa-faster-synth_mult.patch
@@ -0,0 +1,44 @@
+From 73a841928cc1b86f43108d2383a6242e7e61a785 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Tue, 31 Mar 2020 23:58:05 +0100
+Subject: [PATCH] gcc/expmed.h: increase cache size from 10^3 to 10^6
+
+Without this patch is takes dev-libs/xxhash 1-2 hours
+to compile. With this patch - TODO measurements.
+
+It workarounds deficiency of synth_mult() which evics
+cache entries as it calculates optimal multiplication
+algorithm. xxhash is especially hevyweight as it's a
+64-bit multiplication of large prime constants.
+
+Bug: https://gcc.gnu.org/PR87256
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ gcc/expmed.h | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+--- a/gcc/expmed.h
++++ b/gcc/expmed.h
+@@ -127,11 +127,14 @@ struct alg_hash_entry {
+ };
+ 
+ /* The number of cache/hash entries.  */
+-#if HOST_BITS_PER_WIDE_INT == 64
+-#define NUM_ALG_HASH_ENTRIES 1031
+-#else
+-#define NUM_ALG_HASH_ENTRIES 307
+-#endif
++/*
++ * Workaround hppa2.0 synth_mult deficiency
++ * and allocate ~1 million slots:
++ *     https://gcc.gnu.org/PR87256
++ * That should increase RAM usage up to ~24MB
++ * per process.
++ */
++#define NUM_ALG_HASH_ENTRIES 1000003
+ 
+ #define NUM_MODE_INT \
+   (MAX_MODE_INT - MIN_MODE_INT + 1)
+-- 
+2.26.0
+

diff --git a/10.5.0/gentoo/26_all_libcpp-ar.patch b/10.5.0/gentoo/26_all_libcpp-ar.patch
new file mode 100644
index 0000000..55f2944
--- /dev/null
+++ b/10.5.0/gentoo/26_all_libcpp-ar.patch
@@ -0,0 +1,143 @@
+https://bugs.gentoo.org/718004
+https://gcc.gnu.org/PR94657
+
+Make sue we use ${CHOST}-ar and not 'ar'.
+
+--- a/libcpp/configure.ac
++++ b/libcpp/configure.ac
+@@ -12,6 +12,7 @@ AC_PROG_INSTALL
+ AC_PROG_CC
+ AC_PROG_CXX
+ AC_PROG_RANLIB
++AC_CHECK_TOOL(AR, ar)
+ 
+ AC_USE_SYSTEM_EXTENSIONS
+ AC_SYS_LARGEFILE
+--- a/libcpp/Makefile.in
++++ b/libcpp/Makefile.in
+@@ -25,7 +25,7 @@ srcdir = @srcdir@
+ top_builddir = .
+ VPATH = @srcdir@
+ INSTALL = @INSTALL@
+-AR = ar
++AR = @AR@
+ ARFLAGS = cru
+ ACLOCAL = @ACLOCAL@
+ AUTOCONF = @AUTOCONF@
+--- a/libcpp/configure
++++ b/libcpp/configure
+@@ -657,6 +657,7 @@ ACLOCAL
+ EGREP
+ GREP
+ CPP
++AR
+ RANLIB
+ ac_ct_CXX
+ CXXFLAGS
+@@ -1038,6 +1039,7 @@ do
+   | -silent | --silent | --silen | --sile | --sil)
+     silent=yes ;;
+ 
++
+   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+     ac_prev=sbindir ;;
+   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+@@ -4006,6 +4008,98 @@ else
+   RANLIB="$ac_cv_prog_RANLIB"
+ fi
+ 
++if test -n "$ac_tool_prefix"; then
++  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
++set dummy ${ac_tool_prefix}ar; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_AR+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  if test -n "$AR"; then
++  ac_cv_prog_AR="$AR" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_prog_AR="${ac_tool_prefix}ar"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++fi
++fi
++AR=$ac_cv_prog_AR
++if test -n "$AR"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
++$as_echo "$AR" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_AR"; then
++  ac_ct_AR=$AR
++  # Extract the first word of "ar", so it can be a program name with args.
++set dummy ar; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_AR+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  if test -n "$ac_ct_AR"; then
++  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_prog_ac_ct_AR="ar"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++fi
++fi
++ac_ct_AR=$ac_cv_prog_ac_ct_AR
++if test -n "$ac_ct_AR"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
++$as_echo "$ac_ct_AR" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++  if test "x$ac_ct_AR" = x; then
++    AR=""
++  else
++    case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++    AR=$ac_ct_AR
++  fi
++else
++  AR="$ac_cv_prog_AR"
++fi
++
+ 
+ 
+ ac_ext=c

diff --git a/10.5.0/gentoo/27_all_EXTRA_OPTIONS-z-now.patch b/10.5.0/gentoo/27_all_EXTRA_OPTIONS-z-now.patch
new file mode 100644
index 0000000..93d31f2
--- /dev/null
+++ b/10.5.0/gentoo/27_all_EXTRA_OPTIONS-z-now.patch
@@ -0,0 +1,26 @@
+On Hardened we add some options like -z now
+
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -891,6 +891,12 @@
+ #endif
+ #endif
+ 
++#ifdef EXTRA_OPTIONS
++#define LINK_NOW_SPEC "%{!nonow:-z now} "
++#else
++#define LINK_NOW_SPEC ""
++#endif
++
+ #ifdef ENABLE_DEFAULT_PIE
+ #define PIE_SPEC		"!no-pie"
+ #define NO_FPIE1_SPEC		"fno-pie"
+@@ -1043,7 +1049,7 @@
+     %(linker) " \
+     LINK_PLUGIN_SPEC \
+    "%{flto|flto=*:%<fcompare-debug*} \
+-    %{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
++    %{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC LINK_NOW_SPEC \
+    "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
+    "%X %{o*} %{e*} %{N} %{n} %{r}\
+     %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \

diff --git a/10.5.0/gentoo/28_all_EXTRA_OPTIONS-fstack-clash-protection.patch b/10.5.0/gentoo/28_all_EXTRA_OPTIONS-fstack-clash-protection.patch
new file mode 100644
index 0000000..d1bb202
--- /dev/null
+++ b/10.5.0/gentoo/28_all_EXTRA_OPTIONS-fstack-clash-protection.patch
@@ -0,0 +1,65 @@
+On Hardened we add some options like -fstack-clash-protection.
+
+--- a/gcc/common.opt	2018-03-28 16:51:09.000000000 +0200
++++ a/gcc/common.opt	2018-04-30 15:35:55.274096877 +0200
+@@ -2367,7 +2367,7 @@ Common Alias(fstack-check=, specific, no
+ Insert stack checking code into the program.  Same as -fstack-check=specific.
+ 
+ fstack-clash-protection
+-Common Report Var(flag_stack_clash_protection) Optimization
++Common Report Var(flag_stack_clash_protection) Optimization Init(-1)
+ Insert code to probe each page of stack space as it is allocated to protect
+ from stack-clash style attacks.
+ 
+--- a/gcc/defaults.h	2018-01-03 11:03:58.000000000 +0100
++++ b/gcc/defaults.h	2018-05-01 12:41:29.522851451 +0200
+@@ -1435,6 +1435,15 @@ see the files COPYING3 and COPYING.RUNTI
+ #define STACK_CHECK_MAX_VAR_SIZE (STACK_CHECK_MAX_FRAME_SIZE / 100)
+ #endif
+ 
++/* Default value for flag_clash_protector when flag_clash_protector is
++   initialized to -1.  */
++#ifdef EXTRA_OPTIONS
++#define DEFAULT_FLAG_SCP 1
++#endif
++#ifndef DEFAULT_FLAG_SCP
++#define DEFAULT_FLAG_SCP 0
++#endif
++
+ /* By default, the C++ compiler will use function addresses in the
+    vtable entries.  Setting this nonzero tells the compiler to use
+    function descriptors instead.  The value of this macro says how
+--- a/gcc/toplev.c	2018-02-13 17:18:37.000000000 +0100
++++ b/gcc/toplev.c	2018-04-30 16:46:37.244027303 +0200
+@@ -1682,6 +1682,10 @@ process_options (void)
+ 
+   /* -fstack-clash-protection is not currently supported on targets
+      where the stack grows up.  */
++  if (flag_stack_clash_protection == -1)
++    {
++      flag_stack_clash_protection = DEFAULT_FLAG_SCP;
++    }
+   if (flag_stack_clash_protection && !STACK_GROWS_DOWNWARD)
+     {
+       warning_at (UNKNOWN_LOCATION, 0,
+
+--- a/libgcc/Makefile.in	2011-11-22 04:01:02.000000000 +0100
++++ b/libgcc/Makefile.in	2011-12-25 15:18:22.449610631 +0100
+@@ -225,7 +225,7 @@ endif
+ LIBGCC2_DEBUG_CFLAGS = -g
+ LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
+ 		 $(LIBGCC2_DEBUG_CFLAGS) -DIN_LIBGCC2 \
+-		 -fbuilding-libgcc -fno-stack-protector \
++		 -fbuilding-libgcc -fno-stack-protector -fno-stack-clash-protection \
+ 		 $(INHIBIT_LIBC_CFLAGS)
+ 
+ # Additional options to use when compiling libgcc2.a.
+@@ -279,7 +290,7 @@ INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CF
+   $(NO_PIE_CFLAGS) -finhibit-size-directive -fno-inline -fno-exceptions \
+   -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
+   -fbuilding-libgcc -fno-stack-protector $(FORCE_EXPLICIT_EH_REGISTRY) \
+-  $(INHIBIT_LIBC_CFLAGS) $(USE_TM_CLONE_REGISTRY)
++  -fno-stack-clash-protection $(INHIBIT_LIBC_CFLAGS) $(USE_TM_CLONE_REGISTRY)
+ 
+ # Extra flags to use when compiling crt{begin,end}.o.
+ CRTSTUFF_T_CFLAGS =

diff --git a/10.5.0/gentoo/29_all_lto-intl-workaround-PR95194.patch b/10.5.0/gentoo/29_all_lto-intl-workaround-PR95194.patch
new file mode 100644
index 0000000..9613216
--- /dev/null
+++ b/10.5.0/gentoo/29_all_lto-intl-workaround-PR95194.patch
@@ -0,0 +1,20 @@
+Trick libintl not to use '_INTL_REDIRECT_ASM' mode as it's
+incompatible with LTO builds.
+
+glibc does not normally use libintl implementations and uses
+it's own primitives. But musl ond others do fall back to libintl.
+
+Reported-by: Andrew Savchenko
+Bug: https://bugs.gentoo.org/723370
+Bug: https://gcc.gnu.org/PR95194
+--- a/intl/libgnuintl.h
++++ b/intl/libgnuintl.h
+@@ -93,7 +93,7 @@ extern "C" {
+    If he doesn't, we choose the method.  A third possible method is
+    _INTL_REDIRECT_ASM, supported only by GCC.  */
+ #if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
+-# if __GNUC__ >= 2 && !defined __APPLE_CC__ && (defined __STDC__ || defined __cplusplus)
++# if __GNUC__ >= 2 && !defined __APPLE_CC__ && (defined __STDC__ || defined __cplusplus) && USE_ASM_ALIASES_THAT_BREAK_LTO
+ #  define _INTL_REDIRECT_ASM
+ # else
+ #  ifdef __cplusplus

diff --git a/10.5.0/gentoo/30_all_plugin-objdump.patch b/10.5.0/gentoo/30_all_plugin-objdump.patch
new file mode 100644
index 0000000..a9c33fd
--- /dev/null
+++ b/10.5.0/gentoo/30_all_plugin-objdump.patch
@@ -0,0 +1,34 @@
+https://gcc.gnu.org/PR95648
+--- a/config/gcc-plugin.m4
++++ b/config/gcc-plugin.m4
+@@ -45,7 +45,7 @@ AC_DEFUN([GCC_ENABLE_PLUGINS],
+      ;;
+      *)
+        if test x$build = x$host; then
+-	 export_sym_check="objdump${exeext} -T"
++	 export_sym_check="$ac_cv_prog_OBJDUMP -T"
+        elif test x$host = x$target; then
+ 	 export_sym_check="$gcc_cv_objdump -T"
+        else
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -30386,7 +30386,7 @@ fi
+      ;;
+      *)
+        if test x$build = x$host; then
+-	 export_sym_check="objdump${exeext} -T"
++	 export_sym_check="$ac_cv_prog_OBJDUMP -T"
+        elif test x$host = x$target; then
+ 	 export_sym_check="$gcc_cv_objdump -T"
+        else
+--- a/libcc1/configure
++++ b/libcc1/configure
+@@ -14819,7 +14819,7 @@ fi
+      ;;
+      *)
+        if test x$build = x$host; then
+-	 export_sym_check="objdump${exeext} -T"
++	 export_sym_check="$ac_cv_prog_OBJDUMP -T"
+        elif test x$host = x$target; then
+ 	 export_sym_check="$gcc_cv_objdump -T"
+        else

diff --git a/10.5.0/gentoo/31_all_fno-delayed-branch.patch b/10.5.0/gentoo/31_all_fno-delayed-branch.patch
new file mode 100644
index 0000000..33ff2f4
--- /dev/null
+++ b/10.5.0/gentoo/31_all_fno-delayed-branch.patch
@@ -0,0 +1,40 @@
+From 6d0d3ae914bf19706550a539ef304c5875535ffc Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <siarheit@google.com>
+Date: Fri, 3 Jul 2020 22:50:33 +0100
+Subject: [PATCH] Disable -fdelayed-branch by default.
+
+From https://gcc.gnu.org/PR96015 / https://bugs.gentoo.org/729570.
+delayed branches are known to generate invalid code around
+__builtin_unreachable(); and mis-compiles python.
+
+Use blunt hammer and disable delayed slots until we have better fix.
+
+Reported-by: Jeroen Roovers
+Bug: https://gcc.gnu.org/PR96015
+Bug: https://bugs.gentoo.org/729570.
+Signed-off-by: Sergei Trofimovich <siarheit@google.com>
+---
+ gcc/opts.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+--- a/gcc/opts.c
++++ b/gcc/opts.c
+@@ -458,7 +458,14 @@ static const struct default_options default_options_table[] =
+     /* -O1 (and not -Og) optimizations.  */
+     { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fbranch_count_reg, NULL, 1 },
+ #if DELAY_SLOTS
+-    { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fdelayed_branch, NULL, 1 },
++    /*
++     * From https://gcc.gnu.org/PR96015 / https://bugs.gentoo.org/729570.
++     * delayed branches are known to generate invalid code around
++     * __builtin_unreachable(); and mis-compiles python.
++     *
++     * Use blunt hammer and disable delayed slots until we have better fix.
++     */
++    /* { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fdelayed_branch, NULL, 1 }, */
+ #endif
+     { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fdse, NULL, 1 },
+     { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fif_conversion, NULL, 1 },
+-- 
+2.27.0
+

diff --git a/10.5.0/gentoo/32_all_vtv-slibtool.patch b/10.5.0/gentoo/32_all_vtv-slibtool.patch
new file mode 100644
index 0000000..b5716f9
--- /dev/null
+++ b/10.5.0/gentoo/32_all_vtv-slibtool.patch
@@ -0,0 +1,62 @@
+https://bugs.gentoo.org/767706
+https://gcc.gnu.org/PR99172
+
+From c2be82058fb40f3ae891c68d185ff53e07f14f45 Mon Sep 17 00:00:00 2001
+From: Caroline Tice <cmtice@google.com>
+Date: Fri, 12 Mar 2021 07:34:36 -0800
+Subject: [PATCH] libstdc++-v3: Update VTV vars for libtool link commands
+ [PR99172]
+
+This fixes PR 99172
+
+Currently when GCC is configured with --enable-vtable-verify, the
+libstdc++-v3 Makefiles add "-fvtable-verify=std
+-Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end" to libtool link
+commands. The "-fvtable-verify=std" piece causes alternate versions of
+libtool (such as slibtool) to fail, unable to find "-lvtv" (GNU
+libtool just removes that piece).
+
+This patch updates the libstdc++-v3 Makefiles to not pass
+"-fvtable-verify=std" to the libtool link commands.
+---
+ libstdc++-v3/src/Makefile.am | 4 +++-
+ libstdc++-v3/src/Makefile.in | 3 ++-
+
+--- a/libstdc++-v3/src/Makefile.am
++++ b/libstdc++-v3/src/Makefile.am
+@@ -214,12 +214,14 @@ compatibility-condvar.o: compatibility-condvar.cc
+ # set this option because CONFIG_CXXFLAGS has to be after
+ # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
+ # as the occasion calls for it.
+-AM_CXXFLAGS = \
++AM_CXXFLAGS_PRE = \
+ 	-std=gnu++98 \
+ 	$(glibcxx_compiler_pic_flag) \
+ 	$(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
+ 	$(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
+ 
++AM_CXXFLAGS = $(filter-out -fvtable-verify=std,$(AM_CXXFLAGS_PRE))
++
+ # Libtool notes
+ 
+ # 1) In general, libtool expects an argument such as `--tag=CXX' when
+--- a/libstdc++-v3/src/Makefile.in
++++ b/libstdc++-v3/src/Makefile.in
+@@ -578,12 +578,13 @@ libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags)
+ # set this option because CONFIG_CXXFLAGS has to be after
+ # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
+ # as the occasion calls for it.
+-AM_CXXFLAGS = \
++AM_CXXFLAGS_PRE = \
+ 	-std=gnu++98 \
+ 	$(glibcxx_compiler_pic_flag) \
+ 	$(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
+ 	$(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
+ 
++AM_CXXFLAGS = $(filter-out -fvtable-verify=std,$(AM_CXXFLAGS_PRE))
+ 
+ # Libtool notes
+ 
+-- 
+2.30.2
+

diff --git a/10.5.0/gentoo/33_all_msgfmt-libstdc++-link.patch b/10.5.0/gentoo/33_all_msgfmt-libstdc++-link.patch
new file mode 100644
index 0000000..0d2f113
--- /dev/null
+++ b/10.5.0/gentoo/33_all_msgfmt-libstdc++-link.patch
@@ -0,0 +1,39 @@
+Ensure that msgfmt doesn't encounter problems during gcc bootstrapping.
+
+Solves error messages like the following:
+
+msgfmt: /var/tmp/portage/sys-devel/gcc-4.1.2/work/build/./gcc/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6)
+
+The libgcc_s.so used during build doesn't satisfy the needs of the
+libstdc++.so that msgfmt is linked against. On the other hand, msgfmt
+is used as a stand-alone application here, and what library it uses
+behind the scenes is of no concern to the gcc build process.
+Therefore, simply invoking it "as usual", i.e. without any special
+library path, will make it work as expected here.
+
+2011-09-19 Martin von Gagern
+
+References:
+https://bugs.gentoo.org/372377
+https://bugs.gentoo.org/295480
+https://bugs.gentoo.org/843119
+--- a/libstdc++-v3/po/Makefile.am
++++ b/libstdc++-v3/po/Makefile.am
+@@ -39,6 +39,7 @@ MSGFMT = msgfmt
+ EXTRA_DIST = string_literals.cc POTFILES.in $(PACKAGE).pot $(LOCALE_IN)
+ 
+ .po.mo:
++	env --unset=LD_LIBRARY_PATH \
+ 	$(MSGFMT) -o $@ $<
+ 
+ all-local: all-local-$(USE_NLS)
+--- a/libstdc++-v3/po/Makefile.in
++++ b/libstdc++-v3/po/Makefile.in
+@@ -419,6 +419,7 @@ uninstall-am: uninstall-info-am
+ 
+ 
+ .po.mo:
++	env --unset=LD_LIBRARY_PATH \
+ 	$(MSGFMT) -o $@ $<
+ 
+ all-local: all-local-$(USE_NLS)

diff --git a/10.5.0/gentoo/75_all_d_compiler_for_build_pie.patch b/10.5.0/gentoo/75_all_d_compiler_for_build_pie.patch
new file mode 100644
index 0000000..97996ea
--- /dev/null
+++ b/10.5.0/gentoo/75_all_d_compiler_for_build_pie.patch
@@ -0,0 +1,63 @@
+https://bugs.gentoo.org/855902
+https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=d3ae0f515d0c675d42f4f18fc267e8e75f6b6f26
+
+From d3ae0f515d0c675d42f4f18fc267e8e75f6b6f26 Mon Sep 17 00:00:00 2001
+From: Iain Buclaw <ibuclaw@gdcproject.org>
+Date: Sun, 16 Jun 2019 18:12:47 +0200
+Subject: [PATCH] d: Use COMPILER_FOR_BUILD to build all D front-end generator
+ programs
+
+This means the correct config headers are included when building the
+D front-end in a Canadian cross configuration.
+
+gcc/d/ChangeLog:
+
+	* Make-lang.in (DMDGEN_COMPILE): Remove.
+	(d/%.dmdgen.o): Use COMPILER_FOR_BUILD and BUILD_COMPILERFLAGS to
+	build all D generator programs.
+	(D_SYSTEM_H): New macro.
+	(d/idgen.dmdgen.o): Add dependencies to build.
+	(d/impcnvgen.dmdgen.o): Likewise.
+	* d-system.h: Include bconfig.h if GENERATOR_FILE is defined.
+--- a/gcc/d/Make-lang.in
++++ b/gcc/d/Make-lang.in
+@@ -52,7 +52,6 @@ d-warn = $(filter-out -pedantic -Woverloaded-virtual, $(STRICT_WARN))
+ # Also filter out warnings for missing format attributes in the D Frontend.
+ DMD_WARN_CXXFLAGS = $(filter-out -Wmissing-format-attribute, $(WARN_CXXFLAGS))
+ DMD_COMPILE = $(subst $(WARN_CXXFLAGS), $(DMD_WARN_CXXFLAGS), $(COMPILE))
+-DMDGEN_COMPILE = $(subst $(COMPILER), $(COMPILER_FOR_BUILD), $(DMD_COMPILE))
+ 
+ # D Frontend object files.
+ D_FRONTEND_OBJS = \
+@@ -360,6 +359,15 @@ d/id.h: d/id.c
+ d/impcnvtab.c: d/impcnvgen$(build_exeext)
+ 	cd d && ./impcnvgen$(build_exeext)
+ 
++# Compile the generator programs.
+ d/%.dmdgen.o: $(srcdir)/d/dmd/%.c
+-	$(DMDGEN_COMPILE) $(D_INCLUDES) $<
+-	$(POSTCOMPILE)
++	$(COMPILER_FOR_BUILD) -c $(BUILD_COMPILERFLAGS) $(D_INCLUDES) \
++		$(BUILD_CPPFLAGS) -o $@ $<
++
++# Header dependencies for the generator programs.
++D_SYSTEM_H = d/dmd/root/dsystem.h d/d-system.h
++
++d/idgen.dmdgen.o: d/dmd/idgen.c $(D_SYSTEM_H) $(BCONFIG_H) $(SYSTEM_H)
++
++d/impcnvgen.dmdgen.o: d/dmd/impcnvgen.c d/dmd/mtype.h $(D_SYSTEM_H) \
++	$(BCONFIG_H) $(SYSTEM_H)
+--- a/gcc/d/d-system.h
++++ b/gcc/d/d-system.h
+@@ -19,7 +19,11 @@
+ #ifndef GCC_D_SYSTEM_H
+ #define GCC_D_SYSTEM_H
+ 
++#ifdef GENERATOR_FILE
++#include "bconfig.h"
++#else
+ #include "config.h"
++#endif
+ #include "system.h"
+ 
+ /* Used by the dmd front-end to determine if we have POSIX-style IO.  */

diff --git a/10.5.0/gentoo/README.history b/10.5.0/gentoo/README.history
new file mode 100644
index 0000000..6c7ed1b
--- /dev/null
+++ b/10.5.0/gentoo/README.history
@@ -0,0 +1,35 @@
+0		?? ???? ????
+	+ 01_all_default-fortify-source.patch
+	+ 02_all_default-warn-format-security.patch
+	+ 03_all_default-warn-trampolines.patch
+	+ 04_all_nossp-on-nostdlib.patch
+	+ 05_all_alpha-mieee-default.patch
+	+ 06_all_ia64_note.GNU-stack.patch
+	+ 07_all_i386_libgcc_note.GNU-stack.patch
+	+ 08_all_libiberty-asprintf.patch
+	+ 09_all_libiberty-pic.patch
+	+ 10_all_nopie-all-flags.patch
+	+ 11_all_sh-drop-sysroot-suffix.patch
+	+ 12_all_ia64-TEXTREL.patch
+	+ 13_all_disable-systemtap-switch.patch
+	+ 14_all_m68k-textrel-on-libgcc.patch
+	+ 15_all_respect-build-cxxflags.patch
+	+ 16_all_libgfortran-Werror.patch
+	+ 17_all_libgomp-Werror.patch
+	+ 18_all_libitm-Werror.patch
+	+ 19_all_libatomic-Werror.patch
+	+ 20_all_libbacktrace-Werror.patch
+	+ 21_all_libsanitizer-Werror.patch
+	+ 22_all_libstdcxx-no-vtv.patch
+	+ 23_all_disable-riscv32-ABIs.patch
+	+ 24_all_default_ssp-buffer-size.patch
+	+ 25_all_hppa-faster-synth_mult.patch
+	+ 26_all_libcpp-ar.patch
+	+ 27_all_EXTRA_OPTIONS-z-now.patch
+	+ 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch
+	+ 29_all_lto-intl-workaround-PR95194.patch
+	+ 30_all_plugin-objdump.patch
+	+ 31_all_fno-delayed-branch.patch
+	+ 32_all_vtv-slibtool.patch
+	+ 33_all_msgfmt-libstdc++-link.patch
+	+ 75_all_d_compiler_for_build_pie.patch


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] proj/gcc-patches:master commit in: 10.5.0/gentoo/
@ 2022-08-22  2:37 Sam James
  0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2022-08-22  2:37 UTC (permalink / raw
  To: gentoo-commits

commit:     20b8e7fec339997398bc6881b30b9cf01cc9f0b1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 22 02:27:23 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 22 02:37:04 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=20b8e7fe

10.5.0: add 34_all_drop_CFLAGS_sed.patch

Previously was just for 12.

Bug: https://bugs.gentoo.org/849722
Signed-off-by: Sam James <sam <AT> gentoo.org>

 10.5.0/gentoo/34_all_drop_CFLAGS_sed.patch | 35 ++++++++++++++++++++++++++++++
 10.5.0/gentoo/README.history               |  3 ++-
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/10.5.0/gentoo/34_all_drop_CFLAGS_sed.patch b/10.5.0/gentoo/34_all_drop_CFLAGS_sed.patch
new file mode 100644
index 0000000..0136628
--- /dev/null
+++ b/10.5.0/gentoo/34_all_drop_CFLAGS_sed.patch
@@ -0,0 +1,35 @@
+https://bugs.gentoo.org/849722
+https://github.com/InBetweenNames/gentooLTO/issues/846
+https://github.com/vaeth/portage-bashrc-mv/issues/11
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -5195,13 +5195,6 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
+ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+ 
+ 
+-# Remove the -O2: for historical reasons, unless bootstrapping we prefer
+-# optimizations to be activated explicitly by the toplevel.
+-case "$CC" in
+-  */prev-gcc/xgcc*) ;;
+-  *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[ 	]//" -e "s/-O[gs][ 	]//" -e "s/-O[0-9]*[ 	]//" `
+-     CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[ 	]//" -e "s/-O[gs][ 	]//" -e "s/-O[0-9]*[ 	]//" ` ;;
+-esac
+ 
+ 
+ 
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -397,13 +397,6 @@ ACX_PROG_GNAT([-I"$srcdir"/ada/libgnat])
+ # Do configure tests with the C++ compiler, since that's what we build with.
+ AC_LANG(C++)
+ 
+-# Remove the -O2: for historical reasons, unless bootstrapping we prefer
+-# optimizations to be activated explicitly by the toplevel.
+-case "$CC" in
+-  */prev-gcc/xgcc*) ;;
+-  *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[[ 	]]//" -e "s/-O[[gs]][[ 	]]//" -e "s/-O[[0-9]]*[[ 	]]//" `
+-     CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[[ 	]]//" -e "s/-O[[gs]][[ 	]]//" -e "s/-O[[0-9]]*[[ 	]]//" ` ;;
+-esac
+ AC_SUBST(CFLAGS)
+ AC_SUBST(CXXFLAGS)
+ 

diff --git a/10.5.0/gentoo/README.history b/10.5.0/gentoo/README.history
index 6c7ed1b..19b1d3a 100644
--- a/10.5.0/gentoo/README.history
+++ b/10.5.0/gentoo/README.history
@@ -1,4 +1,4 @@
-0		?? ???? ????
+0		22 Aug 2022
 	+ 01_all_default-fortify-source.patch
 	+ 02_all_default-warn-format-security.patch
 	+ 03_all_default-warn-trampolines.patch
@@ -32,4 +32,5 @@
 	+ 31_all_fno-delayed-branch.patch
 	+ 32_all_vtv-slibtool.patch
 	+ 33_all_msgfmt-libstdc++-link.patch
+	+ 34_all_drop_CFLAGS_sed.patch
 	+ 75_all_d_compiler_for_build_pie.patch


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] proj/gcc-patches:master commit in: 10.5.0/gentoo/
@ 2022-11-20  0:25 Sam James
  0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2022-11-20  0:25 UTC (permalink / raw
  To: gentoo-commits

commit:     6afd754068920d41f4115c28c6c02e964fa5e38c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 19 23:50:42 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov 20 00:25:41 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=6afd7540

10.5.0: add Clang 16 patches (-Wimplicit-function-declaration, -Wimplicit-int, etc)

Signed-off-by: Sam James <sam <AT> gentoo.org>

 10.5.0/gentoo/76_all_configure-c89.patch | 141 +++++++++++++++++++++++++++++++
 10.5.0/gentoo/README.history             |   3 +
 2 files changed, 144 insertions(+)

diff --git a/10.5.0/gentoo/76_all_configure-c89.patch b/10.5.0/gentoo/76_all_configure-c89.patch
new file mode 100644
index 0000000..9d65cb2
--- /dev/null
+++ b/10.5.0/gentoo/76_all_configure-c89.patch
@@ -0,0 +1,141 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=6be2672e4ee41c566a9e072088cccca263bab5f7
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=885b6660c17fb91980b5682514ef54668e544b02
+
+From 942a325c81136138c4c199f8ab3e89a1945c3790 Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Tue, 18 Oct 2022 16:58:48 +0200
+Subject: [PATCH 1/2] libsanitizer: Avoid implicit function declaration in
+ configure test
+
+libsanitizer/
+
+        * configure.ac (sanitizer_supported): Include <unistd.h> for
+        syscall prototype.
+        * configure: Regenerate.
+
+From 9a43d0e406c05d2d7136721443192bb6588c3113 Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Tue, 18 Oct 2022 16:58:48 +0200
+Subject: [PATCH 2/2] libiberty: Fix C89-isms in configure tests
+
+libiberty/
+
+        * acinclude.m4 (ac_cv_func_strncmp_works): Add missing
+        int return type and parameter list to the definition of main.
+        Include <stdlib.h> and <string.h> for prototypes.
+        (ac_cv_c_stack_direction): Add missing
+        int return type and parameter list to the definitions of
+        main, find_stack_direction.  Include <stdlib.h> for exit
+        prototype.
+        * configure: Regenerate.
+
+--- a/libiberty/aclocal.m4
++++ b/libiberty/aclocal.m4
+@@ -16,6 +16,8 @@ AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works,
+ [AC_TRY_RUN([
+ /* Test by Jim Wilson and Kaveh Ghazi.
+    Check whether strncmp reads past the end of its string parameters. */
++#include <stdlib.h>
++#include <string.h>
+ #include <sys/types.h>
+ 
+ #ifdef HAVE_FCNTL_H
+@@ -43,7 +45,8 @@ AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works,
+ 
+ #define MAP_LEN 0x10000
+ 
+-main ()
++int
++main (void)
+ {
+ #if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
+   char *p;
+@@ -149,7 +152,10 @@ if test $ac_cv_os_cray = yes; then
+ fi
+ 
+ AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
+-[AC_TRY_RUN([find_stack_direction ()
++[AC_TRY_RUN([#include <stdlib.h>
++
++int
++find_stack_direction (void)
+ {
+   static char *addr = 0;
+   auto char dummy;
+@@ -161,7 +167,9 @@ AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
+   else
+     return (&dummy > addr) ? 1 : -1;
+ }
+-main ()
++
++int
++main (void)
+ {
+   exit (find_stack_direction() < 0);
+ }], 
+--- a/libiberty/configure
++++ b/libiberty/configure
+@@ -6718,7 +6718,10 @@ else
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+-find_stack_direction ()
++#include <stdlib.h>
++
++int
++find_stack_direction (void)
+ {
+   static char *addr = 0;
+   auto char dummy;
+@@ -6730,7 +6733,9 @@ find_stack_direction ()
+   else
+     return (&dummy > addr) ? 1 : -1;
+ }
+-main ()
++
++int
++main (void)
+ {
+   exit (find_stack_direction() < 0);
+ }
+@@ -7555,6 +7560,8 @@ else
+ 
+ /* Test by Jim Wilson and Kaveh Ghazi.
+    Check whether strncmp reads past the end of its string parameters. */
++#include <stdlib.h>
++#include <string.h>
+ #include <sys/types.h>
+ 
+ #ifdef HAVE_FCNTL_H
+@@ -7582,7 +7589,8 @@ else
+ 
+ #define MAP_LEN 0x10000
+ 
+-main ()
++int
++main (void)
+ {
+ #if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
+   char *p;
+--- a/libsanitizer/configure
++++ b/libsanitizer/configure
+@@ -16029,6 +16029,7 @@ case "$target" in
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <sys/syscall.h>
++#include <unistd.h>
+ int
+ main ()
+ {
+--- a/libsanitizer/configure.ac
++++ b/libsanitizer/configure.ac
+@@ -155,7 +155,8 @@ case "$target" in
+   *-*-linux*)
+     # Some old Linux distributions miss required syscalls.
+     sanitizer_supported=no
+-    AC_TRY_COMPILE([#include <sys/syscall.h>],[
++    AC_TRY_COMPILE([#include <sys/syscall.h>
++#include <unistd.h>],[
+       syscall (__NR_gettid);
+       syscall (__NR_futex);
+       syscall (__NR_exit_group);

diff --git a/10.5.0/gentoo/README.history b/10.5.0/gentoo/README.history
index 19b1d3a..41e961c 100644
--- a/10.5.0/gentoo/README.history
+++ b/10.5.0/gentoo/README.history
@@ -1,3 +1,6 @@
+1		19 Nov 2022
+	+ 76_all_configure-c89.patch
+
 0		22 Aug 2022
 	+ 01_all_default-fortify-source.patch
 	+ 02_all_default-warn-format-security.patch


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] proj/gcc-patches:master commit in: 10.5.0/gentoo/
@ 2022-12-17  4:54 Sam James
  0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2022-12-17  4:54 UTC (permalink / raw
  To: gentoo-commits

commit:     855c73908ad3bcdc7b976c55dd8ecb1a3ee285bb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 17 02:48:37 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Dec 17 04:54:05 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=855c7390

10.5.0: add 35_all_tar_libstdc++-link.patch

Bug: https://bugs.gentoo.org/886447
Signed-off-by: Sam James <sam <AT> gentoo.org>

 10.5.0/gentoo/35_all_tar_libstdc++-link.patch | 56 +++++++++++++++++++++++++++
 10.5.0/gentoo/README.history                  |  3 ++
 2 files changed, 59 insertions(+)

diff --git a/10.5.0/gentoo/35_all_tar_libstdc++-link.patch b/10.5.0/gentoo/35_all_tar_libstdc++-link.patch
new file mode 100644
index 0000000..7b1132e
--- /dev/null
+++ b/10.5.0/gentoo/35_all_tar_libstdc++-link.patch
@@ -0,0 +1,56 @@
+From eae11e896edef4199a128bf6720b5bd4e5edc2f9 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sat, 17 Dec 2022 02:42:59 +0000
+Subject: [PATCH] Fix calling libarchive's tar
+
+https://bugs.gentoo.org/886447
+
+Very similar to 33_all_msgfmt-libstdc++-link.patch, whose description is:
+"""
+Ensure that msgfmt doesn't encounter problems during gcc bootstrapping.
+
+Solves error messages like the following:
+
+msgfmt: /var/tmp/portage/sys-devel/gcc-4.1.2/work/build/./gcc/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6)
+
+The libgcc_s.so used during build doesn't satisfy the needs of the
+libstdc++.so that msgfmt is linked against. On the other hand, msgfmt
+is used as a stand-alone application here, and what library it uses
+behind the scenes is of no concern to the gcc build process.
+Therefore, simply invoking it "as usual", i.e. without any special
+library path, will make it work as expected here.
+
+2011-09-19 Martin von Gagern
+
+References:
+https://bugs.gentoo.org/372377
+https://bugs.gentoo.org/295480
+https://bugs.gentoo.org/843119
+"""
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -3835,9 +3835,9 @@ install-headers-tar: stmp-int-hdrs install-include-dir
+ # Unless a full pathname is provided, some shells would print the new CWD,
+ # found in CDPATH, corrupting the output.  We could just redirect the
+ # output of `cd', but some shells lose on redirection within `()'s
+-	(cd `${PWD_COMMAND}`/include ; \
++	(unset LD_LIBRARY_PATH ; cd `${PWD_COMMAND}`/include ; \
+ 	 tar -cf - .; exit 0) | (cd $(DESTDIR)$(libsubdir)/include; tar xpf - )
+-	(cd `${PWD_COMMAND}`/include-fixed ; \
++	(unset LD_LIBRARY_PATH ; cd `${PWD_COMMAND}`/include-fixed ; \
+ 	 tar -cf - .; exit 0) | (cd $(DESTDIR)$(libsubdir)/include-fixed; tar xpf - )
+ # /bin/sh on some systems returns the status of the first tar,
+ # and that can lose with GNU tar which always writes a full block.
+@@ -3859,7 +3859,7 @@ install-headers-cp: stmp-int-hdrs install-include-dir
+ # Targets without dependencies, for use in prev-gcc during bootstrap.
+ real-install-headers-tar:
+ 	(cd `${PWD_COMMAND}`/include-fixed ; \
+-	 tar -cf - .; exit 0) | (cd $(DESTDIR)$(libsubdir)/include-fixed; tar xpf - )
++	 unset LD_LIBRARY_PATH; tar -cf - .; exit 0) | (cd $(DESTDIR)$(libsubdir)/include-fixed; unset LD_LIBRARY_PATH; tar xpf - )
+ 
+ real-install-headers-cpio:
+ 	cd `${PWD_COMMAND}`/include-fixed ; \
+-- 
+2.39.0

diff --git a/10.5.0/gentoo/README.history b/10.5.0/gentoo/README.history
index 41e961c..29abddb 100644
--- a/10.5.0/gentoo/README.history
+++ b/10.5.0/gentoo/README.history
@@ -1,3 +1,6 @@
+2		17 Dec 2022
+	+ 35_all_tar_libstdc++-link.patch
+
 1		19 Nov 2022
 	+ 76_all_configure-c89.patch
 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] proj/gcc-patches:master commit in: 10.5.0/gentoo/
@ 2022-12-17  4:54 Sam James
  0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2022-12-17  4:54 UTC (permalink / raw
  To: gentoo-commits

commit:     6b7210b745d69eee33e5eda1a7ed5fa6ee93c003
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 17 02:49:23 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Dec 17 04:54:05 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=6b7210b7

Revert "10.5.0: backport make 4.4 jobserver fixes"

Not complete but wanted to commit it for posterity
in case we want to resume it.

This reverts commit b0521a3be4d9d67a7190126e58440c4904924744.

Bug: https://bugs.gentoo.org/884633
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../77_all_Factor-out-jobserver_active_p.patch     | 320 ---------------------
 ...-jobserver-style-fifo-for-recent-GNU-make.patch |  66 -----
 10.5.0/gentoo/README.history                       |   4 -
 3 files changed, 390 deletions(-)

diff --git a/10.5.0/gentoo/77_all_Factor-out-jobserver_active_p.patch b/10.5.0/gentoo/77_all_Factor-out-jobserver_active_p.patch
deleted file mode 100644
index 5658a1b..0000000
--- a/10.5.0/gentoo/77_all_Factor-out-jobserver_active_p.patch
+++ /dev/null
@@ -1,320 +0,0 @@
-https://bugs.gentoo.org/884633
-
-https://build.opensuse.org/package/view_file/devel:gcc/gcc12/gcc12-fifo-jobserver-support.patch
-https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=1270ccda70ca09f7d4fe76b5156dca8992bd77a6
-
-Rebased by Arsen Arsenović <arsen@aarsen.me>.
-
-From f8ca9e3ea075f5a3743fc74ae227a361f355c0f0 Mon Sep 17 00:00:00 2001
-From: Martin Liska <mliska@suse.cz>
-Date: Tue, 9 Aug 2022 13:59:32 +0200
-Subject: [PATCH 1/2] Factor out jobserver_active_p.
-
-gcc/ChangeLog:
-
-	* gcc.cc (driver::detect_jobserver): Remove and move to
-	jobserver.h.
-	* lto-wrapper.cc (jobserver_active_p): Likewise.
-	(run_gcc): Likewise.
-	* opts-jobserver.h: New file.
-	* opts-common.cc (jobserver_info::jobserver_info): New function.
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -27,6 +27,7 @@ CC recognizes how to compile each input file by suffixes in the file names.
- Once it knows which kind of compilation to perform, the procedure for
- compilation is specified by a string called a "spec".  */
- 
-+#define INCLUDE_STRING
- #include "config.h"
- #include "system.h"
- #include "coretypes.h"
-@@ -43,6 +44,7 @@ compilation is specified by a string called a "spec".  */
- #include "opts.h"
- #include "filenames.h"
- #include "spellcheck.h"
-+#include "opts-jobserver.h"
- 
- \f
- 
-@@ -8399,38 +8401,9 @@ driver::final_actions () const
- void
- driver::detect_jobserver () const
- {
--  /* Detect jobserver and drop it if it's not working.  */
--  const char *makeflags = env.get ("MAKEFLAGS");
--  if (makeflags != NULL)
--    {
--      const char *needle = "--jobserver-auth=";
--      const char *n = strstr (makeflags, needle);
--      if (n != NULL)
--	{
--	  int rfd = -1;
--	  int wfd = -1;
--
--	  bool jobserver
--	    = (sscanf (n + strlen (needle), "%d,%d", &rfd, &wfd) == 2
--	       && rfd > 0
--	       && wfd > 0
--	       && is_valid_fd (rfd)
--	       && is_valid_fd (wfd));
--
--	  /* Drop the jobserver if it's not working now.  */
--	  if (!jobserver)
--	    {
--	      unsigned offset = n - makeflags;
--	      char *dup = xstrdup (makeflags);
--	      dup[offset] = '\0';
--
--	      const char *space = strchr (makeflags + offset, ' ');
--	      if (space != NULL)
--		strcpy (dup + offset, space);
--	      xputenv (concat ("MAKEFLAGS=", dup, NULL));
--	    }
--	}
--    }
-+  jobserver_info jinfo;
-+  if (!jinfo.is_active && !jinfo.skipped_makeflags.empty ())
-+    xputenv (jinfo.skipped_makeflags.c_str ());
- }
- 
- /* Determine what the exit code of the driver should be.  */
---- a/gcc/lto-wrapper.c
-+++ b/gcc/lto-wrapper.c
-@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3.  If not see
-    ./ccCJuXGv.lto.ltrans.o
- */
- 
-+#define INCLUDE_STRING
- #include "config.h"
- #include "system.h"
- #include "coretypes.h"
-@@ -48,6 +49,8 @@ along with GCC; see the file COPYING3.  If not see
- #include "simple-object.h"
- #include "lto-section-names.h"
- #include "collect-utils.h"
-+#include "opts-diagnostic.h"
-+#include "opts-jobserver.h"
- 
- /* Environment variable, used for passing the names of offload targets from GCC
-    driver to lto-wrapper.  */
-@@ -1295,32 +1298,43 @@ init_num_threads (void)
- #endif
- }
- 
--/* FIXME: once using -std=c++11, we can use std::thread::hardware_concurrency.  */
--
--/* Return true when a jobserver is running and can accept a job.  */
--
--static bool
--jobserver_active_p (void)
-+void
-+print_lto_docs_link ()
- {
--  const char *makeflags = getenv ("MAKEFLAGS");
--  if (makeflags == NULL)
--    return false;
-+  bool print_url = global_dc->printer->url_format != URL_FORMAT_NONE;
-+  const char *url = global_dc->get_option_url (global_dc, OPT_flto);
- 
--  const char *needle = "--jobserver-auth=";
--  const char *n = strstr (makeflags, needle);
--  if (n == NULL)
--    return false;
--
--  int rfd = -1;
--  int wfd = -1;
--
--  return (sscanf (n + strlen (needle), "%d,%d", &rfd, &wfd) == 2
--	  && rfd > 0
--	  && wfd > 0
--	  && is_valid_fd (rfd)
--	  && is_valid_fd (wfd));
-+  pretty_printer pp;
-+  pp.url_format = URL_FORMAT_DEFAULT;
-+  pp_string (&pp, "see the ");
-+  if (print_url)
-+    pp_begin_url (&pp, url);
-+  pp_string (&pp, "%<-flto%> option documentation");
-+  if (print_url)
-+    pp_end_url (&pp);
-+  pp_string (&pp, " for more information");
-+  inform (UNKNOWN_LOCATION, pp_formatted_text (&pp));
- }
- 
-+/* Test that a make command is present and working, return true if so.  */
-+
-+static bool
-+make_exists (void)
-+{
-+  const char *make = "make";
-+  char **make_argv = buildargv (getenv ("MAKE"));
-+  if (make_argv)
-+    make = make_argv[0];
-+  const char *make_args[] = {make, "--version", NULL};
-+
-+  int exit_status = 0;
-+  int err = 0;
-+  const char *errmsg
-+    = pex_one (PEX_SEARCH, make_args[0], CONST_CAST (char **, make_args),
-+	       "make", NULL, NULL, &exit_status, &err);
-+  freeargv (make_argv);
-+  return errmsg == NULL && exit_status == 0 && err == 0;
-+}
- /* Execute gcc. ARGC is the number of arguments. ARGV contains the arguments. */
- 
- static void
-@@ -1535,10 +1549,20 @@ run_gcc (unsigned argc, char *argv[])
-       auto_parallel = 0;
-       parallel = 0;
-     }
--  else if (!jobserver && jobserver_active_p ())
-+  else
-     {
--      parallel = 1;
--      jobserver = 1;
-+      jobserver_info jinfo;
-+      if (jobserver && !jinfo.is_active)
-+	{
-+	  /* Fall back to auto parallelism.  */
-+	  jobserver = 0;
-+	  auto_parallel = 1;
-+	}
-+      else if (!jobserver && jinfo.is_active)
-+	{
-+	  parallel = 1;
-+	  jobserver = 1;
-+	}
-     }
- 
-   if (linker_output)
-@@ -1861,6 +1885,20 @@ cont:
-       maybe_unlink (ltrans_output_file);
-       ltrans_output_file = NULL;
- 
-+      if (nr > 1)
-+	{
-+	  if (jobserver_requested && !jinfo.is_active)
-+	    {
-+	      warning (0, jinfo.error_msg.c_str ());
-+	      print_lto_docs_link ();
-+	    }
-+	  else if (parallel == 0)
-+	    {
-+	      warning (0, "using serial compilation of %d LTRANS jobs", nr);
-+	      print_lto_docs_link ();
-+	    }
-+	}
-+
-       if (parallel)
- 	{
- 	  makefile = make_temp_file (".mk");
---- a/gcc/opts-common.c
-+++ b/gcc/opts-common.c
-@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
- along with GCC; see the file COPYING3.  If not see
- <http://www.gnu.org/licenses/>.  */
- 
-+#define INCLUDE_STRING
- #include "config.h"
- #include "system.h"
- #include "intl.h"
-@@ -25,6 +26,7 @@ along with GCC; see the file COPYING3.  If not see
- #include "options.h"
- #include "diagnostic.h"
- #include "spellcheck.h"
-+#include "opts-jobserver.h"
- 
- static void prune_options (struct cl_decoded_option **, unsigned int *);
- 
-@@ -1805,3 +1807,42 @@ void prepend_xassembler_to_collect_as_options (const char *collect_as_options,
-       obstack_1grow (o, '\'');
-     }
- }
-+
-+jobserver_info::jobserver_info ()
-+{
-+  /* Detect jobserver and drop it if it's not working.  */
-+  string js_needle = "--jobserver-auth=";
-+
-+  const char *envval = getenv ("MAKEFLAGS");
-+  if (envval != NULL)
-+    {
-+      string makeflags = envval;
-+      size_t n = makeflags.rfind (js_needle);
-+      if (n != string::npos)
-+	{
-+	  if (sscanf (makeflags.c_str () + n + js_needle.size (),
-+		      "%d,%d", &rfd, &wfd) == 2
-+	      && rfd > 0
-+	      && wfd > 0
-+	      && is_valid_fd (rfd)
-+	      && is_valid_fd (wfd))
-+	    is_active = true;
-+	  else
-+	    {
-+	      string dup = makeflags.substr (0, n);
-+	      size_t pos = makeflags.find (' ', n);
-+	      if (pos != string::npos)
-+		dup += makeflags.substr (pos);
-+	      skipped_makeflags = "MAKEFLAGS=" + dup;
-+	      error_msg
-+		= "cannot access %<" + js_needle + "%> file descriptors";
-+	    }
-+	}
-+      error_msg = "%<" + js_needle + "%> is not present in %<MAKEFLAGS%>";
-+    }
-+  else
-+    error_msg = "%<MAKEFLAGS%> environment variable is unset";
-+
-+  if (!error_msg.empty ())
-+    error_msg = "jobserver is not available: " + error_msg;
-+}
---- /dev/null
-+++ b/gcc/opts-jobserver.h
-@@ -0,0 +1,44 @@
-+/* GNU make's jobserver related functionality.
-+   Copyright (C) 2022 Free Software Foundation, Inc.
-+
-+This file is part of GCC.
-+
-+GCC is free software; you can redistribute it and/or modify it under
-+the terms of the GNU General Public License as published by the Free
-+Software Foundation; either version 3, or (at your option) any later
-+version.
-+
-+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-+WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-+for more details.
-+
-+You should have received a copy of the GNU General Public License
-+along with GCC; see the file COPYING3.  If not see
-+<http://www.gnu.org/licenses/>.
-+
-+See dbgcnt.def for usage information.  */
-+
-+#ifndef GCC_JOBSERVER_H
-+#define GCC_JOBSERVER_H
-+
-+using namespace std;
-+
-+struct jobserver_info
-+{
-+  /* Default constructor.  */
-+  jobserver_info ();
-+
-+  /* Error message if there is a problem.  */
-+  string error_msg = "";
-+  /* Skipped MAKEFLAGS where --jobserver-auth is skipped.  */
-+  string skipped_makeflags = "";
-+  /* File descriptor for reading used for jobserver communication.  */
-+  int rfd = -1;
-+  /* File descriptor for writing used for jobserver communication.  */
-+  int wfd = -1;
-+  /* Return true if jobserver is active.  */
-+  bool is_active = false;
-+};
-+
-+#endif /* GCC_JOBSERVER_H */
--- 
-2.38.1

diff --git a/10.5.0/gentoo/78_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch b/10.5.0/gentoo/78_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch
deleted file mode 100644
index 5d50461..0000000
--- a/10.5.0/gentoo/78_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-https://bugs.gentoo.org/884633
-
-https://build.opensuse.org/package/view_file/devel:gcc/gcc12/gcc12-fifo-jobserver-support.patch
-https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=53e3b2bf16a486c15c20991c6095f7be09012b55
-
-Rebased by Arsen Arsenović <arsen@aarsen.me>.
-
-From ab7a17b024ec3efabb3803e4d1dab461082044a9 Mon Sep 17 00:00:00 2001
-From: Martin Liska <mliska@suse.cz>
-Date: Tue, 9 Aug 2022 13:59:36 +0200
-Subject: [PATCH 2/2] lto: support --jobserver-style=fifo for recent GNU make
-
-gcc/ChangeLog:
-
-	* opts-jobserver.h: Add one member.
-	* opts-common.cc (jobserver_info::jobserver_info): Parse FIFO
-	format of --jobserver-auth.
---- a/gcc/opts-common.c
-+++ b/gcc/opts-common.c
-@@ -1810,8 +1810,14 @@ void prepend_xassembler_to_collect_as_options (const char *collect_as_options,
- 
- jobserver_info::jobserver_info ()
- {
-+  /* Traditionally, GNU make uses opened pipes for jobserver-auth,
-+    e.g. --jobserver-auth=3,4.
-+    Starting with GNU make 4.4, one can use --jobserver-style=fifo
-+    and then named pipe is used: --jobserver-auth=fifo:/tmp/hcsparta.  */
-+
-   /* Detect jobserver and drop it if it's not working.  */
-   string js_needle = "--jobserver-auth=";
-+  string fifo_prefix = "fifo:";
- 
-   const char *envval = getenv ("MAKEFLAGS");
-   if (envval != NULL)
-@@ -1820,8 +1826,15 @@ jobserver_info::jobserver_info ()
-       size_t n = makeflags.rfind (js_needle);
-       if (n != string::npos)
- 	{
--	  if (sscanf (makeflags.c_str () + n + js_needle.size (),
--		      "%d,%d", &rfd, &wfd) == 2
-+	  string ending = makeflags.substr (n + js_needle.size ());
-+	  if (ending.find (fifo_prefix) == 0)
-+	    {
-+	      ending = ending.substr (fifo_prefix.size ());
-+	      pipe_path = ending.substr (0, ending.find (' '));
-+	      is_active = true;
-+	    }
-+	  else if (sscanf (makeflags.c_str () + n + js_needle.size (),
-+			   "%d,%d", &rfd, &wfd) == 2
- 	      && rfd > 0
- 	      && wfd > 0
- 	      && is_valid_fd (rfd)
---- a/gcc/opts-jobserver.h
-+++ b/gcc/opts-jobserver.h
-@@ -37,6 +37,8 @@ struct jobserver_info
-   int rfd = -1;
-   /* File descriptor for writing used for jobserver communication.  */
-   int wfd = -1;
-+  /* Named pipe path.  */
-+  string pipe_path = "";
-   /* Return true if jobserver is active.  */
-   bool is_active = false;
- };
--- 
-2.38.1
-

diff --git a/10.5.0/gentoo/README.history b/10.5.0/gentoo/README.history
index 6d8c5c2..41e961c 100644
--- a/10.5.0/gentoo/README.history
+++ b/10.5.0/gentoo/README.history
@@ -1,7 +1,3 @@
-2		9 Dec 2022
-	+ 77_all_Factor-out-jobserver_active_p.patch
-	+ 78_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch
-
 1		19 Nov 2022
 	+ 76_all_configure-c89.patch
 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] proj/gcc-patches:master commit in: 10.5.0/gentoo/
@ 2022-12-17  4:54 Sam James
  0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2022-12-17  4:54 UTC (permalink / raw
  To: gentoo-commits

commit:     a535dea3848bd10f950f72281bb7d1563586d1d8
Author:     Arsen Arsenović <arsen <AT> aarsen <DOT> me>
AuthorDate: Fri Dec  9 14:37:14 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Dec 17 04:54:04 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=a535dea3

10.5.0: backport make 4.4 jobserver fixes

Bug: https://bugs.gentoo.org/884633
Signed-off-by: Arsen Arsenović <arsen <AT> aarsen.me>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../77_all_Factor-out-jobserver_active_p.patch     | 320 +++++++++++++++++++++
 ...-jobserver-style-fifo-for-recent-GNU-make.patch |  66 +++++
 10.5.0/gentoo/README.history                       |   4 +
 3 files changed, 390 insertions(+)

diff --git a/10.5.0/gentoo/77_all_Factor-out-jobserver_active_p.patch b/10.5.0/gentoo/77_all_Factor-out-jobserver_active_p.patch
new file mode 100644
index 0000000..5658a1b
--- /dev/null
+++ b/10.5.0/gentoo/77_all_Factor-out-jobserver_active_p.patch
@@ -0,0 +1,320 @@
+https://bugs.gentoo.org/884633
+
+https://build.opensuse.org/package/view_file/devel:gcc/gcc12/gcc12-fifo-jobserver-support.patch
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=1270ccda70ca09f7d4fe76b5156dca8992bd77a6
+
+Rebased by Arsen Arsenović <arsen@aarsen.me>.
+
+From f8ca9e3ea075f5a3743fc74ae227a361f355c0f0 Mon Sep 17 00:00:00 2001
+From: Martin Liska <mliska@suse.cz>
+Date: Tue, 9 Aug 2022 13:59:32 +0200
+Subject: [PATCH 1/2] Factor out jobserver_active_p.
+
+gcc/ChangeLog:
+
+	* gcc.cc (driver::detect_jobserver): Remove and move to
+	jobserver.h.
+	* lto-wrapper.cc (jobserver_active_p): Likewise.
+	(run_gcc): Likewise.
+	* opts-jobserver.h: New file.
+	* opts-common.cc (jobserver_info::jobserver_info): New function.
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -27,6 +27,7 @@ CC recognizes how to compile each input file by suffixes in the file names.
+ Once it knows which kind of compilation to perform, the procedure for
+ compilation is specified by a string called a "spec".  */
+ 
++#define INCLUDE_STRING
+ #include "config.h"
+ #include "system.h"
+ #include "coretypes.h"
+@@ -43,6 +44,7 @@ compilation is specified by a string called a "spec".  */
+ #include "opts.h"
+ #include "filenames.h"
+ #include "spellcheck.h"
++#include "opts-jobserver.h"
+ 
+ \f
+ 
+@@ -8399,38 +8401,9 @@ driver::final_actions () const
+ void
+ driver::detect_jobserver () const
+ {
+-  /* Detect jobserver and drop it if it's not working.  */
+-  const char *makeflags = env.get ("MAKEFLAGS");
+-  if (makeflags != NULL)
+-    {
+-      const char *needle = "--jobserver-auth=";
+-      const char *n = strstr (makeflags, needle);
+-      if (n != NULL)
+-	{
+-	  int rfd = -1;
+-	  int wfd = -1;
+-
+-	  bool jobserver
+-	    = (sscanf (n + strlen (needle), "%d,%d", &rfd, &wfd) == 2
+-	       && rfd > 0
+-	       && wfd > 0
+-	       && is_valid_fd (rfd)
+-	       && is_valid_fd (wfd));
+-
+-	  /* Drop the jobserver if it's not working now.  */
+-	  if (!jobserver)
+-	    {
+-	      unsigned offset = n - makeflags;
+-	      char *dup = xstrdup (makeflags);
+-	      dup[offset] = '\0';
+-
+-	      const char *space = strchr (makeflags + offset, ' ');
+-	      if (space != NULL)
+-		strcpy (dup + offset, space);
+-	      xputenv (concat ("MAKEFLAGS=", dup, NULL));
+-	    }
+-	}
+-    }
++  jobserver_info jinfo;
++  if (!jinfo.is_active && !jinfo.skipped_makeflags.empty ())
++    xputenv (jinfo.skipped_makeflags.c_str ());
+ }
+ 
+ /* Determine what the exit code of the driver should be.  */
+--- a/gcc/lto-wrapper.c
++++ b/gcc/lto-wrapper.c
+@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3.  If not see
+    ./ccCJuXGv.lto.ltrans.o
+ */
+ 
++#define INCLUDE_STRING
+ #include "config.h"
+ #include "system.h"
+ #include "coretypes.h"
+@@ -48,6 +49,8 @@ along with GCC; see the file COPYING3.  If not see
+ #include "simple-object.h"
+ #include "lto-section-names.h"
+ #include "collect-utils.h"
++#include "opts-diagnostic.h"
++#include "opts-jobserver.h"
+ 
+ /* Environment variable, used for passing the names of offload targets from GCC
+    driver to lto-wrapper.  */
+@@ -1295,32 +1298,43 @@ init_num_threads (void)
+ #endif
+ }
+ 
+-/* FIXME: once using -std=c++11, we can use std::thread::hardware_concurrency.  */
+-
+-/* Return true when a jobserver is running and can accept a job.  */
+-
+-static bool
+-jobserver_active_p (void)
++void
++print_lto_docs_link ()
+ {
+-  const char *makeflags = getenv ("MAKEFLAGS");
+-  if (makeflags == NULL)
+-    return false;
++  bool print_url = global_dc->printer->url_format != URL_FORMAT_NONE;
++  const char *url = global_dc->get_option_url (global_dc, OPT_flto);
+ 
+-  const char *needle = "--jobserver-auth=";
+-  const char *n = strstr (makeflags, needle);
+-  if (n == NULL)
+-    return false;
+-
+-  int rfd = -1;
+-  int wfd = -1;
+-
+-  return (sscanf (n + strlen (needle), "%d,%d", &rfd, &wfd) == 2
+-	  && rfd > 0
+-	  && wfd > 0
+-	  && is_valid_fd (rfd)
+-	  && is_valid_fd (wfd));
++  pretty_printer pp;
++  pp.url_format = URL_FORMAT_DEFAULT;
++  pp_string (&pp, "see the ");
++  if (print_url)
++    pp_begin_url (&pp, url);
++  pp_string (&pp, "%<-flto%> option documentation");
++  if (print_url)
++    pp_end_url (&pp);
++  pp_string (&pp, " for more information");
++  inform (UNKNOWN_LOCATION, pp_formatted_text (&pp));
+ }
+ 
++/* Test that a make command is present and working, return true if so.  */
++
++static bool
++make_exists (void)
++{
++  const char *make = "make";
++  char **make_argv = buildargv (getenv ("MAKE"));
++  if (make_argv)
++    make = make_argv[0];
++  const char *make_args[] = {make, "--version", NULL};
++
++  int exit_status = 0;
++  int err = 0;
++  const char *errmsg
++    = pex_one (PEX_SEARCH, make_args[0], CONST_CAST (char **, make_args),
++	       "make", NULL, NULL, &exit_status, &err);
++  freeargv (make_argv);
++  return errmsg == NULL && exit_status == 0 && err == 0;
++}
+ /* Execute gcc. ARGC is the number of arguments. ARGV contains the arguments. */
+ 
+ static void
+@@ -1535,10 +1549,20 @@ run_gcc (unsigned argc, char *argv[])
+       auto_parallel = 0;
+       parallel = 0;
+     }
+-  else if (!jobserver && jobserver_active_p ())
++  else
+     {
+-      parallel = 1;
+-      jobserver = 1;
++      jobserver_info jinfo;
++      if (jobserver && !jinfo.is_active)
++	{
++	  /* Fall back to auto parallelism.  */
++	  jobserver = 0;
++	  auto_parallel = 1;
++	}
++      else if (!jobserver && jinfo.is_active)
++	{
++	  parallel = 1;
++	  jobserver = 1;
++	}
+     }
+ 
+   if (linker_output)
+@@ -1861,6 +1885,20 @@ cont:
+       maybe_unlink (ltrans_output_file);
+       ltrans_output_file = NULL;
+ 
++      if (nr > 1)
++	{
++	  if (jobserver_requested && !jinfo.is_active)
++	    {
++	      warning (0, jinfo.error_msg.c_str ());
++	      print_lto_docs_link ();
++	    }
++	  else if (parallel == 0)
++	    {
++	      warning (0, "using serial compilation of %d LTRANS jobs", nr);
++	      print_lto_docs_link ();
++	    }
++	}
++
+       if (parallel)
+ 	{
+ 	  makefile = make_temp_file (".mk");
+--- a/gcc/opts-common.c
++++ b/gcc/opts-common.c
+@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
++#define INCLUDE_STRING
+ #include "config.h"
+ #include "system.h"
+ #include "intl.h"
+@@ -25,6 +26,7 @@ along with GCC; see the file COPYING3.  If not see
+ #include "options.h"
+ #include "diagnostic.h"
+ #include "spellcheck.h"
++#include "opts-jobserver.h"
+ 
+ static void prune_options (struct cl_decoded_option **, unsigned int *);
+ 
+@@ -1805,3 +1807,42 @@ void prepend_xassembler_to_collect_as_options (const char *collect_as_options,
+       obstack_1grow (o, '\'');
+     }
+ }
++
++jobserver_info::jobserver_info ()
++{
++  /* Detect jobserver and drop it if it's not working.  */
++  string js_needle = "--jobserver-auth=";
++
++  const char *envval = getenv ("MAKEFLAGS");
++  if (envval != NULL)
++    {
++      string makeflags = envval;
++      size_t n = makeflags.rfind (js_needle);
++      if (n != string::npos)
++	{
++	  if (sscanf (makeflags.c_str () + n + js_needle.size (),
++		      "%d,%d", &rfd, &wfd) == 2
++	      && rfd > 0
++	      && wfd > 0
++	      && is_valid_fd (rfd)
++	      && is_valid_fd (wfd))
++	    is_active = true;
++	  else
++	    {
++	      string dup = makeflags.substr (0, n);
++	      size_t pos = makeflags.find (' ', n);
++	      if (pos != string::npos)
++		dup += makeflags.substr (pos);
++	      skipped_makeflags = "MAKEFLAGS=" + dup;
++	      error_msg
++		= "cannot access %<" + js_needle + "%> file descriptors";
++	    }
++	}
++      error_msg = "%<" + js_needle + "%> is not present in %<MAKEFLAGS%>";
++    }
++  else
++    error_msg = "%<MAKEFLAGS%> environment variable is unset";
++
++  if (!error_msg.empty ())
++    error_msg = "jobserver is not available: " + error_msg;
++}
+--- /dev/null
++++ b/gcc/opts-jobserver.h
+@@ -0,0 +1,44 @@
++/* GNU make's jobserver related functionality.
++   Copyright (C) 2022 Free Software Foundation, Inc.
++
++This file is part of GCC.
++
++GCC is free software; you can redistribute it and/or modify it under
++the terms of the GNU General Public License as published by the Free
++Software Foundation; either version 3, or (at your option) any later
++version.
++
++GCC is distributed in the hope that it will be useful, but WITHOUT ANY
++WARRANTY; without even the implied warranty of MERCHANTABILITY or
++FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++for more details.
++
++You should have received a copy of the GNU General Public License
++along with GCC; see the file COPYING3.  If not see
++<http://www.gnu.org/licenses/>.
++
++See dbgcnt.def for usage information.  */
++
++#ifndef GCC_JOBSERVER_H
++#define GCC_JOBSERVER_H
++
++using namespace std;
++
++struct jobserver_info
++{
++  /* Default constructor.  */
++  jobserver_info ();
++
++  /* Error message if there is a problem.  */
++  string error_msg = "";
++  /* Skipped MAKEFLAGS where --jobserver-auth is skipped.  */
++  string skipped_makeflags = "";
++  /* File descriptor for reading used for jobserver communication.  */
++  int rfd = -1;
++  /* File descriptor for writing used for jobserver communication.  */
++  int wfd = -1;
++  /* Return true if jobserver is active.  */
++  bool is_active = false;
++};
++
++#endif /* GCC_JOBSERVER_H */
+-- 
+2.38.1

diff --git a/10.5.0/gentoo/78_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch b/10.5.0/gentoo/78_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch
new file mode 100644
index 0000000..5d50461
--- /dev/null
+++ b/10.5.0/gentoo/78_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch
@@ -0,0 +1,66 @@
+https://bugs.gentoo.org/884633
+
+https://build.opensuse.org/package/view_file/devel:gcc/gcc12/gcc12-fifo-jobserver-support.patch
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=53e3b2bf16a486c15c20991c6095f7be09012b55
+
+Rebased by Arsen Arsenović <arsen@aarsen.me>.
+
+From ab7a17b024ec3efabb3803e4d1dab461082044a9 Mon Sep 17 00:00:00 2001
+From: Martin Liska <mliska@suse.cz>
+Date: Tue, 9 Aug 2022 13:59:36 +0200
+Subject: [PATCH 2/2] lto: support --jobserver-style=fifo for recent GNU make
+
+gcc/ChangeLog:
+
+	* opts-jobserver.h: Add one member.
+	* opts-common.cc (jobserver_info::jobserver_info): Parse FIFO
+	format of --jobserver-auth.
+--- a/gcc/opts-common.c
++++ b/gcc/opts-common.c
+@@ -1810,8 +1810,14 @@ void prepend_xassembler_to_collect_as_options (const char *collect_as_options,
+ 
+ jobserver_info::jobserver_info ()
+ {
++  /* Traditionally, GNU make uses opened pipes for jobserver-auth,
++    e.g. --jobserver-auth=3,4.
++    Starting with GNU make 4.4, one can use --jobserver-style=fifo
++    and then named pipe is used: --jobserver-auth=fifo:/tmp/hcsparta.  */
++
+   /* Detect jobserver and drop it if it's not working.  */
+   string js_needle = "--jobserver-auth=";
++  string fifo_prefix = "fifo:";
+ 
+   const char *envval = getenv ("MAKEFLAGS");
+   if (envval != NULL)
+@@ -1820,8 +1826,15 @@ jobserver_info::jobserver_info ()
+       size_t n = makeflags.rfind (js_needle);
+       if (n != string::npos)
+ 	{
+-	  if (sscanf (makeflags.c_str () + n + js_needle.size (),
+-		      "%d,%d", &rfd, &wfd) == 2
++	  string ending = makeflags.substr (n + js_needle.size ());
++	  if (ending.find (fifo_prefix) == 0)
++	    {
++	      ending = ending.substr (fifo_prefix.size ());
++	      pipe_path = ending.substr (0, ending.find (' '));
++	      is_active = true;
++	    }
++	  else if (sscanf (makeflags.c_str () + n + js_needle.size (),
++			   "%d,%d", &rfd, &wfd) == 2
+ 	      && rfd > 0
+ 	      && wfd > 0
+ 	      && is_valid_fd (rfd)
+--- a/gcc/opts-jobserver.h
++++ b/gcc/opts-jobserver.h
+@@ -37,6 +37,8 @@ struct jobserver_info
+   int rfd = -1;
+   /* File descriptor for writing used for jobserver communication.  */
+   int wfd = -1;
++  /* Named pipe path.  */
++  string pipe_path = "";
+   /* Return true if jobserver is active.  */
+   bool is_active = false;
+ };
+-- 
+2.38.1
+

diff --git a/10.5.0/gentoo/README.history b/10.5.0/gentoo/README.history
index 41e961c..6d8c5c2 100644
--- a/10.5.0/gentoo/README.history
+++ b/10.5.0/gentoo/README.history
@@ -1,3 +1,7 @@
+2		9 Dec 2022
+	+ 77_all_Factor-out-jobserver_active_p.patch
+	+ 78_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch
+
 1		19 Nov 2022
 	+ 76_all_configure-c89.patch
 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] proj/gcc-patches:master commit in: 10.5.0/gentoo/
@ 2023-01-23  0:35 Sam James
  0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2023-01-23  0:35 UTC (permalink / raw
  To: gentoo-commits

commit:     2d7f885131fa8fba81d0a6f558ba58044b9ee726
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 23 00:31:27 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jan 23 00:35:20 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=2d7f8851

10.5.0: backport driver environ corruption fix

Bug: https://bugs.gentoo.org/885501
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../77_all_driver_environ_putenv_PR106624.patch    | 44 ++++++++++++++++++++++
 10.5.0/gentoo/README.history                       |  3 ++
 2 files changed, 47 insertions(+)

diff --git a/10.5.0/gentoo/77_all_driver_environ_putenv_PR106624.patch b/10.5.0/gentoo/77_all_driver_environ_putenv_PR106624.patch
new file mode 100644
index 0000000..baad63a
--- /dev/null
+++ b/10.5.0/gentoo/77_all_driver_environ_putenv_PR106624.patch
@@ -0,0 +1,44 @@
+https://bugs.gentoo.org/885501
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106624
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=2b403297b111c990c331b5bbb6165b061ad2259b
+
+From 2b403297b111c990c331b5bbb6165b061ad2259b Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <siarheit@google.com>
+Date: Tue, 16 Aug 2022 12:35:07 +0100
+Subject: [PATCH 1/1] driver: fix environ corruption after putenv() [PR106624]
+
+The bug appeared afte r13-2010-g1270ccda70ca09 "Factor out
+jobserver_active_p" slightly changed `putenv()` use from allocating
+to non-allocating:
+
+    -xputenv (concat ("MAKEFLAGS=", dup, NULL));
+    +xputenv (jinfo.skipped_makeflags.c_str ());
+
+`xputenv()` (and `putenv()`) don't copy strings and only store the
+pointer in the `environ` global table. As a result `environ` got
+corrupted as soon as `jinfo.skipped_makeflags` store got deallocated.
+
+This started causing bootstrap crashes in `execv()` calls:
+
+    xgcc: fatal error: cannot execute '/build/build/./prev-gcc/collect2': execv: Bad address
+
+The change restores memory allocation for `xputenv()` argument.
+
+gcc/
+
+	PR driver/106624
+	* gcc.c (driver::detect_jobserver): Allocate storage xputenv()
+	argument using xstrdup().
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -9182,7 +9182,7 @@ driver::detect_jobserver () const
+ {
+   jobserver_info jinfo;
+   if (!jinfo.is_active && !jinfo.skipped_makeflags.empty ())
+-    xputenv (jinfo.skipped_makeflags.c_str ());
++    xputenv (xstrdup (jinfo.skipped_makeflags.c_str ()));
+ }
+ 
+ /* Determine what the exit code of the driver should be.  */
+-- 
+2.31.1

diff --git a/10.5.0/gentoo/README.history b/10.5.0/gentoo/README.history
index db63084..d721532 100644
--- a/10.5.0/gentoo/README.history
+++ b/10.5.0/gentoo/README.history
@@ -1,3 +1,6 @@
+4		23 Jan 2022
+	+ 77_all_driver_environ_putenv_PR106624.patch
+
 3		17 Dec 2022
 	U 35_all_tar_libstdc++-link.patch
 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] proj/gcc-patches:master commit in: 10.5.0/gentoo/
@ 2023-01-27  8:12 Sam James
  0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2023-01-27  8:12 UTC (permalink / raw
  To: gentoo-commits

commit:     15f41a07367e1aba2646c9c9883502c927da8d15
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 27 08:11:28 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jan 27 08:11:28 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=15f41a07

10.5.0: drop upstreamed 77_all_driver_environ_putenv_PR106624.patch

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../77_all_driver_environ_putenv_PR106624.patch    | 44 ----------------------
 10.5.0/gentoo/README.history                       |  3 ++
 2 files changed, 3 insertions(+), 44 deletions(-)

diff --git a/10.5.0/gentoo/77_all_driver_environ_putenv_PR106624.patch b/10.5.0/gentoo/77_all_driver_environ_putenv_PR106624.patch
deleted file mode 100644
index baad63a..0000000
--- a/10.5.0/gentoo/77_all_driver_environ_putenv_PR106624.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-https://bugs.gentoo.org/885501
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106624
-https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=2b403297b111c990c331b5bbb6165b061ad2259b
-
-From 2b403297b111c990c331b5bbb6165b061ad2259b Mon Sep 17 00:00:00 2001
-From: Sergei Trofimovich <siarheit@google.com>
-Date: Tue, 16 Aug 2022 12:35:07 +0100
-Subject: [PATCH 1/1] driver: fix environ corruption after putenv() [PR106624]
-
-The bug appeared afte r13-2010-g1270ccda70ca09 "Factor out
-jobserver_active_p" slightly changed `putenv()` use from allocating
-to non-allocating:
-
-    -xputenv (concat ("MAKEFLAGS=", dup, NULL));
-    +xputenv (jinfo.skipped_makeflags.c_str ());
-
-`xputenv()` (and `putenv()`) don't copy strings and only store the
-pointer in the `environ` global table. As a result `environ` got
-corrupted as soon as `jinfo.skipped_makeflags` store got deallocated.
-
-This started causing bootstrap crashes in `execv()` calls:
-
-    xgcc: fatal error: cannot execute '/build/build/./prev-gcc/collect2': execv: Bad address
-
-The change restores memory allocation for `xputenv()` argument.
-
-gcc/
-
-	PR driver/106624
-	* gcc.c (driver::detect_jobserver): Allocate storage xputenv()
-	argument using xstrdup().
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -9182,7 +9182,7 @@ driver::detect_jobserver () const
- {
-   jobserver_info jinfo;
-   if (!jinfo.is_active && !jinfo.skipped_makeflags.empty ())
--    xputenv (jinfo.skipped_makeflags.c_str ());
-+    xputenv (xstrdup (jinfo.skipped_makeflags.c_str ()));
- }
- 
- /* Determine what the exit code of the driver should be.  */
--- 
-2.31.1

diff --git a/10.5.0/gentoo/README.history b/10.5.0/gentoo/README.history
index d721532..74ee905 100644
--- a/10.5.0/gentoo/README.history
+++ b/10.5.0/gentoo/README.history
@@ -1,3 +1,6 @@
+5		27 Jan 2022
+	- 77_all_driver_environ_putenv_PR106624.patch
+
 4		23 Jan 2022
 	+ 77_all_driver_environ_putenv_PR106624.patch
 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] proj/gcc-patches:master commit in: 10.5.0/gentoo/
@ 2023-04-28  0:07 Sam James
  0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2023-04-28  0:07 UTC (permalink / raw
  To: gentoo-commits

commit:     4e3415bb2e54c2b4ae6fe5b3ceb2b1a4253a011f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 28 00:00:31 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Apr 28 00:00:31 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=4e3415bb

10.5.0: add miscompilation patch (77_all_all_PR109585_13_rtl-alias-analysis-typo.patch)

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...l_all_PR109585_13_rtl-alias-analysis-typo.patch | 79 ++++++++++++++++++++++
 10.5.0/gentoo/README.history                       |  7 +-
 2 files changed, 84 insertions(+), 2 deletions(-)

diff --git a/10.5.0/gentoo/77_all_all_PR109585_13_rtl-alias-analysis-typo.patch b/10.5.0/gentoo/77_all_all_PR109585_13_rtl-alias-analysis-typo.patch
new file mode 100644
index 0000000..b7b57d6
--- /dev/null
+++ b/10.5.0/gentoo/77_all_all_PR109585_13_rtl-alias-analysis-typo.patch
@@ -0,0 +1,79 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109609
+https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=ef6051b36241bf130bf76af0b775248635dc616e
+
+From ef6051b36241bf130bf76af0b775248635dc616e Mon Sep 17 00:00:00 2001
+From: Richard Biener <rguenther@suse.de>
+Date: Mon, 24 Apr 2023 13:31:07 +0200
+Subject: [PATCH] rtl-optimization/109585 - alias analysis typo
+
+When r10-514-gc6b84edb6110dd2b4fb improved access path analysis
+it introduced a typo that triggers when there's an access to a
+trailing array in the first access path leading to false
+disambiguation.
+
+	PR rtl-optimization/109585
+	* tree-ssa-alias.c (aliasing_component_refs_p): Fix typo.
+
+	* gcc.dg/torture/pr109585.c: New testcase.
+
+(cherry picked from commit 6d4bd27a60447c7505cb4783e675e98a191a8904)
+---
+ gcc/testsuite/gcc.dg/torture/pr109585.c | 33 +++++++++++++++++++++++++
+ gcc/tree-ssa-alias.c                   |  2 +-
+ 2 files changed, 34 insertions(+), 1 deletion(-)
+ create mode 100644 gcc/testsuite/gcc.dg/torture/pr109585.c
+
+diff --git a/gcc/testsuite/gcc.dg/torture/pr109585.c b/gcc/testsuite/gcc.dg/torture/pr109585.c
+new file mode 100644
+index 00000000000..f92de7c1f2e
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/torture/pr109585.c
+@@ -0,0 +1,33 @@
++/* { dg-do run } */
++
++#include <stdlib.h>
++
++struct P {
++    long v;
++    struct P *n;
++};
++
++struct F {
++    long x;
++    struct P fam[];
++};
++
++int __attribute__((noipa))
++f(struct F *f, int i)
++{
++  struct P *p = f->fam;
++  asm("" : "+r"(f): "r"(p));
++  p->v = 0;
++  p->n = 0;
++  return f->fam->n != 0;
++}
++
++int
++main()
++{
++  struct F *m = malloc (sizeof (long) + 2 * sizeof (struct P));
++  m->fam[0].n = &m->fam[1];
++  if (f (m, 0))
++    abort ();
++  return 0;
++}
+diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
+index b1e7a2d5afc..be7b597266f 100644
+--- a/gcc/tree-ssa-alias.c
++++ b/gcc/tree-ssa-alias.c
+@@ -1326,7 +1326,7 @@ aliasing_component_refs_p (tree ref1,
+   /* If we didn't find a common base, try the other way around.  */
+   if (cmp_outer <= 0 
+       || (end_struct_ref1
+-	  && compare_type_sizes (TREE_TYPE (end_struct_ref1), type1) <= 0))
++	  && compare_type_sizes (TREE_TYPE (end_struct_ref1), type2) <= 0))
+     {
+       int res = aliasing_component_refs_walk (ref2, type2, base2,
+ 					      offset2, max_size2,
+-- 
+2.31.1

diff --git a/10.5.0/gentoo/README.history b/10.5.0/gentoo/README.history
index 74ee905..f848c9c 100644
--- a/10.5.0/gentoo/README.history
+++ b/10.5.0/gentoo/README.history
@@ -1,7 +1,10 @@
-5		27 Jan 2022
+6		28 Apr 2023
+	+ 77_all_all_PR109585_13_rtl-alias-analysis-typo.patch
+
+5		27 Jan 2023
 	- 77_all_driver_environ_putenv_PR106624.patch
 
-4		23 Jan 2022
+4		23 Jan 2023
 	+ 77_all_driver_environ_putenv_PR106624.patch
 
 3		17 Dec 2022


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-04-28  0:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-23  0:35 [gentoo-commits] proj/gcc-patches:master commit in: 10.5.0/gentoo/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2023-04-28  0:07 Sam James
2023-01-27  8:12 Sam James
2022-12-17  4:54 Sam James
2022-12-17  4:54 Sam James
2022-12-17  4:54 Sam James
2022-11-20  0:25 Sam James
2022-08-22  2:37 Sam James
2022-08-22  1:52 Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox