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

commit:     16b5f54a19fc4677331a35887dfbe99404041cc5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 22 01:35:56 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 22 01:41:31 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=16b5f54a

12.2.0: clone of 12.1.0

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

 12.2.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 ++
 12.2.0/gentoo/04_all_nossp-on-nostdlib.patch       |  27 +++
 12.2.0/gentoo/05_all_alpha-mieee-default.patch     |  39 ++++
 12.2.0/gentoo/06_all_ia64_note.GNU-stack.patch     |  92 +++++++++
 12.2.0/gentoo/07_all_libiberty-asprintf.patch      |  18 ++
 12.2.0/gentoo/08_all_libiberty-pic.patch           |  10 +
 12.2.0/gentoo/09_all_nopie-all-flags.patch         |  18 ++
 12.2.0/gentoo/10_all_sh-drop-sysroot-suffix.patch  |  32 ++++
 12.2.0/gentoo/11_all_ia64-TEXTREL.patch            |  22 +++
 .../gentoo/12_all_disable-systemtap-switch.patch   | 122 ++++++++++++
 12.2.0/gentoo/14_all_respect-build-cxxflags.patch  |  39 ++++
 12.2.0/gentoo/20_all_libstdcxx-no-vtv.patch        |  61 ++++++
 12.2.0/gentoo/22_all_default_ssp-buffer-size.patch |  14 ++
 12.2.0/gentoo/23_all_EXTRA_OPTIONS-z-now.patch     |  26 +++
 ...all_EXTRA_OPTIONS-fstack-clash-protection.patch |  65 +++++++
 .../25_all_lto-intl-workaround-PR95194.patch       |  20 ++
 12.2.0/gentoo/26_all_enable-cet.patch              | 206 +++++++++++++++++++++
 12.2.0/gentoo/27_all_plugin-objdump.patch          |  34 ++++
 12.2.0/gentoo/28_all_drop_CFLAGS_sed.patch         |  35 ++++
 12.2.0/gentoo/29_all_msgfmt-libstdc++-link.patch   |  39 ++++
 12.2.0/gentoo/README.history                       |  23 +++
 23 files changed, 999 insertions(+)

diff --git a/12.2.0/gentoo/01_all_default-fortify-source.patch b/12.2.0/gentoo/01_all_default-fortify-source.patch
new file mode 100644
index 0000000..d9f001a
--- /dev/null
+++ b/12.2.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.cc
++++ b/gcc/c-family/c-cppbuiltin.cc
+@@ -1510,6 +1510,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/12.2.0/gentoo/02_all_default-warn-format-security.patch b/12.2.0/gentoo/02_all_default-warn-format-security.patch
new file mode 100644
index 0000000..9723a1c
--- /dev/null
+++ b/12.2.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
+@@ -696,7 +696,7 @@ Warn about function calls with format strings that write past the end
+ 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
+@@ -717,7 +717,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++
+ 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/12.2.0/gentoo/03_all_default-warn-trampolines.patch b/12.2.0/gentoo/03_all_default-warn-trampolines.patch
new file mode 100644
index 0000000..fb6d8bc
--- /dev/null
+++ b/12.2.0/gentoo/03_all_default-warn-trampolines.patch
@@ -0,0 +1,13 @@
+Enable -Wtrampolines by default.
+
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -798,7 +798,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.
+ 
+ Wtrivial-auto-var-init

diff --git a/12.2.0/gentoo/04_all_nossp-on-nostdlib.patch b/12.2.0/gentoo/04_all_nossp-on-nostdlib.patch
new file mode 100644
index 0000000..b633d7f
--- /dev/null
+++ b/12.2.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.cc
++++ b/gcc/gcc.cc
+@@ -984,6 +984,12 @@ proper position among the other output files.  */
+ #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" \
+@@ -1280,7 +1286,7 @@ static const char *cc1_options =
+  %{-version:--version}\
+  %{-help=*:--help=%*}\
+  %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %w%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/12.2.0/gentoo/05_all_alpha-mieee-default.patch b/12.2.0/gentoo/05_all_alpha-mieee-default.patch
new file mode 100644
index 0000000..fd1de71
--- /dev/null
+++ b/12.2.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
+@@ -94,6 +94,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 RejectNegative Mask(IEEE)
++Target Mask(IEEE)
+ Emit IEEE-conformant code, without inexact exceptions.
+ 
+ mieee-with-inexact
+

diff --git a/12.2.0/gentoo/06_all_ia64_note.GNU-stack.patch b/12.2.0/gentoo/06_all_ia64_note.GNU-stack.patch
new file mode 100644
index 0000000..7a1d4c6
--- /dev/null
+++ b/12.2.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
+@@ -23,6 +23,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
+@@ -384,7 +384,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
+@@ -185,3 +185,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
+@@ -114,3 +114,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/12.2.0/gentoo/07_all_libiberty-asprintf.patch b/12.2.0/gentoo/07_all_libiberty-asprintf.patch
new file mode 100644
index 0000000..1ed2ba3
--- /dev/null
+++ b/12.2.0/gentoo/07_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
+@@ -652,8 +652,11 @@ extern void *bsearch_r (const void *, const void *,
+ /* 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/12.2.0/gentoo/08_all_libiberty-pic.patch b/12.2.0/gentoo/08_all_libiberty-pic.patch
new file mode 100644
index 0000000..3f0bae1
--- /dev/null
+++ b/12.2.0/gentoo/08_all_libiberty-pic.patch
@@ -0,0 +1,10 @@
+--- a/libiberty/Makefile.in
++++ b/libiberty/Makefile.in
+@@ -265,6 +265,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/12.2.0/gentoo/09_all_nopie-all-flags.patch b/12.2.0/gentoo/09_all_nopie-all-flags.patch
new file mode 100644
index 0000000..0f7c769
--- /dev/null
+++ b/12.2.0/gentoo/09_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
+@@ -1054,10 +1054,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/12.2.0/gentoo/10_all_sh-drop-sysroot-suffix.patch b/12.2.0/gentoo/10_all_sh-drop-sysroot-suffix.patch
new file mode 100644
index 0000000..fd3bda5
--- /dev/null
+++ b/12.2.0/gentoo/10_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
+@@ -3328,8 +3328,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/12.2.0/gentoo/11_all_ia64-TEXTREL.patch b/12.2.0/gentoo/11_all_ia64-TEXTREL.patch
new file mode 100644
index 0000000..69347f5
--- /dev/null
+++ b/12.2.0/gentoo/11_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.cc
++++ a/gcc/config/ia64/ia64.cc
+@@ -10840,12 +10840,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/12.2.0/gentoo/12_all_disable-systemtap-switch.patch b/12.2.0/gentoo/12_all_disable-systemtap-switch.patch
new file mode 100644
index 0000000..4d69141
--- /dev/null
+++ b/12.2.0/gentoo/12_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
+@@ -1015,6 +1015,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
+@@ -1773,6 +1774,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
+@@ -31387,17 +31389,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
+@@ -6904,14 +6904,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/12.2.0/gentoo/14_all_respect-build-cxxflags.patch b/12.2.0/gentoo/14_all_respect-build-cxxflags.patch
new file mode 100644
index 0000000..1f9a774
--- /dev/null
+++ b/12.2.0/gentoo/14_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
+@@ -176,6 +176,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.
+@@ -842,6 +843,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
+@@ -179,6 +179,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/12.2.0/gentoo/20_all_libstdcxx-no-vtv.patch b/12.2.0/gentoo/20_all_libstdcxx-no-vtv.patch
new file mode 100644
index 0000000..2719e2d
--- /dev/null
+++ b/12.2.0/gentoo/20_all_libstdcxx-no-vtv.patch
@@ -0,0 +1,61 @@
+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
+@@ -277,7 +277,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
+@@ -642,7 +642,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
+@@ -588,7 +588,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
+@@ -590,7 +590,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/12.2.0/gentoo/22_all_default_ssp-buffer-size.patch b/12.2.0/gentoo/22_all_default_ssp-buffer-size.patch
new file mode 100644
index 0000000..0e0dd42
--- /dev/null
+++ b/12.2.0/gentoo/22_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
+@@ -1012,7 +1012,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/12.2.0/gentoo/23_all_EXTRA_OPTIONS-z-now.patch b/12.2.0/gentoo/23_all_EXTRA_OPTIONS-z-now.patch
new file mode 100644
index 0000000..8874b32
--- /dev/null
+++ b/12.2.0/gentoo/23_all_EXTRA_OPTIONS-z-now.patch
@@ -0,0 +1,26 @@
+On Hardened we add some options like -z now
+
+--- a/gcc/gcc.cc
++++ b/gcc/gcc.cc
+@@ -1001,6 +1001,12 @@ proper position among the other output files.  */
+ #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"
+@@ -1161,7 +1167,7 @@ proper position among the other output files.  */
+     %(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/12.2.0/gentoo/24_all_EXTRA_OPTIONS-fstack-clash-protection.patch b/12.2.0/gentoo/24_all_EXTRA_OPTIONS-fstack-clash-protection.patch
new file mode 100644
index 0000000..e1b3c54
--- /dev/null
+++ b/12.2.0/gentoo/24_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
++++ a/gcc/common.opt
+@@ -2698,7 +2698,7 @@ Common Alias(fstack-check=, specific, no
+ Insert stack checking code into the program.  Same as -fstack-check=specific.
+ 
+ fstack-clash-protection
+-Common Var(flag_stack_clash_protection) Optimization
++Common 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
++++ b/gcc/defaults.h
+@@ -1425,6 +1425,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.cc
++++ b/gcc/toplev.cc
+@@ -1610,6 +1610,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
++++ b/libgcc/Makefile.in
+@@ -246,7 +246,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.
+@@ -302,7 +302,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/12.2.0/gentoo/25_all_lto-intl-workaround-PR95194.patch b/12.2.0/gentoo/25_all_lto-intl-workaround-PR95194.patch
new file mode 100644
index 0000000..9613216
--- /dev/null
+++ b/12.2.0/gentoo/25_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/12.2.0/gentoo/26_all_enable-cet.patch b/12.2.0/gentoo/26_all_enable-cet.patch
new file mode 100644
index 0000000..1d0c04f
--- /dev/null
+++ b/12.2.0/gentoo/26_all_enable-cet.patch
@@ -0,0 +1,206 @@
+https://bugs.gentoo.org/822036
+https://salsa.debian.org/toolchain-team/gcc/-/blob/master/debian/patches/gcc-distro-specs.diff
+
+From: Sam James <sam@gentoo.org>
+Subject: [PATCH] Enable CET (-fcf-protection=full) by default
+
+Needs:
+- CET to be enabled for GCC
+- -DEXTRA_OPTIONS_CF to be passed during build (via toolchain.eclass).
+
+  Only supported on amd64.
+--- a/gcc/cp/lang-specs.h
++++ b/gcc/cp/lang-specs.h
+@@ -51,7 +51,7 @@ along with GCC; see the file COPYING3.  If not see
+       " 	   %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}"
+       "  %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}"
+       "  %{fmodules-ts:-fmodule-header %{fpreprocessed:-fdirectives-only}}"
+-      "  %(cc1_options) %2"
++      "  %(cc1_options) %(default_flag_cf_spec) %2"
+       "  %{!fsyntax-only:"
+       "    %{!S:-o %g.s%V}"
+       "    %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:"
+@@ -72,7 +72,7 @@ along with GCC; see the file COPYING3.  If not see
+       "  %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}"
+       "  %{fmodules-ts:-fmodule-header=system"
+       "    %{fpreprocessed:-fdirectives-only}}"
+-      "  %(cc1_options) %2"
++      "  %(cc1_options) %(default_flag_cf_spec) %2"
+       "  %{!fsyntax-only:"
+       "    %{!S:-o %g.s%V}"
+       "    %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:"
+@@ -92,7 +92,7 @@ along with GCC; see the file COPYING3.  If not see
+       " 	   %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}"
+       "  %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}"
+       "  %{fmodules-ts:-fmodule-header=user %{fpreprocessed:-fdirectives-only}}"
+-      "  %(cc1_options) %2"
++      "  %(cc1_options) %(default_flag_cf_spec) %2"
+       "  %{!fsyntax-only:"
+       "    %{!S:-o %g.s%V}"
+       "    %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:"
+@@ -107,7 +107,7 @@ along with GCC; see the file COPYING3.  If not see
+       "  cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed"
+       " 	   %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}"
+       "  %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}"
+-      "  %(cc1_options) %2"
++      "  %(cc1_options) %(default_flag_cf_spec) %2"
+       "  %{!fsyntax-only:"
+       "    %{fmodule-only:%{!S:-o %g.s%V}}"
+       "    %{!fmodule-only:%(invoke_as)}}"
+@@ -116,7 +116,7 @@ along with GCC; see the file COPYING3.  If not see
+   {".ii", "@c++-cpp-output", 0, 0, 0},
+   {"@c++-cpp-output",
+       "%{!E:%{!M:%{!MM:"
+-      "  cc1plus -fpreprocessed %i %(cc1_options) %2"
++      "  cc1plus -fpreprocessed %i %(cc1_options) %(default_flag_cf_spec) %2"
+       "  %{!fsyntax-only:"
+       "    %{fmodule-only:%{!S:-o %g.s%V}}"
+       "    %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}"
+--- a/gcc/gcc.cc
++++ b/gcc/gcc.cc
+@@ -1007,6 +1007,18 @@ proper position among the other output files.  */
+ #define LINK_NOW_SPEC ""
+ #endif
+ 
++/* Default value for flag_cf_protection when flag_cf_protection is
++   initialized to CF_FULL.
++
++   We use a new option (EXTRA_OPTIONS_CF) here to avoid turning
++   this on accidentally for other arches. */
++#ifdef EXTRA_OPTIONS_CF
++#define DEFAULT_FLAG_CF_SPEC " %{!m16:%{!m32:%{!fcf-protection*:%{!fno-cf-protection:-fcf-protection}}}}"
++#endif
++#ifndef DEFAULT_FLAG_CF_SPEC
++#define DEFAULT_FLAG_CF_SPEC ""
++#endif
++
+ #ifdef ENABLE_DEFAULT_PIE
+ #define PIE_SPEC		"!no-pie"
+ #define NO_FPIE1_SPEC		"fno-pie"
+@@ -1209,6 +1221,7 @@ static const char *cpp_spec = CPP_SPEC;
+ static const char *cc1_spec = CC1_SPEC;
+ static const char *cc1plus_spec = CC1PLUS_SPEC;
+ static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
++static const char *default_flag_cf_spec = DEFAULT_FLAG_CF_SPEC;
+ static const char *link_ssp_spec = LINK_SSP_SPEC;
+ static const char *asm_spec = ASM_SPEC;
+ static const char *asm_final_spec = ASM_FINAL_SPEC;
+@@ -1267,7 +1280,7 @@ static const char *cpp_options =
+ "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
+  %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
+  %{!fno-working-directory:-fworking-directory}}} %{O*}\
+- %{undef} %{save-temps*:-fpch-preprocess}";
++ %{undef} %{save-temps*:-fpch-preprocess} %(default_flag_cf_spec)";
+ 
+ /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
+ 
+@@ -1456,9 +1469,9 @@ static const struct compiler default_compilers[] =
+       %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
+ 	  %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\
+ 	    cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
+-	  %(cc1_options)}\
++	  %(cc1_options)%(default_flag_cf_spec)}\
+       %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\
+-	  cc1 %(cpp_unique_options) %(cc1_options)}}}\
++	  cc1 %(cpp_unique_options) %(cc1_options) %(default_flag_cf_spec)}}}\
+       %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 1},
+   {"-",
+    "%{!E:%e-E or -x required when input is from standard input}\
+@@ -1472,18 +1485,18 @@ static const struct compiler default_compilers[] =
+ 	  %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
+ 		%(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\
+ 		    cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
+-			%(cc1_options)\
++			%(cc1_options) %(default_flag_cf_spec)\
+ 			%{!fsyntax-only:%{!S:-o %g.s} \
+ 			    %{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}\
+ 					       %W{o*:--output-pch=%*}}%V}}\
+ 	  %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\
+-		cc1 %(cpp_unique_options) %(cc1_options)\
++		cc1 %(cpp_unique_options) %(cc1_options) %(default_flag_cf_spec)\
+ 		    %{!fsyntax-only:%{!S:-o %g.s} \
+ 		        %{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}\
+ 					   %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
+   {".i", "@cpp-output", 0, 0, 0},
+   {"@cpp-output",
+-   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
++   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %(default_flag_cf_spec) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+   {".s", "@assembler", 0, 0, 0},
+   {"@assembler",
+    "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
+@@ -1715,6 +1728,7 @@ static struct spec_list static_specs[] =
+   INIT_STATIC_SPEC ("cc1_options",		&cc1_options),
+   INIT_STATIC_SPEC ("cc1plus",			&cc1plus_spec),
+   INIT_STATIC_SPEC ("link_gcc_c_sequence",	&link_gcc_c_sequence_spec),
++  INIT_STATIC_SPEC ("default_flag_cf_spec",     &default_flag_cf_spec),
+   INIT_STATIC_SPEC ("link_ssp",			&link_ssp_spec),
+   INIT_STATIC_SPEC ("endfile",			&endfile_spec),
+   INIT_STATIC_SPEC ("link",			&link_spec),
+--- a/gcc/objc/lang-specs.h
++++ b/gcc/objc/lang-specs.h
+@@ -29,9 +29,9 @@ along with GCC; see the file COPYING3.  If not see
+ 	%{traditional|traditional-cpp:\
+ %eGNU Objective C no longer supports traditional compilation}\
+ 	%{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
+-	    cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}\
++	    cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %(default_flag_cf_spec) %{print-objc-runtime-info} %{gen-decls}}\
+ 	%{!save-temps*:%{!no-integrated-cpp:\
+-	    cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}}\
++	    cc1obj %(cpp_unique_options) %(cc1_options) %(default_flag_cf_spec) %{print-objc-runtime-info} %{gen-decls}}}\
+         %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+   {"@objective-c-header",
+      "%{E|M|MM:cc1obj -E %{traditional|traditional-cpp:-traditional-cpp}\
+@@ -40,18 +40,18 @@ along with GCC; see the file COPYING3.  If not see
+ 	%{traditional|traditional-cpp:\
+ %eGNU Objective C no longer supports traditional compilation}\
+ 	%{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
+-	    cc1obj -fpreprocessed %b.mi %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
++	    cc1obj -fpreprocessed %b.mi %(cc1_options) %(default_flag_cf_spec) %{print-objc-runtime-info} %{gen-decls}\
+                         -o %g.s %{!o*:--output-pch=%i.gch}\
+                         %W{o*:--output-pch=%*}%V}\
+ 	%{!save-temps*:%{!no-integrated-cpp:\
+-	    cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
++	    cc1obj %(cpp_unique_options) %(cc1_options) %(default_flag_cf_spec) %{print-objc-runtime-info} %{gen-decls}\
+                         -o %g.s %{!o*:--output-pch=%i.gch}\
+                         %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0},
+   {".mi", "@objective-c-cpp-output", 0, 0, 0},
+   {"@objective-c-cpp-output",
+-     "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
++     "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(default_flag_cf_spec) %{print-objc-runtime-info} %{gen-decls}\
+ 			     %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+   {"@objc-cpp-output",
+       "%nobjc-cpp-output is deprecated; please use objective-c-cpp-output instead\n\
+-       %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
++       %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(default_flag_cf_spec) %{print-objc-runtime-info} %{gen-decls}\
+ 			     %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+--- a/gcc/objcp/lang-specs.h
++++ b/gcc/objcp/lang-specs.h
+@@ -36,7 +36,7 @@ along with GCC; see the file COPYING3.  If not see
+ 		%(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
+       cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
+ 	      %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
+-	%(cc1_options) %2\
++	%(cc1_options) %(default_flag_cf_spec) %2\
+         -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
+      CPLUSPLUS_CPP_SPEC, 0, 0},
+   {"@objective-c++",
+@@ -46,16 +46,16 @@ along with GCC; see the file COPYING3.  If not see
+ 		%(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
+       cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
+ 	      %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
+-	%(cc1_options) %2\
++	%(cc1_options) %(default_flag_cf_spec) %2\
+        %{!fsyntax-only:%(invoke_as)}}}}",
+      CPLUSPLUS_CPP_SPEC, 0, 0},
+   {".mii", "@objective-c++-cpp-output", 0, 0, 0},
+   {"@objective-c++-cpp-output",
+    "%{!M:%{!MM:%{!E:\
+-    cc1objplus -fpreprocessed %i %(cc1_options) %2\
++    cc1objplus -fpreprocessed %i %(cc1_options) %(default_flag_cf_spec) %2\
+     %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+   {"@objc++-cpp-output",
+    "%nobjc++-cpp-output is deprecated; please use objective-c++-cpp-output instead\n\
+     %{!M:%{!MM:%{!E:\
+-    cc1objplus -fpreprocessed %i %(cc1_options) %2\
++    cc1objplus -fpreprocessed %i %(cc1_options) %(default_flag_cf_spec) %2\
+     %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},

diff --git a/12.2.0/gentoo/27_all_plugin-objdump.patch b/12.2.0/gentoo/27_all_plugin-objdump.patch
new file mode 100644
index 0000000..059bca5
--- /dev/null
+++ b/12.2.0/gentoo/27_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
+@@ -32075,7 +32075,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
+@@ -15034,7 +15034,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/12.2.0/gentoo/28_all_drop_CFLAGS_sed.patch b/12.2.0/gentoo/28_all_drop_CFLAGS_sed.patch
new file mode 100644
index 0000000..764f34c
--- /dev/null
+++ b/12.2.0/gentoo/28_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
+@@ -5388,13 +5388,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
+@@ -440,13 +440,6 @@ ACX_PROG_GDC([-I"$srcdir"/d])
+ # 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)
+ AC_SUBST(GDCFLAGS)

diff --git a/12.2.0/gentoo/29_all_msgfmt-libstdc++-link.patch b/12.2.0/gentoo/29_all_msgfmt-libstdc++-link.patch
new file mode 100644
index 0000000..0d2f113
--- /dev/null
+++ b/12.2.0/gentoo/29_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/12.2.0/gentoo/README.history b/12.2.0/gentoo/README.history
new file mode 100644
index 0000000..40cbcb6
--- /dev/null
+++ b/12.2.0/gentoo/README.history
@@ -0,0 +1,23 @@
+1		22 Aug 2022
+	+ 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_libiberty-asprintf.patch
+	+ 08_all_libiberty-pic.patch
+	+ 09_all_nopie-all-flags.patch
+	+ 10_all_sh-drop-sysroot-suffix.patch
+	+ 11_all_ia64-TEXTREL.patch
+	+ 12_all_disable-systemtap-switch.patch
+	+ 14_all_respect-build-cxxflags.patch
+	+ 20_all_libstdcxx-no-vtv.patch
+	+ 22_all_default_ssp-buffer-size.patch
+	+ 23_all_EXTRA_OPTIONS-z-now.patch
+	+ 24_all_EXTRA_OPTIONS-fstack-clash-protection.patch
+	+ 25_all_lto-intl-workaround-PR95194.patch
+	+ 26_all_enable-cet.patch
+	+ 27_all_plugin-objdump.patch
+	+ 28_all_drop_CFLAGS_sed.patch
+	+ 29_all_msgfmt-libstdc++-link.patch


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

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

commit:     54f6fbbd7723ed3605381c1b8e2bed473e409aa8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 22 01:36:41 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 22 01:41:31 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=54f6fbbd

12.2.0: add 75_all_go_posix_shell_arithmetic_nonbash.patch

Fix build w/ USE=go with /bin/sh not being bash.

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

 .../75_all_go_posix_shell_arithmetic_nonbash.patch | 40 ++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/12.2.0/gentoo/75_all_go_posix_shell_arithmetic_nonbash.patch b/12.2.0/gentoo/75_all_go_posix_shell_arithmetic_nonbash.patch
new file mode 100644
index 0000000..57e9060
--- /dev/null
+++ b/12.2.0/gentoo/75_all_go_posix_shell_arithmetic_nonbash.patch
@@ -0,0 +1,40 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=cf1725610526fe347d2530455b32affc033fd7fc
+
+From cf1725610526fe347d2530455b32affc033fd7fc Mon Sep 17 00:00:00 2001
+From: Ian Lance Taylor <iant@golang.org>
+Date: Fri, 22 Jul 2022 11:38:20 -0700
+Subject: [PATCH] libgo: use POSIX shell arithmetic expansion
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf8
+Content-Transfer-Encoding: 8bit
+
+Avoid bash-specific ((expression)) syntax.  As the bash syntax
+converts a non-zero value to a zero status (and a zero value to a 1
+status), and POSIX arithmetic expansion does not, we have to negate
+the result.
+
+Based on patch by Sören Tempel.
+
+Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/419154
+--- a/libgo/match.sh
++++ b/libgo/match.sh
+@@ -111,7 +111,7 @@ gobuild() {
+     if test "$goarch" != "386"; then
+ 	line=$(echo "$line" | sed -e "s/\\(${wrap}\\)386\\(${wrap}\\)/\10\2/g")
+     fi
+-    (($line))
++    return $((!($line)))
+ }
+ 
+ matched=
+--- a/libgo/testsuite/gotest
++++ b/libgo/testsuite/gotest
+@@ -302,7 +302,7 @@ gobuild() {
+     if test "$goarch" != "386"; then
+ 	line=$(echo "$line" | sed -e "s/\\(${wrap}\\)386\\(${wrap}\\)/\10\2/g")
+     fi
+-    (($line))
++    return $((!($line)))
+ }
+ 
+ case "x$gofiles" in


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

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

commit:     eb7543b82e4eb60e2fd0aec3c5c4908b7656d596
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 19 23:43:49 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=eb7543b8

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

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

 ..._all_libsanitizer-implicit-function-decls.patch |  35 +++++++
 ...7_all_libiberty-fix-c89-isms-in-configure.patch | 105 +++++++++++++++++++++
 12.2.0/gentoo/README.history                       |   4 +
 3 files changed, 144 insertions(+)

diff --git a/12.2.0/gentoo/76_all_libsanitizer-implicit-function-decls.patch b/12.2.0/gentoo/76_all_libsanitizer-implicit-function-decls.patch
new file mode 100644
index 0000000..8131cf8
--- /dev/null
+++ b/12.2.0/gentoo/76_all_libsanitizer-implicit-function-decls.patch
@@ -0,0 +1,35 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=6be2672e4ee41c566a9e072088cccca263bab5f7
+
+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.
+--- a/libsanitizer/configure
++++ b/libsanitizer/configure
+@@ -16028,6 +16028,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
+@@ -161,7 +161,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/12.2.0/gentoo/77_all_libiberty-fix-c89-isms-in-configure.patch b/12.2.0/gentoo/77_all_libiberty-fix-c89-isms-in-configure.patch
new file mode 100644
index 0000000..ed13d2c
--- /dev/null
+++ b/12.2.0/gentoo/77_all_libiberty-fix-c89-isms-in-configure.patch
@@ -0,0 +1,105 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=885b6660c17fb91980b5682514ef54668e544b02
+
+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/acinclude.m4
++++ b/libiberty/acinclude.m4
+@@ -24,6 +24,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
+@@ -51,7 +53,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;
+@@ -157,7 +160,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;
+@@ -169,7 +175,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
+@@ -6780,7 +6780,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;
+@@ -6792,7 +6795,9 @@ find_stack_direction ()
+   else
+     return (&dummy > addr) ? 1 : -1;
+ }
+-main ()
++
++int
++main (void)
+ {
+   exit (find_stack_direction() < 0);
+ }
+@@ -7617,6 +7622,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
+@@ -7644,7 +7651,8 @@ else
+ 
+ #define MAP_LEN 0x10000
+ 
+-main ()
++int
++main (void)
+ {
+ #if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
+   char *p;

diff --git a/12.2.0/gentoo/README.history b/12.2.0/gentoo/README.history
index 40cbcb6..c3b2413 100644
--- a/12.2.0/gentoo/README.history
+++ b/12.2.0/gentoo/README.history
@@ -1,3 +1,7 @@
+2		19 Nov 2022
+	+ 76_all_libsanitizer-implicit-function-decls.patch
+	+ 77_all_libiberty-fix-c89-isms-in-configure.patch
+
 1		22 Aug 2022
 	+ 01_all_default-fortify-source.patch
 	+ 02_all_default-warn-format-security.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 12.2.0/gentoo/
@ 2022-12-05  0:18 Andreas K. Hüttel
  0 siblings, 0 replies; 17+ messages in thread
From: Andreas K. Hüttel @ 2022-12-05  0:18 UTC (permalink / raw
  To: gentoo-commits

commit:     8ffd428773f8e1e6af99fcf1aa58d4339b761a9c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Dec  5 00:17:32 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Dec  5 00:17:32 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8ffd4287

12.2.0: Move -z now and -fstack-clash-protection out of EXTRA_OPTIONS

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...EXTRA_OPTIONS-z-now.patch => 23_all_DEF_GENTOO_ZNOW-z-now.patch} | 4 ++--
 ...on.patch => 24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch} | 4 ++--
 12.2.0/gentoo/README.history                                        | 6 ++++++
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/12.2.0/gentoo/23_all_EXTRA_OPTIONS-z-now.patch b/12.2.0/gentoo/23_all_DEF_GENTOO_ZNOW-z-now.patch
similarity index 91%
rename from 12.2.0/gentoo/23_all_EXTRA_OPTIONS-z-now.patch
rename to 12.2.0/gentoo/23_all_DEF_GENTOO_ZNOW-z-now.patch
index 8874b32..2ed7968 100644
--- a/12.2.0/gentoo/23_all_EXTRA_OPTIONS-z-now.patch
+++ b/12.2.0/gentoo/23_all_DEF_GENTOO_ZNOW-z-now.patch
@@ -1,4 +1,4 @@
-On Hardened we add some options like -z now
+If requested we add -z now
 
 --- a/gcc/gcc.cc
 +++ b/gcc/gcc.cc
@@ -6,7 +6,7 @@ On Hardened we add some options like -z now
  #endif
  #endif
  
-+#ifdef EXTRA_OPTIONS
++#ifdef DEF_GENTOO_ZNOW
 +#define LINK_NOW_SPEC "%{!nonow:-z now} "
 +#else
 +#define LINK_NOW_SPEC ""

diff --git a/12.2.0/gentoo/24_all_EXTRA_OPTIONS-fstack-clash-protection.patch b/12.2.0/gentoo/24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch
similarity index 96%
rename from 12.2.0/gentoo/24_all_EXTRA_OPTIONS-fstack-clash-protection.patch
rename to 12.2.0/gentoo/24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch
index e1b3c54..1ed716b 100644
--- a/12.2.0/gentoo/24_all_EXTRA_OPTIONS-fstack-clash-protection.patch
+++ b/12.2.0/gentoo/24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch
@@ -1,4 +1,4 @@
-On Hardened we add some options like -fstack-clash-protection.
+We add -fstack-clash-protection if requested
 
 --- a/gcc/common.opt
 +++ a/gcc/common.opt
@@ -19,7 +19,7 @@ On Hardened we add some options like -fstack-clash-protection.
  
 +/* Default value for flag_clash_protector when flag_clash_protector is
 +   initialized to -1.  */
-+#ifdef EXTRA_OPTIONS
++#ifdef DEF_GENTOO_SCP
 +#define DEFAULT_FLAG_SCP 1
 +#endif
 +#ifndef DEFAULT_FLAG_SCP

diff --git a/12.2.0/gentoo/README.history b/12.2.0/gentoo/README.history
index c3b2413..a78f0e3 100644
--- a/12.2.0/gentoo/README.history
+++ b/12.2.0/gentoo/README.history
@@ -1,3 +1,9 @@
+	- 23_all_EXTRA_OPTIONS-z-now.patch
+	+ 23_all_DEF_GENTOO_ZNOW-z-now.patch
+	- 24_all_EXTRA_OPTIONS-fstack-clash-protection.patch
+	+ 24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch
+
+
 2		19 Nov 2022
 	+ 76_all_libsanitizer-implicit-function-decls.patch
 	+ 77_all_libiberty-fix-c89-isms-in-configure.patch


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

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

commit:     98c1d96dbf03d704e546810c9fa14fe8edc402c2
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Dec  5 00:23:56 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Dec  5 00:23:56 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=98c1d96d

12.2.0: cut patchset 3

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

 12.2.0/gentoo/README.history | 1 +
 1 file changed, 1 insertion(+)

diff --git a/12.2.0/gentoo/README.history b/12.2.0/gentoo/README.history
index a78f0e3..f1a7d9c 100644
--- a/12.2.0/gentoo/README.history
+++ b/12.2.0/gentoo/README.history
@@ -1,3 +1,4 @@
+3		5 Dec 2022
 	- 23_all_EXTRA_OPTIONS-z-now.patch
 	+ 23_all_DEF_GENTOO_ZNOW-z-now.patch
 	- 24_all_EXTRA_OPTIONS-fstack-clash-protection.patch


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

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

commit:     f91690729a34d00f90b7303a51f7952105696196
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec  9 11:04:30 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec  9 11:24:01 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=f9169072

12.2: backport make 4.4 jobserver fixes

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

 .../78_all_Factor-out-jobserver_active_p.patch     | 301 +++++++++++++++++++++
 ...-jobserver-style-fifo-for-recent-GNU-make.patch |  73 +++++
 ...spect-jobserver-in-parallel-WPA-streaming.patch | 237 ++++++++++++++++
 ...ix-fifo-mode-by-opening-pipe-in-proper-mo.patch |  37 +++
 12.2.0/gentoo/README.history                       |   7 +-
 5 files changed, 654 insertions(+), 1 deletion(-)

diff --git a/12.2.0/gentoo/78_all_Factor-out-jobserver_active_p.patch b/12.2.0/gentoo/78_all_Factor-out-jobserver_active_p.patch
new file mode 100644
index 0000000..b2f53f2
--- /dev/null
+++ b/12.2.0/gentoo/78_all_Factor-out-jobserver_active_p.patch
@@ -0,0 +1,301 @@
+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
+
+From 5037b72e71bac3bf15b16597e149601930094d4f 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/4] 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.
+---
+ gcc/gcc.cc           | 38 +++++---------------------------------
+ gcc/lto-wrapper.cc   | 44 +++++++++-----------------------------------
+ gcc/opts-common.cc   | 41 +++++++++++++++++++++++++++++++++++++++++
+ gcc/opts-jobserver.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 99 insertions(+), 68 deletions(-)
+ create mode 100644 gcc/opts-jobserver.h
+
+diff --git a/gcc/gcc.cc b/gcc/gcc.cc
+index bb07cc244e3..5699d3b51e5 100644
+--- a/gcc/gcc.cc
++++ b/gcc/gcc.cc
+@@ -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"
+@@ -42,7 +43,7 @@ compilation is specified by a string called a "spec".  */
+ #include "flags.h"
+ #include "opts.h"
+ #include "filenames.h"
+-#include "spellcheck.h"
++#include "opts-jobserver.h"
+ 
+ \f
+ 
+@@ -9178,38 +9179,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.  */
+diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc
+index d070829bacb..9fede90c277 100644
+--- a/gcc/lto-wrapper.cc
++++ b/gcc/lto-wrapper.cc
+@@ -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"
+@@ -49,6 +50,8 @@ along with GCC; see the file COPYING3.  If not see
+ #include "lto-section-names.h"
+ #include "collect-utils.h"
+ #include "opts-diagnostic.h"
++#include "opt-suggestions.h"
++#include "opts-jobserver.h"
+ 
+ /* Environment variable, used for passing the names of offload targets from GCC
+    driver to lto-wrapper.  */
+@@ -1336,35 +1339,6 @@ init_num_threads (void)
+ #endif
+ }
+ 
+-/* Test and return reason why a jobserver cannot be detected.  */
+-
+-static const char *
+-jobserver_active_p (void)
+-{
+-  #define JS_PREFIX "jobserver is not available: "
+-  #define JS_NEEDLE "--jobserver-auth="
+-
+-  const char *makeflags = getenv ("MAKEFLAGS");
+-  if (makeflags == NULL)
+-    return JS_PREFIX "%<MAKEFLAGS%> environment variable is unset";
+-
+-  const char *n = strstr (makeflags, JS_NEEDLE);
+-  if (n == NULL)
+-    return JS_PREFIX "%<" JS_NEEDLE "%> is not present in %<MAKEFLAGS%>";
+-
+-  int rfd = -1;
+-  int wfd = -1;
+-
+-  if (sscanf (n + strlen (JS_NEEDLE), "%d,%d", &rfd, &wfd) == 2
+-      && rfd > 0
+-      && wfd > 0
+-      && is_valid_fd (rfd)
+-      && is_valid_fd (wfd))
+-    return NULL;
+-  else
+-    return JS_PREFIX "cannot access %<" JS_NEEDLE "%> file descriptors";
+-}
+-
+ /* Print link to -flto documentation with a hint message.  */
+ 
+ void
+@@ -1422,7 +1396,6 @@ run_gcc (unsigned argc, char *argv[])
+   bool jobserver_requested = false;
+   int auto_parallel = 0;
+   bool no_partition = false;
+-  const char *jobserver_error = NULL;
+   bool fdecoded_options_first = true;
+   vec<cl_decoded_option> fdecoded_options;
+   fdecoded_options.create (16);
+@@ -1654,14 +1627,14 @@ run_gcc (unsigned argc, char *argv[])
+     }
+   else
+     {
+-      jobserver_error = jobserver_active_p ();
+-      if (jobserver && jobserver_error != NULL)
++      jobserver_info jinfo;
++      if (jobserver && !jinfo.is_active)
+ 	{
+ 	  /* Fall back to auto parallelism.  */
+ 	  jobserver = 0;
+ 	  auto_parallel = 1;
+ 	}
+-      else if (!jobserver && jobserver_error == NULL)
++      else if (!jobserver && jinfo.is_active)
+ 	{
+ 	  parallel = 1;
+ 	  jobserver = 1;
+@@ -1976,9 +1949,10 @@ cont:
+ 
+       if (nr > 1)
+ 	{
+-	  if (jobserver_requested && jobserver_error != NULL)
++	  jobserver_info jinfo;
++	  if (jobserver_requested && !jinfo.is_active)
+ 	    {
+-	      warning (0, jobserver_error);
++	      warning (0, jinfo.error_msg.c_str ());
+ 	      print_lto_docs_link ();
+ 	    }
+ 	  else if (parallel == 0)
+diff --git a/gcc/opts-common.cc b/gcc/opts-common.cc
+index 1663be1f602..8a4d32de3e5 100644
+--- a/gcc/opts-common.cc
++++ b/gcc/opts-common.cc
+@@ -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 *);
+ 
+@@ -2003,3 +2005,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;
++}
+diff --git a/gcc/opts-jobserver.h b/gcc/opts-jobserver.h
+new file mode 100644
+index 00000000000..68ce188b84a
+--- /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/12.2.0/gentoo/79_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch b/12.2.0/gentoo/79_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch
new file mode 100644
index 0000000..7cf09ed
--- /dev/null
+++ b/12.2.0/gentoo/79_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch
@@ -0,0 +1,73 @@
+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
+
+From 3e8b90a00ddfe9cbf5416842b19b84b1ab561e08 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/4] 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.
+---
+ gcc/opts-common.cc   | 17 +++++++++++++++--
+ gcc/opts-jobserver.h |  2 ++
+ 2 files changed, 17 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/opts-common.cc b/gcc/opts-common.cc
+index 8a4d32de3e5..7c07d504696 100644
+--- a/gcc/opts-common.cc
++++ b/gcc/opts-common.cc
+@@ -2008,8 +2008,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)
+@@ -2018,8 +2024,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)
+diff --git a/gcc/opts-jobserver.h b/gcc/opts-jobserver.h
+index 68ce188b84a..98ea2579962 100644
+--- 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/12.2.0/gentoo/80_all_lto-respect-jobserver-in-parallel-WPA-streaming.patch b/12.2.0/gentoo/80_all_lto-respect-jobserver-in-parallel-WPA-streaming.patch
new file mode 100644
index 0000000..39ce61e
--- /dev/null
+++ b/12.2.0/gentoo/80_all_lto-respect-jobserver-in-parallel-WPA-streaming.patch
@@ -0,0 +1,237 @@
+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=fed766af32ed6cd371016cc24e931131e19b4eb1
+
+From e8b2576a98e7c8ce374c179cd650f1f9422ec1ca Mon Sep 17 00:00:00 2001
+From: Martin Liska <mliska@suse.cz>
+Date: Tue, 9 Aug 2022 13:59:39 +0200
+Subject: [PATCH 3/4] lto: respect jobserver in parallel WPA streaming
+
+	PR lto/106328
+
+gcc/ChangeLog:
+
+	* opts-jobserver.h (struct jobserver_info): Add pipefd.
+	(jobserver_info::connect): New.
+	(jobserver_info::disconnect): Likewise.
+	(jobserver_info::get_token): Likewise.
+	(jobserver_info::return_token): Likewise.
+	* opts-common.cc: Implement the new functions.
+
+gcc/lto/ChangeLog:
+
+	* lto.cc (wait_for_child): Decrement nruns once a process
+	finishes.
+	(stream_out_partitions): Use job server if active.
+	(do_whole_program_analysis): Likewise.
+---
+ gcc/lto/lto.cc       | 58 +++++++++++++++++++++++++++++++++-----------
+ gcc/opts-common.cc   | 40 ++++++++++++++++++++++++++++++
+ gcc/opts-jobserver.h | 14 +++++++++++
+ 3 files changed, 98 insertions(+), 14 deletions(-)
+
+diff --git a/gcc/lto/lto.cc b/gcc/lto/lto.cc
+index 31b0c1862f7..c82307f4f7e 100644
+--- a/gcc/lto/lto.cc
++++ b/gcc/lto/lto.cc
+@@ -18,6 +18,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 "coretypes.h"
+@@ -54,11 +55,17 @@ along with GCC; see the file COPYING3.  If not see
+ #include "attribs.h"
+ #include "builtins.h"
+ #include "lto-common.h"
++#include "opts-jobserver.h"
+ 
+-
+-/* Number of parallel tasks to run, -1 if we want to use GNU Make jobserver.  */
++/* Number of parallel tasks to run.  */
+ static int lto_parallelism;
+ 
++/* Number of active WPA streaming processes.  */
++static int nruns = 0;
++
++/* GNU make's jobserver info.  */
++static jobserver_info *jinfo = NULL;
++
+ /* Return true when NODE has a clone that is analyzed (i.e. we need
+    to load its body even if the node itself is not needed).  */
+ 
+@@ -205,6 +212,12 @@ wait_for_child ()
+ 		     "streaming subprocess was killed by signal");
+     }
+   while (!WIFEXITED (status) && !WIFSIGNALED (status));
++
++    --nruns;
++
++    /* Return token to the jobserver if active.  */
++    if (jinfo != NULL && jinfo->is_active)
++      jinfo->return_token ();
+ }
+ #endif
+ 
+@@ -228,25 +241,35 @@ stream_out_partitions (char *temp_filename, int blen, int min, int max,
+ 		       bool ARG_UNUSED (last))
+ {
+ #ifdef HAVE_WORKING_FORK
+-  static int nruns;
+-
+   if (lto_parallelism <= 1)
+     {
+       stream_out_partitions_1 (temp_filename, blen, min, max);
+       return;
+     }
+ 
+-  /* Do not run more than LTO_PARALLELISM streamings
+-     FIXME: we ignore limits on jobserver.  */
+   if (lto_parallelism > 0 && nruns >= lto_parallelism)
+-    {
+-      wait_for_child ();
+-      nruns --;
+-    }
++    wait_for_child ();
++
+   /* If this is not the last parallel partition, execute new
+      streaming process.  */
+   if (!last)
+     {
++      if (jinfo != NULL && jinfo->is_active)
++	while (true)
++	  {
++	    if (jinfo->get_token ())
++	      break;
++	    if (nruns > 0)
++	      wait_for_child ();
++	    else
++	      {
++		/* There are no free tokens, lets do the job outselves.  */
++		stream_out_partitions_1 (temp_filename, blen, min, max);
++		asm_nodes_output = true;
++		return;
++	      }
++	  }
++
+       pid_t cpid = fork ();
+ 
+       if (!cpid)
+@@ -264,10 +287,12 @@ stream_out_partitions (char *temp_filename, int blen, int min, int max,
+   /* Last partition; stream it and wait for all children to die.  */
+   else
+     {
+-      int i;
+       stream_out_partitions_1 (temp_filename, blen, min, max);
+-      for (i = 0; i < nruns; i++)
++      while (nruns > 0)
+ 	wait_for_child ();
++
++      if (jinfo != NULL && jinfo->is_active)
++	jinfo->disconnect ();
+     }
+   asm_nodes_output = true;
+ #else
+@@ -460,9 +485,14 @@ do_whole_program_analysis (void)
+ 
+   lto_parallelism = 1;
+ 
+-  /* TODO: jobserver communication is not supported, yet.  */
+   if (!strcmp (flag_wpa, "jobserver"))
+-    lto_parallelism = param_max_lto_streaming_parallelism;
++    {
++      jinfo = new jobserver_info ();
++      if (jinfo->is_active)
++	jinfo->connect ();
++
++      lto_parallelism = param_max_lto_streaming_parallelism;
++    }
+   else
+     {
+       lto_parallelism = atoi (flag_wpa);
+diff --git a/gcc/opts-common.cc b/gcc/opts-common.cc
+index 7c07d504696..eed0eb7b799 100644
+--- a/gcc/opts-common.cc
++++ b/gcc/opts-common.cc
+@@ -2057,3 +2057,43 @@ jobserver_info::jobserver_info ()
+   if (!error_msg.empty ())
+     error_msg = "jobserver is not available: " + error_msg;
+ }
++
++void
++jobserver_info::connect ()
++{
++  if (!pipe_path.empty ())
++    pipefd = open (pipe_path.c_str (), O_RDWR);
++}
++
++void
++jobserver_info::disconnect ()
++{
++  if (!pipe_path.empty ())
++    {
++      gcc_assert (close (pipefd) == 0);
++      pipefd = -1;
++    }
++}
++
++bool
++jobserver_info::get_token ()
++{
++  int fd = pipe_path.empty () ? rfd : pipefd;
++  char c;
++  unsigned n = read (fd, &c, 1);
++  if (n != 1)
++    {
++      gcc_assert (errno == EAGAIN);
++      return false;
++    }
++  else
++    return true;
++}
++
++void
++jobserver_info::return_token ()
++{
++  int fd = pipe_path.empty () ? wfd : pipefd;
++  char c = 'G';
++  gcc_assert (write (fd, &c, 1) == 1);
++}
+diff --git a/gcc/opts-jobserver.h b/gcc/opts-jobserver.h
+index 98ea2579962..76c1d9b2882 100644
+--- a/gcc/opts-jobserver.h
++++ b/gcc/opts-jobserver.h
+@@ -29,6 +29,18 @@ struct jobserver_info
+   /* Default constructor.  */
+   jobserver_info ();
+ 
++  /* Connect to the server.  */
++  void connect ();
++
++  /* Disconnect from the server.  */
++  void disconnect ();
++
++  /* Get token from the server.  */
++  bool get_token ();
++
++  /* Return token to the server.  */
++  void return_token ();
++
+   /* Error message if there is a problem.  */
+   string error_msg = "";
+   /* Skipped MAKEFLAGS where --jobserver-auth is skipped.  */
+@@ -39,6 +51,8 @@ struct jobserver_info
+   int wfd = -1;
+   /* Named pipe path.  */
+   string pipe_path = "";
++  /* Pipe file descriptor.  */
++  int pipefd = -1;
+   /* Return true if jobserver is active.  */
+   bool is_active = false;
+ };
+-- 
+2.38.1
+

diff --git a/12.2.0/gentoo/81_all_jobserver-fix-fifo-mode-by-opening-pipe-in-proper-mo.patch b/12.2.0/gentoo/81_all_jobserver-fix-fifo-mode-by-opening-pipe-in-proper-mo.patch
new file mode 100644
index 0000000..ab63fe6
--- /dev/null
+++ b/12.2.0/gentoo/81_all_jobserver-fix-fifo-mode-by-opening-pipe-in-proper-mo.patch
@@ -0,0 +1,37 @@
+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=3f1c2f89f6b8b8d23a9072f8549b0a2c1de06b03
+
+From 9474892bb967747637d7f4e45320a93e726824c3 Mon Sep 17 00:00:00 2001
+From: Martin Liska <mliska@suse.cz>
+Date: Tue, 16 Aug 2022 08:22:29 +0200
+Subject: [PATCH 4/4] jobserver: fix fifo mode by opening pipe in proper mode
+
+The current jobserver_info relies on non-blocking FDs,
+thus one the pipe in such mode.
+
+gcc/ChangeLog:
+
+	* opts-common.cc (jobserver_info::connect): Open fifo
+	in non-blocking mode.
+---
+ gcc/opts-common.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gcc/opts-common.cc b/gcc/opts-common.cc
+index eed0eb7b799..98eb112cf68 100644
+--- a/gcc/opts-common.cc
++++ b/gcc/opts-common.cc
+@@ -2062,7 +2062,7 @@ void
+ jobserver_info::connect ()
+ {
+   if (!pipe_path.empty ())
+-    pipefd = open (pipe_path.c_str (), O_RDWR);
++    pipefd = open (pipe_path.c_str (), O_RDWR | O_NONBLOCK);
+ }
+ 
+ void
+-- 
+2.38.1
+

diff --git a/12.2.0/gentoo/README.history b/12.2.0/gentoo/README.history
index f1a7d9c..d21a0ec 100644
--- a/12.2.0/gentoo/README.history
+++ b/12.2.0/gentoo/README.history
@@ -1,10 +1,15 @@
+4		9 Dec 2022
+	+ 78_all_Factor-out-jobserver_active_p.patch
+	+ 79_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch
+	+ 80_all_lto-respect-jobserver-in-parallel-WPA-streaming.patch
+	+ 81_all_jobserver-fix-fifo-mode-by-opening-pipe-in-proper-mo.patch
+
 3		5 Dec 2022
 	- 23_all_EXTRA_OPTIONS-z-now.patch
 	+ 23_all_DEF_GENTOO_ZNOW-z-now.patch
 	- 24_all_EXTRA_OPTIONS-fstack-clash-protection.patch
 	+ 24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch
 
-
 2		19 Nov 2022
 	+ 76_all_libsanitizer-implicit-function-decls.patch
 	+ 77_all_libiberty-fix-c89-isms-in-configure.patch


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

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

commit:     c52d3ce45f08028ff6603c76a500168b51a8a36f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 17 03:04:13 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=c52d3ce4

12.2.0: add 30_all_tar_libstdc++-link.patch

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

 12.2.0/gentoo/30_all_tar_libstdc++-link.patch | 54 +++++++++++++++++++++++++++
 12.2.0/gentoo/README.history                  |  3 ++
 2 files changed, 57 insertions(+)

diff --git a/12.2.0/gentoo/30_all_tar_libstdc++-link.patch b/12.2.0/gentoo/30_all_tar_libstdc++-link.patch
new file mode 100644
index 0000000..ab654e9
--- /dev/null
+++ b/12.2.0/gentoo/30_all_tar_libstdc++-link.patch
@@ -0,0 +1,54 @@
+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
+@@ -3936,9 +3936,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.
+@@ -3960,7 +3960,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 ; \

diff --git a/12.2.0/gentoo/README.history b/12.2.0/gentoo/README.history
index d21a0ec..ee29c5e 100644
--- a/12.2.0/gentoo/README.history
+++ b/12.2.0/gentoo/README.history
@@ -1,3 +1,6 @@
+5		17 Dec 2022
+	+ 30_all_tar_libstdc++-link.patch
+
 4		9 Dec 2022
 	+ 78_all_Factor-out-jobserver_active_p.patch
 	+ 79_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch


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

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

commit:     d182e15bbb3333f34afd4a6396108c1e581e4872
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 25 16:57:30 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Dec 25 16:57:30 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d182e15b

12.2.0: drop upstreamed make 4.4 patches

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

 .../78_all_Factor-out-jobserver_active_p.patch     | 284 ---------------------
 ...-jobserver-style-fifo-for-recent-GNU-make.patch |  64 -----
 ...spect-jobserver-in-parallel-WPA-streaming.patch | 225 ----------------
 ...ix-fifo-mode-by-opening-pipe-in-proper-mo.patch |  31 ---
 12.2.0/gentoo/README.history                       |   6 +
 5 files changed, 6 insertions(+), 604 deletions(-)

diff --git a/12.2.0/gentoo/78_all_Factor-out-jobserver_active_p.patch b/12.2.0/gentoo/78_all_Factor-out-jobserver_active_p.patch
deleted file mode 100644
index a4ae458..0000000
--- a/12.2.0/gentoo/78_all_Factor-out-jobserver_active_p.patch
+++ /dev/null
@@ -1,284 +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
-
-From 5037b72e71bac3bf15b16597e149601930094d4f 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/4] 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.cc
-+++ b/gcc/gcc.cc
-@@ -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"
-@@ -42,7 +43,7 @@ compilation is specified by a string called a "spec".  */
- #include "flags.h"
- #include "opts.h"
- #include "filenames.h"
--#include "spellcheck.h"
-+#include "opts-jobserver.h"
- 
- \f
- 
-@@ -9178,38 +9179,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.cc
-+++ b/gcc/lto-wrapper.cc
-@@ -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"
-@@ -49,6 +50,8 @@ along with GCC; see the file COPYING3.  If not see
- #include "lto-section-names.h"
- #include "collect-utils.h"
- #include "opts-diagnostic.h"
-+#include "opt-suggestions.h"
-+#include "opts-jobserver.h"
- 
- /* Environment variable, used for passing the names of offload targets from GCC
-    driver to lto-wrapper.  */
-@@ -1336,35 +1339,6 @@ init_num_threads (void)
- #endif
- }
- 
--/* Test and return reason why a jobserver cannot be detected.  */
--
--static const char *
--jobserver_active_p (void)
--{
--  #define JS_PREFIX "jobserver is not available: "
--  #define JS_NEEDLE "--jobserver-auth="
--
--  const char *makeflags = getenv ("MAKEFLAGS");
--  if (makeflags == NULL)
--    return JS_PREFIX "%<MAKEFLAGS%> environment variable is unset";
--
--  const char *n = strstr (makeflags, JS_NEEDLE);
--  if (n == NULL)
--    return JS_PREFIX "%<" JS_NEEDLE "%> is not present in %<MAKEFLAGS%>";
--
--  int rfd = -1;
--  int wfd = -1;
--
--  if (sscanf (n + strlen (JS_NEEDLE), "%d,%d", &rfd, &wfd) == 2
--      && rfd > 0
--      && wfd > 0
--      && is_valid_fd (rfd)
--      && is_valid_fd (wfd))
--    return NULL;
--  else
--    return JS_PREFIX "cannot access %<" JS_NEEDLE "%> file descriptors";
--}
--
- /* Print link to -flto documentation with a hint message.  */
- 
- void
-@@ -1422,7 +1396,6 @@ run_gcc (unsigned argc, char *argv[])
-   bool jobserver_requested = false;
-   int auto_parallel = 0;
-   bool no_partition = false;
--  const char *jobserver_error = NULL;
-   bool fdecoded_options_first = true;
-   vec<cl_decoded_option> fdecoded_options;
-   fdecoded_options.create (16);
-@@ -1654,14 +1627,14 @@ run_gcc (unsigned argc, char *argv[])
-     }
-   else
-     {
--      jobserver_error = jobserver_active_p ();
--      if (jobserver && jobserver_error != NULL)
-+      jobserver_info jinfo;
-+      if (jobserver && !jinfo.is_active)
- 	{
- 	  /* Fall back to auto parallelism.  */
- 	  jobserver = 0;
- 	  auto_parallel = 1;
- 	}
--      else if (!jobserver && jobserver_error == NULL)
-+      else if (!jobserver && jinfo.is_active)
- 	{
- 	  parallel = 1;
- 	  jobserver = 1;
-@@ -1976,9 +1949,10 @@ cont:
- 
-       if (nr > 1)
- 	{
--	  if (jobserver_requested && jobserver_error != NULL)
-+	  jobserver_info jinfo;
-+	  if (jobserver_requested && !jinfo.is_active)
- 	    {
--	      warning (0, jobserver_error);
-+	      warning (0, jinfo.error_msg.c_str ());
- 	      print_lto_docs_link ();
- 	    }
- 	  else if (parallel == 0)
---- a/gcc/opts-common.cc
-+++ b/gcc/opts-common.cc
-@@ -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 *);
- 
-@@ -2003,3 +2005,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/12.2.0/gentoo/79_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch b/12.2.0/gentoo/79_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch
deleted file mode 100644
index aa76db7..0000000
--- a/12.2.0/gentoo/79_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch
+++ /dev/null
@@ -1,64 +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
-
-From 3e8b90a00ddfe9cbf5416842b19b84b1ab561e08 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/4] 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.cc
-+++ b/gcc/opts-common.cc
-@@ -2008,8 +2008,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)
-@@ -2018,8 +2024,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/12.2.0/gentoo/80_all_lto-respect-jobserver-in-parallel-WPA-streaming.patch b/12.2.0/gentoo/80_all_lto-respect-jobserver-in-parallel-WPA-streaming.patch
deleted file mode 100644
index 587d9f8..0000000
--- a/12.2.0/gentoo/80_all_lto-respect-jobserver-in-parallel-WPA-streaming.patch
+++ /dev/null
@@ -1,225 +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=fed766af32ed6cd371016cc24e931131e19b4eb1
-
-From e8b2576a98e7c8ce374c179cd650f1f9422ec1ca Mon Sep 17 00:00:00 2001
-From: Martin Liska <mliska@suse.cz>
-Date: Tue, 9 Aug 2022 13:59:39 +0200
-Subject: [PATCH 3/4] lto: respect jobserver in parallel WPA streaming
-
-	PR lto/106328
-
-gcc/ChangeLog:
-
-	* opts-jobserver.h (struct jobserver_info): Add pipefd.
-	(jobserver_info::connect): New.
-	(jobserver_info::disconnect): Likewise.
-	(jobserver_info::get_token): Likewise.
-	(jobserver_info::return_token): Likewise.
-	* opts-common.cc: Implement the new functions.
-
-gcc/lto/ChangeLog:
-
-	* lto.cc (wait_for_child): Decrement nruns once a process
-	finishes.
-	(stream_out_partitions): Use job server if active.
-	(do_whole_program_analysis): Likewise.
---- a/gcc/lto/lto.cc
-+++ b/gcc/lto/lto.cc
-@@ -18,6 +18,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 "coretypes.h"
-@@ -54,11 +55,17 @@ along with GCC; see the file COPYING3.  If not see
- #include "attribs.h"
- #include "builtins.h"
- #include "lto-common.h"
-+#include "opts-jobserver.h"
- 
--
--/* Number of parallel tasks to run, -1 if we want to use GNU Make jobserver.  */
-+/* Number of parallel tasks to run.  */
- static int lto_parallelism;
- 
-+/* Number of active WPA streaming processes.  */
-+static int nruns = 0;
-+
-+/* GNU make's jobserver info.  */
-+static jobserver_info *jinfo = NULL;
-+
- /* Return true when NODE has a clone that is analyzed (i.e. we need
-    to load its body even if the node itself is not needed).  */
- 
-@@ -205,6 +212,12 @@ wait_for_child ()
- 		     "streaming subprocess was killed by signal");
-     }
-   while (!WIFEXITED (status) && !WIFSIGNALED (status));
-+
-+    --nruns;
-+
-+    /* Return token to the jobserver if active.  */
-+    if (jinfo != NULL && jinfo->is_active)
-+      jinfo->return_token ();
- }
- #endif
- 
-@@ -228,25 +241,35 @@ stream_out_partitions (char *temp_filename, int blen, int min, int max,
- 		       bool ARG_UNUSED (last))
- {
- #ifdef HAVE_WORKING_FORK
--  static int nruns;
--
-   if (lto_parallelism <= 1)
-     {
-       stream_out_partitions_1 (temp_filename, blen, min, max);
-       return;
-     }
- 
--  /* Do not run more than LTO_PARALLELISM streamings
--     FIXME: we ignore limits on jobserver.  */
-   if (lto_parallelism > 0 && nruns >= lto_parallelism)
--    {
--      wait_for_child ();
--      nruns --;
--    }
-+    wait_for_child ();
-+
-   /* If this is not the last parallel partition, execute new
-      streaming process.  */
-   if (!last)
-     {
-+      if (jinfo != NULL && jinfo->is_active)
-+	while (true)
-+	  {
-+	    if (jinfo->get_token ())
-+	      break;
-+	    if (nruns > 0)
-+	      wait_for_child ();
-+	    else
-+	      {
-+		/* There are no free tokens, lets do the job outselves.  */
-+		stream_out_partitions_1 (temp_filename, blen, min, max);
-+		asm_nodes_output = true;
-+		return;
-+	      }
-+	  }
-+
-       pid_t cpid = fork ();
- 
-       if (!cpid)
-@@ -264,10 +287,12 @@ stream_out_partitions (char *temp_filename, int blen, int min, int max,
-   /* Last partition; stream it and wait for all children to die.  */
-   else
-     {
--      int i;
-       stream_out_partitions_1 (temp_filename, blen, min, max);
--      for (i = 0; i < nruns; i++)
-+      while (nruns > 0)
- 	wait_for_child ();
-+
-+      if (jinfo != NULL && jinfo->is_active)
-+	jinfo->disconnect ();
-     }
-   asm_nodes_output = true;
- #else
-@@ -460,9 +485,14 @@ do_whole_program_analysis (void)
- 
-   lto_parallelism = 1;
- 
--  /* TODO: jobserver communication is not supported, yet.  */
-   if (!strcmp (flag_wpa, "jobserver"))
--    lto_parallelism = param_max_lto_streaming_parallelism;
-+    {
-+      jinfo = new jobserver_info ();
-+      if (jinfo->is_active)
-+	jinfo->connect ();
-+
-+      lto_parallelism = param_max_lto_streaming_parallelism;
-+    }
-   else
-     {
-       lto_parallelism = atoi (flag_wpa);
---- a/gcc/opts-common.cc
-+++ b/gcc/opts-common.cc
-@@ -2057,3 +2057,43 @@ jobserver_info::jobserver_info ()
-   if (!error_msg.empty ())
-     error_msg = "jobserver is not available: " + error_msg;
- }
-+
-+void
-+jobserver_info::connect ()
-+{
-+  if (!pipe_path.empty ())
-+    pipefd = open (pipe_path.c_str (), O_RDWR);
-+}
-+
-+void
-+jobserver_info::disconnect ()
-+{
-+  if (!pipe_path.empty ())
-+    {
-+      gcc_assert (close (pipefd) == 0);
-+      pipefd = -1;
-+    }
-+}
-+
-+bool
-+jobserver_info::get_token ()
-+{
-+  int fd = pipe_path.empty () ? rfd : pipefd;
-+  char c;
-+  unsigned n = read (fd, &c, 1);
-+  if (n != 1)
-+    {
-+      gcc_assert (errno == EAGAIN);
-+      return false;
-+    }
-+  else
-+    return true;
-+}
-+
-+void
-+jobserver_info::return_token ()
-+{
-+  int fd = pipe_path.empty () ? wfd : pipefd;
-+  char c = 'G';
-+  gcc_assert (write (fd, &c, 1) == 1);
-+}
---- a/gcc/opts-jobserver.h
-+++ b/gcc/opts-jobserver.h
-@@ -29,6 +29,18 @@ struct jobserver_info
-   /* Default constructor.  */
-   jobserver_info ();
- 
-+  /* Connect to the server.  */
-+  void connect ();
-+
-+  /* Disconnect from the server.  */
-+  void disconnect ();
-+
-+  /* Get token from the server.  */
-+  bool get_token ();
-+
-+  /* Return token to the server.  */
-+  void return_token ();
-+
-   /* Error message if there is a problem.  */
-   string error_msg = "";
-   /* Skipped MAKEFLAGS where --jobserver-auth is skipped.  */
-@@ -39,6 +51,8 @@ struct jobserver_info
-   int wfd = -1;
-   /* Named pipe path.  */
-   string pipe_path = "";
-+  /* Pipe file descriptor.  */
-+  int pipefd = -1;
-   /* Return true if jobserver is active.  */
-   bool is_active = false;
- };
--- 
-2.38.1
-

diff --git a/12.2.0/gentoo/81_all_jobserver-fix-fifo-mode-by-opening-pipe-in-proper-mo.patch b/12.2.0/gentoo/81_all_jobserver-fix-fifo-mode-by-opening-pipe-in-proper-mo.patch
deleted file mode 100644
index de5626f..0000000
--- a/12.2.0/gentoo/81_all_jobserver-fix-fifo-mode-by-opening-pipe-in-proper-mo.patch
+++ /dev/null
@@ -1,31 +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=3f1c2f89f6b8b8d23a9072f8549b0a2c1de06b03
-
-From 9474892bb967747637d7f4e45320a93e726824c3 Mon Sep 17 00:00:00 2001
-From: Martin Liska <mliska@suse.cz>
-Date: Tue, 16 Aug 2022 08:22:29 +0200
-Subject: [PATCH 4/4] jobserver: fix fifo mode by opening pipe in proper mode
-
-The current jobserver_info relies on non-blocking FDs,
-thus one the pipe in such mode.
-
-gcc/ChangeLog:
-
-	* opts-common.cc (jobserver_info::connect): Open fifo
-	in non-blocking mode.
---- a/gcc/opts-common.cc
-+++ b/gcc/opts-common.cc
-@@ -2062,7 +2062,7 @@ void
- jobserver_info::connect ()
- {
-   if (!pipe_path.empty ())
--    pipefd = open (pipe_path.c_str (), O_RDWR);
-+    pipefd = open (pipe_path.c_str (), O_RDWR | O_NONBLOCK);
- }
- 
- void
--- 
-2.38.1
-

diff --git a/12.2.0/gentoo/README.history b/12.2.0/gentoo/README.history
index 9d111f5..29fd78e 100644
--- a/12.2.0/gentoo/README.history
+++ b/12.2.0/gentoo/README.history
@@ -1,3 +1,9 @@
+7		25 Dec 2022
+	- 78_all_Factor-out-jobserver_active_p.patch
+	- 79_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch
+	- 80_all_lto-respect-jobserver-in-parallel-WPA-streaming.patch
+	- 81_all_jobserver-fix-fifo-mode-by-opening-pipe-in-proper-mo.patch
+
 6		17 Dec 2022
 	U 30_all_tar_libstdc++-link.patch
 


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

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

commit:     224f6241ec785ccc386eb191df36d919e9b62351
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 28 17:54:22 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 28 17:54:22 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=224f6241

12.2.0: add patches for FORTIFY_SOURCE=3, default GLIBCXX_ASSERTIONS

Bug: https://bugs.gentoo.org/876895
Bug: https://bugs.gentoo.org/884417
Bug: https://bugs.gentoo.org/847148
Bug: https://bugs.gentoo.org/876893
Signed-off-by: Sam James <sam <AT> gentoo.org>

 12.2.0/gentoo/01_all_default-fortify-source.patch        |  8 ++++++--
 12.2.0/gentoo/15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch | 14 ++++++++++++++
 12.2.0/gentoo/README.history                             |  4 ++++
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/12.2.0/gentoo/01_all_default-fortify-source.patch b/12.2.0/gentoo/01_all_default-fortify-source.patch
index d9f001a..79d6639 100644
--- a/12.2.0/gentoo/01_all_default-fortify-source.patch
+++ b/12.2.0/gentoo/01_all_default-fortify-source.patch
@@ -7,14 +7,18 @@ initially Gentoo used too complicated macro.
 # DP: if the optimization level is > 0
 --- a/gcc/c-family/c-cppbuiltin.cc
 +++ b/gcc/c-family/c-cppbuiltin.cc
-@@ -1510,6 +1510,12 @@ c_cpp_builtins (cpp_reader *pfile)
+@@ -1510,6 +1510,16 @@ c_cpp_builtins (cpp_reader *pfile)
    builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
    builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
  
 +#if !defined(ACCEL_COMPILER)
++  #ifndef GENTOO_FORTIFY_SOURCE_LEVEL
++    #define GENTOO_FORTIFY_SOURCE_LEVEL 2
++  #endif
++
 +  /* Fortify Source enabled by default for optimization levels > 0 */
 +  if (optimize)
-+    builtin_define_with_int_value ("_FORTIFY_SOURCE", 2);
++    builtin_define_with_int_value ("_FORTIFY_SOURCE", GENTOO_FORTIFY_SOURCE_LEVEL);
 +#endif
 +
    /* Misc.  */

diff --git a/12.2.0/gentoo/15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch b/12.2.0/gentoo/15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch
new file mode 100644
index 0000000..2daf73b
--- /dev/null
+++ b/12.2.0/gentoo/15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch
@@ -0,0 +1,14 @@
+https://bugs.gentoo.org/876895
+--- a/gcc/c-family/c-cppbuiltin.cc
++++ b/gcc/c-family/c-cppbuiltin.cc
+@@ -957,6 +957,10 @@ c_cpp_builtins (cpp_reader *pfile)
+ 	  cpp_define (pfile, "__cpp_rtti=199711L");
+ 	}
+ 
++      #ifdef DEF_GENTOO_GLIBCXX_ASSERTIONS
++	  cpp_define (pfile, "_GLIBCXX_ASSERTIONS");
++      #endif
++
+       if (cxx_dialect >= cxx11)
+         cpp_define (pfile, "__GXX_EXPERIMENTAL_CXX0X__");
+ 

diff --git a/12.2.0/gentoo/README.history b/12.2.0/gentoo/README.history
index 29fd78e..713d788 100644
--- a/12.2.0/gentoo/README.history
+++ b/12.2.0/gentoo/README.history
@@ -1,3 +1,7 @@
+8		28 Dec 2022
+	U 01_all_default-fortify-source.patch
+	+ 15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch
+
 7		25 Dec 2022
 	- 78_all_Factor-out-jobserver_active_p.patch
 	- 79_all_lto-support-jobserver-style-fifo-for-recent-GNU-make.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 12.2.0/gentoo/
@ 2023-01-08  4:46 Sam James
  0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-01-08  4:46 UTC (permalink / raw
  To: gentoo-commits

commit:     f19a5caaad02f5a85cf48eb0b5830562a8787ce1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  8 03:15:47 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  8 03:15:55 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=f19a5caa

12.2.0: drop upstream patches

Now merged upstream.

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

 ..._all_libsanitizer-implicit-function-decls.patch |  35 -------
 ...7_all_libiberty-fix-c89-isms-in-configure.patch | 105 ---------------------
 12.2.0/gentoo/README.history                       |   4 +
 3 files changed, 4 insertions(+), 140 deletions(-)

diff --git a/12.2.0/gentoo/76_all_libsanitizer-implicit-function-decls.patch b/12.2.0/gentoo/76_all_libsanitizer-implicit-function-decls.patch
deleted file mode 100644
index 8131cf8..0000000
--- a/12.2.0/gentoo/76_all_libsanitizer-implicit-function-decls.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=6be2672e4ee41c566a9e072088cccca263bab5f7
-
-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.
---- a/libsanitizer/configure
-+++ b/libsanitizer/configure
-@@ -16028,6 +16028,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
-@@ -161,7 +161,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/12.2.0/gentoo/77_all_libiberty-fix-c89-isms-in-configure.patch b/12.2.0/gentoo/77_all_libiberty-fix-c89-isms-in-configure.patch
deleted file mode 100644
index ed13d2c..0000000
--- a/12.2.0/gentoo/77_all_libiberty-fix-c89-isms-in-configure.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=885b6660c17fb91980b5682514ef54668e544b02
-
-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/acinclude.m4
-+++ b/libiberty/acinclude.m4
-@@ -24,6 +24,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
-@@ -51,7 +53,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;
-@@ -157,7 +160,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;
-@@ -169,7 +175,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
-@@ -6780,7 +6780,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;
-@@ -6792,7 +6795,9 @@ find_stack_direction ()
-   else
-     return (&dummy > addr) ? 1 : -1;
- }
--main ()
-+
-+int
-+main (void)
- {
-   exit (find_stack_direction() < 0);
- }
-@@ -7617,6 +7622,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
-@@ -7644,7 +7651,8 @@ else
- 
- #define MAP_LEN 0x10000
- 
--main ()
-+int
-+main (void)
- {
- #if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
-   char *p;

diff --git a/12.2.0/gentoo/README.history b/12.2.0/gentoo/README.history
index 713d788..d71d136 100644
--- a/12.2.0/gentoo/README.history
+++ b/12.2.0/gentoo/README.history
@@ -1,3 +1,7 @@
+9		8 Jan 2022
+	- 76_all_libsanitizer-implicit-function-decls.patch
+	- 77_all_libiberty-fix-c89-isms-in-configure.patch
+
 8		28 Dec 2022
 	U 01_all_default-fortify-source.patch
 	+ 15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch


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

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

commit:     d3c10f4c409a3b6c07c453af289c5e23420156f1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 23 00:23:09 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=d3c10f4c

12.2.0: backport driver environ corruption fix

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

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

diff --git a/12.2.0/gentoo/76_all_driver_environ_putenv_PR106624.patch b/12.2.0/gentoo/76_all_driver_environ_putenv_PR106624.patch
new file mode 100644
index 0000000..16fb131
--- /dev/null
+++ b/12.2.0/gentoo/76_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.cc (driver::detect_jobserver): Allocate storage xputenv()
+	argument using xstrdup().
+--- a/gcc/gcc.cc
++++ b/gcc/gcc.cc
+@@ -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/12.2.0/gentoo/README.history b/12.2.0/gentoo/README.history
index d71d136..e3e0bf4 100644
--- a/12.2.0/gentoo/README.history
+++ b/12.2.0/gentoo/README.history
@@ -1,3 +1,6 @@
+10		23 Jan 2022
+	+ 76_all_driver_environ_putenv_PR106624.patch
+
 9		8 Jan 2022
 	- 76_all_libsanitizer-implicit-function-decls.patch
 	- 77_all_libiberty-fix-c89-isms-in-configure.patch


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

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

commit:     9e2e3b4fd87a92e5b8d379e3312a57c6986f9004
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 29 02:47:23 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan 29 08:50:26 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9e2e3b4f

12.2.0: drop upstreamed 76_all_driver_environ_putenv_PR106624.patch

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

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

diff --git a/12.2.0/gentoo/76_all_driver_environ_putenv_PR106624.patch b/12.2.0/gentoo/76_all_driver_environ_putenv_PR106624.patch
deleted file mode 100644
index 16fb131..0000000
--- a/12.2.0/gentoo/76_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.cc (driver::detect_jobserver): Allocate storage xputenv()
-	argument using xstrdup().
---- a/gcc/gcc.cc
-+++ b/gcc/gcc.cc
-@@ -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/12.2.0/gentoo/README.history b/12.2.0/gentoo/README.history
index e3e0bf4..940ed88 100644
--- a/12.2.0/gentoo/README.history
+++ b/12.2.0/gentoo/README.history
@@ -1,3 +1,6 @@
+11		29 Jan 2022
+	- 76_all_driver_environ_putenv_PR106624.patch
+
 10		23 Jan 2022
 	+ 76_all_driver_environ_putenv_PR106624.patch
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 12.2.0/gentoo/
@ 2023-02-06 17:40 Sam James
  0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-02-06 17:40 UTC (permalink / raw
  To: gentoo-commits

commit:     6d368fffaa25908cf25836feb5ab660d8d0a3d58
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  6 17:38:06 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb  6 17:38:17 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=6d368fff

12.2.0: add 76_all_all_PR107461_cxx_equivalence_non_dependent_calls.patch

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

 ...07461_cxx_equivalence_non_dependent_calls.patch | 204 +++++++++++++++++++++
 12.2.0/gentoo/README.history                       |   9 +-
 2 files changed, 210 insertions(+), 3 deletions(-)

diff --git a/12.2.0/gentoo/76_all_all_PR107461_cxx_equivalence_non_dependent_calls.patch b/12.2.0/gentoo/76_all_all_PR107461_cxx_equivalence_non_dependent_calls.patch
new file mode 100644
index 0000000..b34cd4a
--- /dev/null
+++ b/12.2.0/gentoo/76_all_all_PR107461_cxx_equivalence_non_dependent_calls.patch
@@ -0,0 +1,204 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=31924665c86d47af6b1f22a74f594f2e1dc0ed2d
+(12 version: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=eda24f6c12b6d3777ff3bf3656187e695a3e8dc2)
+(followup to https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=59e0376f607805ef9b67fd7b0a4a3084ab3571a5)
+https://bugs.gentoo.org/893410
+
+From eda24f6c12b6d3777ff3bf3656187e695a3e8dc2 Mon Sep 17 00:00:00 2001
+From: Patrick Palka <ppalka@redhat.com>
+Date: Sun, 5 Feb 2023 21:35:33 -0500
+Subject: [PATCH] c++: equivalence of non-dependent calls [PR107461]
+
+After r13-5684-g59e0376f607805 the (pruned) callee of a non-dependent
+CALL_EXPR is a bare FUNCTION_DECL rather than ADDR_EXPR of FUNCTION_DECL.
+This innocent change revealed that cp_tree_equal doesn't first check
+dependence of a CALL_EXPR before treating a FUNCTION_DECL callee as a
+dependent name, which leads to us incorrectly accepting the first two
+testcases below and rejecting the third:
+
+ * In the first testcase, cp_tree_equal incorrectly returns true for
+   the two non-dependent CALL_EXPRs f(0) and f(0) (whose CALL_EXPR_FN
+   are different FUNCTION_DECLs) which causes us to treat #2 as a
+   redeclaration of #1.
+
+ * Same issue in the second testcase, for f<int*>() and f<char>().
+
+ * In the third testcase, cp_tree_equal incorrectly returns true for
+   f<int>() and f<void(*)(int)>() which causes us to conflate the two
+   dependent specializations A<decltype(f<int>()(U()))> and
+   A<decltype(f<void(*)(int)>()(U()))>.
+
+This patch fixes this by making called_fns_equal treat two callees as
+dependent names only if the overall CALL_EXPRs are dependent, via a new
+convenience function call_expr_dependent_name that is like dependent_name
+but also checks dependence of the overall CALL_EXPR.
+
+	PR c++/107461
+
+gcc/cp/ChangeLog:
+
+	* cp-tree.h (call_expr_dependent_name): Declare.
+	* pt.cc (iterative_hash_template_arg) <case CALL_EXPR>: Use
+	call_expr_dependent_name instead of dependent_name.
+	* tree.cc (call_expr_dependent_name): Define.
+	(called_fns_equal): Adjust to take two CALL_EXPRs instead of
+	CALL_EXPR_FNs thereof.  Use call_expr_dependent_name instead
+	of dependent_name.
+	(cp_tree_equal) <case CALL_EXPR>: Adjust call to called_fns_equal.
+
+gcc/testsuite/ChangeLog:
+
+	* g++.dg/cpp0x/overload5.C: New test.
+	* g++.dg/cpp0x/overload5a.C: New test.
+	* g++.dg/cpp0x/overload6.C: New test.
+
+(cherry picked from commit 31924665c86d47af6b1f22a74f594f2e1dc0ed2d)
+---
+ gcc/cp/cp-tree.h                        |  1 +
+ gcc/cp/pt.cc                            |  2 +-
+ gcc/cp/tree.cc                          | 24 +++++++++++++++++++-----
+ gcc/testsuite/g++.dg/cpp0x/overload5.C  | 12 ++++++++++++
+ gcc/testsuite/g++.dg/cpp0x/overload5a.C | 10 ++++++++++
+ gcc/testsuite/g++.dg/cpp0x/overload6.C  | 16 ++++++++++++++++
+ 6 files changed, 59 insertions(+), 6 deletions(-)
+ create mode 100644 gcc/testsuite/g++.dg/cpp0x/overload5.C
+ create mode 100644 gcc/testsuite/g++.dg/cpp0x/overload5a.C
+ create mode 100644 gcc/testsuite/g++.dg/cpp0x/overload6.C
+
+diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
+index cd51dd288b0..40563a151fe 100644
+--- a/gcc/cp/cp-tree.h
++++ b/gcc/cp/cp-tree.h
+@@ -7860,6 +7860,7 @@ extern tree lookup_maybe_add			(tree fns, tree lookup,
+ extern int is_overloaded_fn			(tree) ATTRIBUTE_PURE;
+ extern bool really_overloaded_fn		(tree) ATTRIBUTE_PURE;
+ extern tree dependent_name			(tree);
++extern tree call_expr_dependent_name		(tree);
+ extern tree maybe_get_fns			(tree) ATTRIBUTE_PURE;
+ extern tree get_fns				(tree) ATTRIBUTE_PURE;
+ extern tree get_first_fn			(tree) ATTRIBUTE_PURE;
+diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
+index 735c106c7d6..0af7033589a 100644
+--- a/gcc/cp/pt.cc
++++ b/gcc/cp/pt.cc
+@@ -1910,7 +1910,7 @@ iterative_hash_template_arg (tree arg, hashval_t val)
+     case CALL_EXPR:
+       {
+ 	tree fn = CALL_EXPR_FN (arg);
+-	if (tree name = dependent_name (fn))
++	if (tree name = call_expr_dependent_name (arg))
+ 	  {
+ 	    if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
+ 	      val = iterative_hash_template_arg (TREE_OPERAND (fn, 1), val);
+diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
+index bc521f8ae9c..e8a9c473ef6 100644
+--- a/gcc/cp/tree.cc
++++ b/gcc/cp/tree.cc
+@@ -2596,6 +2596,18 @@ dependent_name (tree x)
+   return NULL_TREE;
+ }
+ 
++/* Like dependent_name, but instead takes a CALL_EXPR and also checks
++   its dependence.  */
++
++tree
++call_expr_dependent_name (tree x)
++{
++  if (TREE_TYPE (x) != NULL_TREE)
++    /* X isn't dependent, so its callee isn't a dependent name.  */
++    return NULL_TREE;
++  return dependent_name (CALL_EXPR_FN (x));
++}
++
+ /* Returns true iff X is an expression for an overloaded function
+    whose type cannot be known without performing overload
+    resolution.  */
+@@ -3829,16 +3841,18 @@ decl_anon_ns_mem_p (const_tree decl)
+   return !TREE_PUBLIC (decl);
+ }
+ 
+-/* Subroutine of cp_tree_equal: t1 and t2 are the CALL_EXPR_FNs of two
+-   CALL_EXPRS.  Return whether they are equivalent.  */
++/* Subroutine of cp_tree_equal: t1 and t2 are two CALL_EXPRs.
++   Return whether their CALL_EXPR_FNs are equivalent.  */
+ 
+ static bool
+ called_fns_equal (tree t1, tree t2)
+ {
+   /* Core 1321: dependent names are equivalent even if the overload sets
+      are different.  But do compare explicit template arguments.  */
+-  tree name1 = dependent_name (t1);
+-  tree name2 = dependent_name (t2);
++  tree name1 = call_expr_dependent_name (t1);
++  tree name2 = call_expr_dependent_name (t2);
++  t1 = CALL_EXPR_FN (t1);
++  t2 = CALL_EXPR_FN (t2);
+   if (name1 || name2)
+     {
+       tree targs1 = NULL_TREE, targs2 = NULL_TREE;
+@@ -3952,7 +3966,7 @@ cp_tree_equal (tree t1, tree t2)
+ 	if (KOENIG_LOOKUP_P (t1) != KOENIG_LOOKUP_P (t2))
+ 	  return false;
+ 
+-	if (!called_fns_equal (CALL_EXPR_FN (t1), CALL_EXPR_FN (t2)))
++	if (!called_fns_equal (t1, t2))
+ 	  return false;
+ 
+ 	call_expr_arg_iterator iter1, iter2;
+diff --git a/gcc/testsuite/g++.dg/cpp0x/overload5.C b/gcc/testsuite/g++.dg/cpp0x/overload5.C
+new file mode 100644
+index 00000000000..e05b1594f51
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/overload5.C
+@@ -0,0 +1,12 @@
++// PR c++/107461
++// { dg-do compile { target c++11 } }
++
++int f(...);
++template<class T> decltype(T() + f(0)) g(); // #1
++
++char f(int);
++template<class T> decltype(T() + f(0)) g(); // #2, distinct from #1
++
++int main() {
++  g<int>(); // { dg-error "ambiguous" }
++}
+diff --git a/gcc/testsuite/g++.dg/cpp0x/overload5a.C b/gcc/testsuite/g++.dg/cpp0x/overload5a.C
+new file mode 100644
+index 00000000000..037114f199c
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/overload5a.C
+@@ -0,0 +1,10 @@
++// PR c++/107461
++// { dg-do compile { target c++11 } }
++
++template<class T> T f();
++template<class T> decltype(T() + f<int*>()) g(); // #1
++template<class T> decltype(T() + f<char>()) g(); // #2, distinct from #1
++
++int main() {
++  g<int>(); // { dg-error "ambiguous" }
++}
+diff --git a/gcc/testsuite/g++.dg/cpp0x/overload6.C b/gcc/testsuite/g++.dg/cpp0x/overload6.C
+new file mode 100644
+index 00000000000..1fbee0501de
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/overload6.C
+@@ -0,0 +1,16 @@
++// PR c++/107461
++// { dg-do compile { target c++11 } }
++
++template<class T> T f();
++
++template<class> struct A { };
++
++template<class T> struct B {
++  template<class U, class = A<decltype(f<T>()(U()))>>
++  static void g(U);
++};
++
++int main() {
++  B<int> b;
++  B<void(*)(int)>::g(0); // { dg-bogus "no match" }
++}
+-- 
+2.31.1

diff --git a/12.2.0/gentoo/README.history b/12.2.0/gentoo/README.history
index 940ed88..4437361 100644
--- a/12.2.0/gentoo/README.history
+++ b/12.2.0/gentoo/README.history
@@ -1,10 +1,13 @@
-11		29 Jan 2022
+12		6 Feb 2023
+	+ 76_all_all_PR107461_cxx_equivalence_non_dependent_calls.patch
+
+11		29 Jan 2023
 	- 76_all_driver_environ_putenv_PR106624.patch
 
-10		23 Jan 2022
+10		23 Jan 2023
 	+ 76_all_driver_environ_putenv_PR106624.patch
 
-9		8 Jan 2022
+9		8 Jan 2023
 	- 76_all_libsanitizer-implicit-function-decls.patch
 	- 77_all_libiberty-fix-c89-isms-in-configure.patch
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 12.2.0/gentoo/
@ 2023-02-06 18:36 Sam James
  0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-02-06 18:36 UTC (permalink / raw
  To: gentoo-commits

commit:     1ec59690c89168a5afe9ac29b0eb43a39eb4ba5b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  6 18:36:22 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb  6 18:36:22 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=1ec59690

12.2.0: drop 76_all_all_PR107461_cxx_equivalence_non_dependent_calls.patch (upstream)

Drop now that we created 12.x and 13.x patchsets with this in, as it's
in the git repo now and keeping it in gcc-patches.git will break live
ebuilds.

Will be in next snapshot too as a result.

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

 ...07461_cxx_equivalence_non_dependent_calls.patch | 204 ---------------------
 1 file changed, 204 deletions(-)

diff --git a/12.2.0/gentoo/76_all_all_PR107461_cxx_equivalence_non_dependent_calls.patch b/12.2.0/gentoo/76_all_all_PR107461_cxx_equivalence_non_dependent_calls.patch
deleted file mode 100644
index b34cd4a..0000000
--- a/12.2.0/gentoo/76_all_all_PR107461_cxx_equivalence_non_dependent_calls.patch
+++ /dev/null
@@ -1,204 +0,0 @@
-https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=31924665c86d47af6b1f22a74f594f2e1dc0ed2d
-(12 version: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=eda24f6c12b6d3777ff3bf3656187e695a3e8dc2)
-(followup to https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=59e0376f607805ef9b67fd7b0a4a3084ab3571a5)
-https://bugs.gentoo.org/893410
-
-From eda24f6c12b6d3777ff3bf3656187e695a3e8dc2 Mon Sep 17 00:00:00 2001
-From: Patrick Palka <ppalka@redhat.com>
-Date: Sun, 5 Feb 2023 21:35:33 -0500
-Subject: [PATCH] c++: equivalence of non-dependent calls [PR107461]
-
-After r13-5684-g59e0376f607805 the (pruned) callee of a non-dependent
-CALL_EXPR is a bare FUNCTION_DECL rather than ADDR_EXPR of FUNCTION_DECL.
-This innocent change revealed that cp_tree_equal doesn't first check
-dependence of a CALL_EXPR before treating a FUNCTION_DECL callee as a
-dependent name, which leads to us incorrectly accepting the first two
-testcases below and rejecting the third:
-
- * In the first testcase, cp_tree_equal incorrectly returns true for
-   the two non-dependent CALL_EXPRs f(0) and f(0) (whose CALL_EXPR_FN
-   are different FUNCTION_DECLs) which causes us to treat #2 as a
-   redeclaration of #1.
-
- * Same issue in the second testcase, for f<int*>() and f<char>().
-
- * In the third testcase, cp_tree_equal incorrectly returns true for
-   f<int>() and f<void(*)(int)>() which causes us to conflate the two
-   dependent specializations A<decltype(f<int>()(U()))> and
-   A<decltype(f<void(*)(int)>()(U()))>.
-
-This patch fixes this by making called_fns_equal treat two callees as
-dependent names only if the overall CALL_EXPRs are dependent, via a new
-convenience function call_expr_dependent_name that is like dependent_name
-but also checks dependence of the overall CALL_EXPR.
-
-	PR c++/107461
-
-gcc/cp/ChangeLog:
-
-	* cp-tree.h (call_expr_dependent_name): Declare.
-	* pt.cc (iterative_hash_template_arg) <case CALL_EXPR>: Use
-	call_expr_dependent_name instead of dependent_name.
-	* tree.cc (call_expr_dependent_name): Define.
-	(called_fns_equal): Adjust to take two CALL_EXPRs instead of
-	CALL_EXPR_FNs thereof.  Use call_expr_dependent_name instead
-	of dependent_name.
-	(cp_tree_equal) <case CALL_EXPR>: Adjust call to called_fns_equal.
-
-gcc/testsuite/ChangeLog:
-
-	* g++.dg/cpp0x/overload5.C: New test.
-	* g++.dg/cpp0x/overload5a.C: New test.
-	* g++.dg/cpp0x/overload6.C: New test.
-
-(cherry picked from commit 31924665c86d47af6b1f22a74f594f2e1dc0ed2d)
----
- gcc/cp/cp-tree.h                        |  1 +
- gcc/cp/pt.cc                            |  2 +-
- gcc/cp/tree.cc                          | 24 +++++++++++++++++++-----
- gcc/testsuite/g++.dg/cpp0x/overload5.C  | 12 ++++++++++++
- gcc/testsuite/g++.dg/cpp0x/overload5a.C | 10 ++++++++++
- gcc/testsuite/g++.dg/cpp0x/overload6.C  | 16 ++++++++++++++++
- 6 files changed, 59 insertions(+), 6 deletions(-)
- create mode 100644 gcc/testsuite/g++.dg/cpp0x/overload5.C
- create mode 100644 gcc/testsuite/g++.dg/cpp0x/overload5a.C
- create mode 100644 gcc/testsuite/g++.dg/cpp0x/overload6.C
-
-diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
-index cd51dd288b0..40563a151fe 100644
---- a/gcc/cp/cp-tree.h
-+++ b/gcc/cp/cp-tree.h
-@@ -7860,6 +7860,7 @@ extern tree lookup_maybe_add			(tree fns, tree lookup,
- extern int is_overloaded_fn			(tree) ATTRIBUTE_PURE;
- extern bool really_overloaded_fn		(tree) ATTRIBUTE_PURE;
- extern tree dependent_name			(tree);
-+extern tree call_expr_dependent_name		(tree);
- extern tree maybe_get_fns			(tree) ATTRIBUTE_PURE;
- extern tree get_fns				(tree) ATTRIBUTE_PURE;
- extern tree get_first_fn			(tree) ATTRIBUTE_PURE;
-diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
-index 735c106c7d6..0af7033589a 100644
---- a/gcc/cp/pt.cc
-+++ b/gcc/cp/pt.cc
-@@ -1910,7 +1910,7 @@ iterative_hash_template_arg (tree arg, hashval_t val)
-     case CALL_EXPR:
-       {
- 	tree fn = CALL_EXPR_FN (arg);
--	if (tree name = dependent_name (fn))
-+	if (tree name = call_expr_dependent_name (arg))
- 	  {
- 	    if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
- 	      val = iterative_hash_template_arg (TREE_OPERAND (fn, 1), val);
-diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
-index bc521f8ae9c..e8a9c473ef6 100644
---- a/gcc/cp/tree.cc
-+++ b/gcc/cp/tree.cc
-@@ -2596,6 +2596,18 @@ dependent_name (tree x)
-   return NULL_TREE;
- }
- 
-+/* Like dependent_name, but instead takes a CALL_EXPR and also checks
-+   its dependence.  */
-+
-+tree
-+call_expr_dependent_name (tree x)
-+{
-+  if (TREE_TYPE (x) != NULL_TREE)
-+    /* X isn't dependent, so its callee isn't a dependent name.  */
-+    return NULL_TREE;
-+  return dependent_name (CALL_EXPR_FN (x));
-+}
-+
- /* Returns true iff X is an expression for an overloaded function
-    whose type cannot be known without performing overload
-    resolution.  */
-@@ -3829,16 +3841,18 @@ decl_anon_ns_mem_p (const_tree decl)
-   return !TREE_PUBLIC (decl);
- }
- 
--/* Subroutine of cp_tree_equal: t1 and t2 are the CALL_EXPR_FNs of two
--   CALL_EXPRS.  Return whether they are equivalent.  */
-+/* Subroutine of cp_tree_equal: t1 and t2 are two CALL_EXPRs.
-+   Return whether their CALL_EXPR_FNs are equivalent.  */
- 
- static bool
- called_fns_equal (tree t1, tree t2)
- {
-   /* Core 1321: dependent names are equivalent even if the overload sets
-      are different.  But do compare explicit template arguments.  */
--  tree name1 = dependent_name (t1);
--  tree name2 = dependent_name (t2);
-+  tree name1 = call_expr_dependent_name (t1);
-+  tree name2 = call_expr_dependent_name (t2);
-+  t1 = CALL_EXPR_FN (t1);
-+  t2 = CALL_EXPR_FN (t2);
-   if (name1 || name2)
-     {
-       tree targs1 = NULL_TREE, targs2 = NULL_TREE;
-@@ -3952,7 +3966,7 @@ cp_tree_equal (tree t1, tree t2)
- 	if (KOENIG_LOOKUP_P (t1) != KOENIG_LOOKUP_P (t2))
- 	  return false;
- 
--	if (!called_fns_equal (CALL_EXPR_FN (t1), CALL_EXPR_FN (t2)))
-+	if (!called_fns_equal (t1, t2))
- 	  return false;
- 
- 	call_expr_arg_iterator iter1, iter2;
-diff --git a/gcc/testsuite/g++.dg/cpp0x/overload5.C b/gcc/testsuite/g++.dg/cpp0x/overload5.C
-new file mode 100644
-index 00000000000..e05b1594f51
---- /dev/null
-+++ b/gcc/testsuite/g++.dg/cpp0x/overload5.C
-@@ -0,0 +1,12 @@
-+// PR c++/107461
-+// { dg-do compile { target c++11 } }
-+
-+int f(...);
-+template<class T> decltype(T() + f(0)) g(); // #1
-+
-+char f(int);
-+template<class T> decltype(T() + f(0)) g(); // #2, distinct from #1
-+
-+int main() {
-+  g<int>(); // { dg-error "ambiguous" }
-+}
-diff --git a/gcc/testsuite/g++.dg/cpp0x/overload5a.C b/gcc/testsuite/g++.dg/cpp0x/overload5a.C
-new file mode 100644
-index 00000000000..037114f199c
---- /dev/null
-+++ b/gcc/testsuite/g++.dg/cpp0x/overload5a.C
-@@ -0,0 +1,10 @@
-+// PR c++/107461
-+// { dg-do compile { target c++11 } }
-+
-+template<class T> T f();
-+template<class T> decltype(T() + f<int*>()) g(); // #1
-+template<class T> decltype(T() + f<char>()) g(); // #2, distinct from #1
-+
-+int main() {
-+  g<int>(); // { dg-error "ambiguous" }
-+}
-diff --git a/gcc/testsuite/g++.dg/cpp0x/overload6.C b/gcc/testsuite/g++.dg/cpp0x/overload6.C
-new file mode 100644
-index 00000000000..1fbee0501de
---- /dev/null
-+++ b/gcc/testsuite/g++.dg/cpp0x/overload6.C
-@@ -0,0 +1,16 @@
-+// PR c++/107461
-+// { dg-do compile { target c++11 } }
-+
-+template<class T> T f();
-+
-+template<class> struct A { };
-+
-+template<class T> struct B {
-+  template<class U, class = A<decltype(f<T>()(U()))>>
-+  static void g(U);
-+};
-+
-+int main() {
-+  B<int> b;
-+  B<void(*)(int)>::g(0); // { dg-bogus "no match" }
-+}
--- 
-2.31.1


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

* [gentoo-commits] proj/gcc-patches:master commit in: 12.2.0/gentoo/
@ 2023-02-12  2:39 Sam James
  0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-02-12  2:39 UTC (permalink / raw
  To: gentoo-commits

commit:     16a112b3a16ac49e4cca0455580dae243ccd3a9f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 12 02:38:23 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Feb 12 02:38:23 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=16a112b3

12.2.0: cut 13 patchset

Just drops the merged-upstream 76_all_all_PR107461_cxx_equivalence_non_dependent_calls.patch.

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

 12.2.0/gentoo/README.history | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/12.2.0/gentoo/README.history b/12.2.0/gentoo/README.history
index 4437361..fcae351 100644
--- a/12.2.0/gentoo/README.history
+++ b/12.2.0/gentoo/README.history
@@ -1,3 +1,6 @@
+13		12 Feb 2023
+	- 76_all_all_PR107461_cxx_equivalence_non_dependent_calls.patch
+
 12		6 Feb 2023
 	+ 76_all_all_PR107461_cxx_equivalence_non_dependent_calls.patch
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 12.2.0/gentoo/
@ 2023-03-13 22:28 Sam James
  0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-03-13 22:28 UTC (permalink / raw
  To: gentoo-commits

commit:     202b3e4a5c76f24591de79b99580bd547c71ec6b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 13 21:53:26 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Mar 13 21:53:26 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=202b3e4a

12.2.0: don't set _FORTIFY_SOURCE if -fsanitize=address (ASAN) is enabled

This can cause either false positives in warnings from the compiler or false
negatives where the sanitizer misses something.

Bug: https://github.com/google/sanitizers/issues/247
Signed-off-by: Sam James <sam <AT> gentoo.org>

 12.2.0/gentoo/01_all_default-fortify-source.patch | 4 ++--
 12.2.0/gentoo/README.history                      | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/12.2.0/gentoo/01_all_default-fortify-source.patch b/12.2.0/gentoo/01_all_default-fortify-source.patch
index 79d6639..4cdf5f6 100644
--- a/12.2.0/gentoo/01_all_default-fortify-source.patch
+++ b/12.2.0/gentoo/01_all_default-fortify-source.patch
@@ -16,8 +16,8 @@ initially Gentoo used too complicated macro.
 +    #define GENTOO_FORTIFY_SOURCE_LEVEL 2
 +  #endif
 +
-+  /* Fortify Source enabled by default for optimization levels > 0 */
-+  if (optimize)
++  /* F_S enabled by default for optimization levels > 0, except for ASAN: https://github.com/google/sanitizers/issues/247 */
++  if (optimize && ! (flag_sanitize & SANITIZE_ADDRESS))
 +    builtin_define_with_int_value ("_FORTIFY_SOURCE", GENTOO_FORTIFY_SOURCE_LEVEL);
 +#endif
 +

diff --git a/12.2.0/gentoo/README.history b/12.2.0/gentoo/README.history
index fcae351..23576e0 100644
--- a/12.2.0/gentoo/README.history
+++ b/12.2.0/gentoo/README.history
@@ -1,3 +1,6 @@
+14		13 Mar 2023
+	U 01_all_default-fortify-source.patch
+
 13		12 Feb 2023
 	- 76_all_all_PR107461_cxx_equivalence_non_dependent_calls.patch
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 12.2.0/gentoo/
@ 2023-04-23  2:41 Sam James
  0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-04-23  2:41 UTC (permalink / raw
  To: gentoo-commits

commit:     ffa606b25a8535e81f34e661ef0da04dee80d72b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 22 10:35:44 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 22 10:35:44 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=ffa606b2

12.2.0: add chromium ICE patch

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

 ...573_12_ICE-in-vectorizable_live_operation.patch | 131 +++++++++++++++++++++
 12.2.0/gentoo/README.history                       |   3 +
 2 files changed, 134 insertions(+)

diff --git a/12.2.0/gentoo/76_all_all_PR109573_12_ICE-in-vectorizable_live_operation.patch b/12.2.0/gentoo/76_all_all_PR109573_12_ICE-in-vectorizable_live_operation.patch
new file mode 100644
index 0000000..bf3b48a
--- /dev/null
+++ b/12.2.0/gentoo/76_all_all_PR109573_12_ICE-in-vectorizable_live_operation.patch
@@ -0,0 +1,131 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109573
+https://bugs.gentoo.org/904455
+
+From cddfe6bc40b3dc0806e260bbfb4cac82d609a258 Mon Sep 17 00:00:00 2001
+From: Richard Biener <rguenther@suse.de>
+Date: Fri, 21 Apr 2023 12:57:17 +0200
+Subject: [PATCH] tree-optimization/109573 - avoid ICEing on unexpected live
+ def
+
+The following relaxes the assert in vectorizable_live_operation
+where we catch currently unhandled cases to also allow an
+intermediate copy as it happens here but also relax the assert
+to checking only.
+
+	PR tree-optimization/109573
+	* tree-vect-loop.cc (vectorizable_live_operation): Allow
+	unhandled SSA copy as well.  Demote assert to checking only.
+
+	* g++.dg/vect/pr109573.cc: New testcase.
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/vect/pr109573.cc
+@@ -0,0 +1,91 @@
++// { dg-do compile }
++// { dg-require-effective-target c++20 }
++
++void *operator new(__SIZE_TYPE__, void *__p) { return __p; }
++template <typename _Head> struct _Head_base {
++  _Head _M_head_impl;
++};
++template <unsigned long, typename...> struct _Tuple_impl;
++template <unsigned long _Idx, typename _Head, typename... _Tail>
++struct _Tuple_impl<_Idx, _Head, _Tail...> : _Tuple_impl<_Idx + 1, _Tail...>,
++                                            _Head_base<_Head> {
++  template <typename _UHead, typename... _UTail>
++  _Tuple_impl(_UHead __head, _UTail... __tail)
++      : _Tuple_impl<_Idx + 1, _Tail...>(__tail...), _Head_base<_Head>(__head) {}
++};
++template <unsigned long _Idx, typename _Head> struct _Tuple_impl<_Idx, _Head> {
++  template <typename _UHead> _Tuple_impl(_UHead);
++};
++template <typename... _Elements> struct tuple : _Tuple_impl<0, _Elements...> {
++  template <typename... _UElements>
++  tuple(_UElements... __elements)
++      : _Tuple_impl<0, _Elements...>(__elements...) {}
++};
++unsigned long position_;
++struct Zone {
++  template <typename T, typename... Args> T *New(Args... args) {
++    return new (reinterpret_cast<void *>(position_)) T(args...);
++  }
++};
++struct Label {
++  int pos_;
++  int near_link_pos_;
++};
++enum Condition { below_equal };
++void bind(Label *);
++Zone *zone();
++unsigned long deopt_info_address();
++int MakeDeferredCode___trans_tmp_2, MakeDeferredCode___trans_tmp_3,
++    Prologue___trans_tmp_6, MakeDeferredCode___trans_tmp_1;
++struct MaglevAssembler {
++  template <typename Function, typename... Args>
++  void MakeDeferredCode(Function &&, Args &&...);
++  template <typename Function, typename... Args>
++  void JumpToDeferredIf(Condition, Function, Args... args) {
++    MakeDeferredCode(Function(), args...);
++  }
++  void Prologue();
++};
++struct ZoneLabelRef {
++  ZoneLabelRef(Zone *zone) : label_(zone->New<Label>()) {}
++  ZoneLabelRef(MaglevAssembler *) : ZoneLabelRef(zone()) {}
++  Label *operator*() { return label_; }
++  Label *label_;
++};
++template <typename Function>
++struct FunctionArgumentsTupleHelper
++    : FunctionArgumentsTupleHelper<decltype(&Function::operator())> {};
++template <typename C, typename R, typename... A>
++struct FunctionArgumentsTupleHelper<R (C::*)(A...) const> {
++  using Tuple = tuple<A...>;
++};
++template <typename> struct StripFirstTupleArg;
++template <typename T1, typename... T>
++struct StripFirstTupleArg<tuple<T1, T...>> {
++  using Stripped = tuple<T...>;
++};
++template <typename Function> struct DeferredCodeInfoImpl {
++  template <typename... InArgs>
++  DeferredCodeInfoImpl(int *, int, int, Function, InArgs... args)
++      : args(args...) {}
++  StripFirstTupleArg<
++      typename FunctionArgumentsTupleHelper<Function>::Tuple>::Stripped args;
++};
++template <typename Function, typename... Args>
++void MaglevAssembler::MakeDeferredCode(Function &&deferred_code_gen,
++                                       Args &&...args) {
++  zone()->New<DeferredCodeInfoImpl<Function>>(
++      &MakeDeferredCode___trans_tmp_1, MakeDeferredCode___trans_tmp_2,
++      MakeDeferredCode___trans_tmp_3, deferred_code_gen, args...);
++}
++void MaglevAssembler::Prologue() {
++  int *__trans_tmp_9;
++  ZoneLabelRef deferred_call_stack_guard_return(this);
++  __trans_tmp_9 = reinterpret_cast<int *>(deopt_info_address());
++  JumpToDeferredIf(
++      below_equal, [](MaglevAssembler, int *, ZoneLabelRef, int, int) {},
++      __trans_tmp_9, deferred_call_stack_guard_return, Prologue___trans_tmp_6,
++      0);
++  Label __trans_tmp_7 = **deferred_call_stack_guard_return;
++  bind(&__trans_tmp_7);
++}
+--- a/gcc/tree-vect-loop.cc
++++ b/gcc/tree-vect-loop.cc
+@@ -10114,9 +10114,10 @@ vectorizable_live_operation (vec_info *vinfo,
+ 						use_stmt))
+ 	      {
+ 		enum tree_code code = gimple_assign_rhs_code (use_stmt);
+-		gcc_assert (code == CONSTRUCTOR
+-			    || code == VIEW_CONVERT_EXPR
+-			    || CONVERT_EXPR_CODE_P (code));
++		gcc_checking_assert (code == SSA_NAME
++				     || code == CONSTRUCTOR
++				     || code == VIEW_CONVERT_EXPR
++				     || CONVERT_EXPR_CODE_P (code));
+ 		if (dump_enabled_p ())
+ 		  dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ 				   "Using original scalar computation for "
+-- 
+2.31.1

diff --git a/12.2.0/gentoo/README.history b/12.2.0/gentoo/README.history
index 23576e0..521b11e 100644
--- a/12.2.0/gentoo/README.history
+++ b/12.2.0/gentoo/README.history
@@ -1,3 +1,6 @@
+15		22 Apr 2023
+	+ 76_all_all_PR109573_12_ICE-in-vectorizable_live_operation.patch
+
 14		13 Mar 2023
 	U 01_all_default-fortify-source.patch
 


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

end of thread, other threads:[~2023-04-23  2:41 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-13 22:28 [gentoo-commits] proj/gcc-patches:master commit in: 12.2.0/gentoo/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2023-04-23  2:41 Sam James
2023-02-12  2:39 Sam James
2023-02-06 18:36 Sam James
2023-02-06 17:40 Sam James
2023-01-29  8:50 Sam James
2023-01-23  0:35 Sam James
2023-01-08  4:46 Sam James
2022-12-28 19:35 Sam James
2022-12-26  8:06 Sam James
2022-12-17  4:54 Sam James
2022-12-09 11:24 Sam James
2022-12-05  0:27 Sam James
2022-12-05  0:18 Andreas K. Hüttel
2022-11-20  0:25 Sam James
2022-08-22  1:41 Sam James
2022-08-22  1:41 Sam James

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