commit:     fb2a38606f5321096364674eba03fa134fcc5b2d
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  8 07:57:45 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Aug  8 07:57:45 2018 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=fb2a3860

8.2.0: new patchset based on 8.1.0

Changes since 8.1.0: two upstreamed patches removed:

- 93_all_arm-arch.patch
- 96_all_lto-O2-PR85655.patch

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 8.2.0/gentoo/10_all_default-fortify-source.patch   |  15 +++
 .../11_all_default-warn-format-security.patch      |  22 ++++
 8.2.0/gentoo/12_all_default-warn-trampolines.patch |  13 ++
 8.2.0/gentoo/13_all_default-ssp-fix.patch          |  38 ++++++
 8.2.0/gentoo/25_all_alpha-mieee-default.patch      |  39 ++++++
 8.2.0/gentoo/34_all_ia64_note.GNU-stack.patch      |  92 +++++++++++++
 .../gentoo/35_all_i386_libgcc_note.GNU-stack.patch |  54 ++++++++
 8.2.0/gentoo/50_all_libiberty-asprintf.patch       |  18 +++
 8.2.0/gentoo/51_all_libiberty-pic.patch            |  10 ++
 8.2.0/gentoo/54_all_nopie-all-flags.patch          |  18 +++
 8.2.0/gentoo/55_all_extra-options.patch            |  89 +++++++++++++
 .../90_all_pr55930-dependency-tracking.patch       |  18 +++
 8.2.0/gentoo/92_all_sh-drop-sysroot-suffix.patch   |  32 +++++
 8.2.0/gentoo/94_all_mips-o32-asan.patch            |  37 ++++++
 8.2.0/gentoo/95_all_ia64-TEXTREL.patch             |  22 ++++
 8.2.0/gentoo/97_all_disable-systemtap-switch.patch | 142 +++++++++++++++++++++
 8.2.0/gentoo/README.history                        |  18 +++
 17 files changed, 677 insertions(+)

diff --git a/8.2.0/gentoo/10_all_default-fortify-source.patch 
b/8.2.0/gentoo/10_all_default-fortify-source.patch
new file mode 100644
index 0000000..36c5762
--- /dev/null
+++ b/8.2.0/gentoo/10_all_default-fortify-source.patch
@@ -0,0 +1,15 @@
+Enable -D_FORTIFY_SOURCE=2 by default.
+
+
+--- a/gcc/c-family/c-cppbuiltin.c
++++ b/gcc/c-family/c-cppbuiltin.c
+@@ -951,6 +951,9 @@ c_cpp_builtins (cpp_reader *pfile)
+   builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
+   builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
+ 
++  /* Fortify Source enabled by default w/optimization.  */
++  cpp_define (pfile, "_FORTIFY_SOURCE=((defined __OPTIMIZE__ && __OPTIMIZE__ 
> 0) ? 2 : 0)");
++
+   /* Misc.  */
+   if (flag_gnu89_inline)
+     cpp_define (pfile, "__GNUC_GNU_INLINE__");

diff --git a/8.2.0/gentoo/11_all_default-warn-format-security.patch 
b/8.2.0/gentoo/11_all_default-warn-format-security.patch
new file mode 100644
index 0000000..f809abd
--- /dev/null
+++ b/8.2.0/gentoo/11_all_default-warn-format-security.patch
@@ -0,0 +1,22 @@
+Enable -Wformat and -Wformat-security by default.
+
+--- a/gcc/c-family/c.opt       2016-03-23 18:51:56.000000000 +0100
++++ b/gcc/c-family/c.opt       2016-04-28 23:45:54.063351272 +0200
+@@ -459,7 +459,7 @@ C ObjC C++ ObjC++ Var(warn_format_nonlit
+ Warn about format strings that are not literals.
+ 
+ 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
+@@ -475,7 +475,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_l
+ 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.
+ 
+ Wignored-qualifiers

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

diff --git a/8.2.0/gentoo/13_all_default-ssp-fix.patch 
b/8.2.0/gentoo/13_all_default-ssp-fix.patch
new file mode 100644
index 0000000..d2deac7
--- /dev/null
+++ b/8.2.0/gentoo/13_all_default-ssp-fix.patch
@@ -0,0 +1,38 @@
+Disable ssp on -nostdlib, -nodefaultlibs and -ffreestanding 
+Change the buffer size.
+
+--- a/gcc/gcc.c        2017-07-04 09:15:57.740793000 +0200
++++ b/gcc/gcc.c        2018-03-02 13:58:44.387741114 +0100
+@@ -857,6 +857,12 @@ proper position among the other output f
+ #define LINK_GCC_C_SEQUENCE_SPEC "%G %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" \
+@@ -1131,7 +1148,7 @@ static const char *cc1_options =
+  %{-version:--version}\
+  %{-help=*:--help=%*}\
+  %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
+- %{fsyntax-only:-o %j} %{-param*}\
++ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\
+  %{coverage:-fprofile-arcs -ftest-coverage}\
+  %{fprofile-arcs|fprofile-generate*|coverage:\
+    %{!fprofile-update=singel:\
+--- a/gcc/params.def   2016-03-30 09:47:40.000000000 +0200
++++ b/gcc/params.def   2016-09-19 12:56:58.443179039 +0200
+@@ -673,7 +673,7 @@ DEFPARAM (PARAM_INTEGER_SHARE_LIMIT,
+ DEFPARAM (PARAM_SSP_BUFFER_SIZE,
+         "ssp-buffer-size",
+         "The lower bound for a buffer to be considered for stack smashing 
protection.",
+-        8, 1, 0)
++        4, 1, 0)
+ 
+ DEFPARAM (PARAM_MIN_SIZE_FOR_STACK_SHARING,
+         "min-size-for-stack-sharing",

diff --git a/8.2.0/gentoo/25_all_alpha-mieee-default.patch 
b/8.2.0/gentoo/25_all_alpha-mieee-default.patch
new file mode 100644
index 0000000..b266d77
--- /dev/null
+++ b/8.2.0/gentoo/25_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 <vap...@gentoo.org>
+
+Note: upstream doesn't want to take this due to long standing behavior, and
+because it'd make behavior across OS's inconsistent:
+       https://gcc.gnu.org/ml/gcc-patches/2003-07/msg02144.html
+
+This makes sense for upstream, but Gentoo is more concerned about packages
+behaving the same across arches under Linux.
+
+--- a/gcc/config/alpha/alpha.h
++++ b/gcc/config/alpha/alpha.h
+@@ -96,6 +96,8 @@ along with GCC; see the file COPYING3.  If not see
+   while (0)
+ #endif
+ 
++#define CPP_SPEC "%{!no-ieee:-mieee}"
++
+ /* Run-time compilation parameters selecting different hardware subsets.  */
+ 
+ /* Which processor to schedule for. The cpu attribute defines a list that
+--- a/gcc/config/alpha/alpha.opt
++++ b/gcc/config/alpha/alpha.opt
+@@ -35,7 +35,7 @@
+ Request IEEE-conformant math library routines (OSF/1).
+ 
+ mieee
+-Target Report RejectNegative Mask(IEEE)
++Target Report Mask(IEEE)
+ Emit IEEE-conformant code, without inexact exceptions.
+ 
+ mieee-with-inexact
+

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

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

diff --git a/8.2.0/gentoo/50_all_libiberty-asprintf.patch 
b/8.2.0/gentoo/50_all_libiberty-asprintf.patch
new file mode 100644
index 0000000..bee0c4c
--- /dev/null
+++ b/8.2.0/gentoo/50_all_libiberty-asprintf.patch
@@ -0,0 +1,18 @@
+2008-07-25  Magnus Granberg  <zo...@ume.nu>
+
+       * include/libiberty.h (asprintf): Don't declare if defined as a macro
+
+--- a/include/libiberty.h
++++ b/include/libiberty.h
+@@ -609,8 +609,11 @@ extern int pwait (int, int *, int);
+ /* 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
+ 
+ #if !HAVE_DECL_VASPRINTF
+ /* Like vsprintf but provides a pointer to malloc'd storage, which

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

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

diff --git a/8.2.0/gentoo/55_all_extra-options.patch 
b/8.2.0/gentoo/55_all_extra-options.patch
new file mode 100644
index 0000000..3e8275f
--- /dev/null
+++ b/8.2.0/gentoo/55_all_extra-options.patch
@@ -0,0 +1,89 @@
+On Hardened we add some options like -fstack-clash-protection and -z now
+
+--- a/gcc/common.opt   2018-03-28 16:51:09.000000000 +0200
++++ a/gcc/common.opt   2018-04-30 15:35:55.274096877 +0200
+@@ -2367,7 +2367,7 @@ Common Alias(fstack-check=, specific, no
+ Insert stack checking code into the program.  Same as -fstack-check=specific.
+ 
+ fstack-clash-protection
+-Common Report Var(flag_stack_clash_protection) Optimization
++Common Report Var(flag_stack_clash_protection) Optimization Init(-1)
+ Insert code to probe each page of stack space as it is allocated to protect
+ from stack-clash style attacks.
+ 
+--- a/gcc/defaults.h   2018-01-03 11:03:58.000000000 +0100
++++ b/gcc/defaults.h   2018-05-01 12:41:29.522851451 +0200
+@@ -1435,6 +1435,15 @@ see the files COPYING3 and COPYING.RUNTI
+ #define STACK_CHECK_MAX_VAR_SIZE (STACK_CHECK_MAX_FRAME_SIZE / 100)
+ #endif
+ 
++/* Default value for flag_clash_protector when flag_clash_protector is
++   initialized to -1.  */
++#ifdef ENABLE_ESP
++#define DEFAULT_FLAG_SCP 1
++#endif
++#ifndef DEFAULT_FLAG_SCP
++#define DEFAULT_FLAG_SCP 0
++#endif
++
+ /* By default, the C++ compiler will use function addresses in the
+    vtable entries.  Setting this nonzero tells the compiler to use
+    function descriptors instead.  The value of this macro says how
+--- a/gcc/toplev.c     2018-02-13 17:18:37.000000000 +0100
++++ b/toplev.c 2018-04-30 16:46:37.244027303 +0200
+@@ -1682,6 +1682,10 @@ process_options (void)
+ 
+   /* -fstack-clash-protection is not currently supported on targets
+      where the stack grows up.  */
++  if (flag_stack_clash_protection == -1)
++    {
++      flag_stack_clash_protection = DEFAULT_FLAG_SCP;
++    }
+   if (flag_stack_clash_protection && !STACK_GROWS_DOWNWARD)
+     {
+       warning_at (UNKNOWN_LOCATION, 0,
+
+--- a/libgcc/Makefile.in       2011-11-22 04:01:02.000000000 +0100
++++ b/libgcc/Makefile.in       2011-12-25 15:18:22.449610631 +0100
+@@ -225,7 +225,7 @@ endif
+ LIBGCC2_DEBUG_CFLAGS = -g
+ LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(HOST_LIBGCC2_CFLAGS) 
\
+                $(LIBGCC2_DEBUG_CFLAGS) -DIN_LIBGCC2 \
+-               -fbuilding-libgcc -fno-stack-protector \
++               -fbuilding-libgcc -fno-stack-protector 
-fno-stack-clash-protection \
+                $(INHIBIT_LIBC_CFLAGS)
+ 
+ # Additional options to use when compiling libgcc2.a.
+@@ -279,7 +290,7 @@ INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CF
+   -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)
++  -fno-stack-clash-protection $(INHIBIT_LIBC_CFLAGS)
+ 
+ # Extra flags to use when compiling crt{begin,end}.o.
+ CRTSTUFF_T_CFLAGS =
+--- a/gcc/gcc.c        2016-02-19 23:18:38.000000000 +0100
++++ b/gcc/gcc.c        2016-05-02 22:56:10.185721270 +0200
+@@ -868,6 +868,12 @@ proper position among the other output f
+ #endif
+ #endif
+ 
++#ifdef EXTRA_OPTIONS
++#define LINK_NOW_SPEC "%{!nonow:-z now} "
++#else
++#define LINK_NOW_SPEC ""
++#endif
++
+ #ifdef ENABLE_DEFAULT_PIE
+ #define NO_PIE_SPEC           "no-pie|static"
+ #define PIE_SPEC              NO_PIE_SPEC "|r|shared:;"
+@@ -1013,7 +1020,7 @@ proper position among the other output f
+     %(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:%{!nostartfiles:%S}} \

diff --git a/8.2.0/gentoo/90_all_pr55930-dependency-tracking.patch 
b/8.2.0/gentoo/90_all_pr55930-dependency-tracking.patch
new file mode 100644
index 0000000..a8743e0
--- /dev/null
+++ b/8.2.0/gentoo/90_all_pr55930-dependency-tracking.patch
@@ -0,0 +1,18 @@
+libatomic build failure if configured with --disable-dependency-tracking
+load_n.c:115:1: fatal error: opening dependency file .deps/load_1_.lo.Ppo: No 
such file or directory
+
+https://bugs.gentoo.org/463463
+http://gcc.gnu.org/PR55930
+
+--- a/libatomic/Makefile.in
++++ b/libatomic/Makefile.in
+@@ -298,7 +298,8 @@ PAT_N = $(word 2,$(PAT_SPLIT))
+ PAT_S = $(word 3,$(PAT_SPLIT))
+ IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
+ IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
+-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
++@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
++@AMDEP_FALSE@M_DEPS =
+ M_SIZE = -DN=$(PAT_N)
+ M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
+ M_FILE = $(PAT_BASE)_n.c

diff --git a/8.2.0/gentoo/92_all_sh-drop-sysroot-suffix.patch 
b/8.2.0/gentoo/92_all_sh-drop-sysroot-suffix.patch
new file mode 100644
index 0000000..3dadd4c
--- /dev/null
+++ b/8.2.0/gentoo/92_all_sh-drop-sysroot-suffix.patch
@@ -0,0 +1,32 @@
+From 5eeeff19bb4978a8d3c0d53bc81744bc25d82993 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <sly...@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 <sly...@gentoo.org>
+---
+ gcc/config.gcc | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/gcc/config.gcc b/gcc/config.gcc
+index 55c314afdbd..c320f24f123 100644
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -2866,8 +2866,6 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
+       if test x${enable_incomplete_targets} = xyes ; then
+               tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 
SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1"
+       fi
+-      tm_file="$tm_file ./sysroot-suffix.h"
+-      tmake_file="$tmake_file t-sysroot-suffix"
+       ;;
+ sh-*-rtems*)
+       tmake_file="${tmake_file} sh/t-sh sh/t-rtems"
+-- 
+2.17.0
+

diff --git a/8.2.0/gentoo/94_all_mips-o32-asan.patch 
b/8.2.0/gentoo/94_all_mips-o32-asan.patch
new file mode 100644
index 0000000..0b14b6a
--- /dev/null
+++ b/8.2.0/gentoo/94_all_mips-o32-asan.patch
@@ -0,0 +1,37 @@
+Update O32 ABI pieces of sanitizer to make it compile again.
+
+https://gcc.gnu.org/bugzilla/PR85663
+diff --git a/libsanitizer/sanitizer_common/sanitizer_atomic_clang_other.h 
b/libsanitizer/sanitizer_common/sanitizer_atomic_clang_other.h
+index a0605bbbd..253f7b5dc 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_atomic_clang_other.h
++++ b/libsanitizer/sanitizer_common/sanitizer_atomic_clang_other.h
+@@ -37,3 +37,3 @@ static struct {
+   char pad[32 - sizeof(int)];
+-} __attribute__((aligned(32))) lock = {0};
++} __attribute__((aligned(32))) lock = {0, {0,}};
+ 
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform.h 
b/libsanitizer/sanitizer_common/sanitizer_platform.h
+index 1eb4d0c61..82875872c 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform.h
+@@ -114,2 +114,11 @@
+ # define SANITIZER_MIPS 1
++# if defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32
++#  define ONE_OF_MIPS_32_N32_64(a, b, c) (a)
++# elif defined(_MIPS_SIM) && _MIPS_SIM == _ABIN32
++#  define ONE_OF_MIPS_32_N32_64(a, b, c) (b)
++# elif defined(_MIPS_SIM) && _MIPS_SIM == _ABI64
++#  define ONE_OF_MIPS_32_N32_64(a, b, c) (c)
++# else
++#  define ONE_OF_MIPS_32_N32_64(a, b, c) sanitizer_platform_unknown_sim
++# endif
+ # if defined(__mips64)
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 
b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+index 4d11d0717..4c6e13830 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -88,3 +88,3 @@ namespace __sanitizer {
+                  SANITIZER_ANDROID ? FIRST_32_SECOND_64(104, 128) :
+-                                     FIRST_32_SECOND_64(160, 216);
++                                     ONE_OF_MIPS_32_N32_64(144, 160, 216);
+   const unsigned struct_kernel_stat64_sz = 104;

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

diff --git a/8.2.0/gentoo/97_all_disable-systemtap-switch.patch 
b/8.2.0/gentoo/97_all_disable-systemtap-switch.patch
new file mode 100644
index 0000000..a40df83
--- /dev/null
+++ b/8.2.0/gentoo/97_all_disable-systemtap-switch.patch
@@ -0,0 +1,142 @@
+From bb510ed7ea82093c924b027489db6f92250a85b3 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <sly...@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 <sly...@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 7d69faf549d..5e96c4f99fc 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -946,6 +946,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
+@@ -1688,6 +1689,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
+@@ -18448,7 +18450,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 18451 "configure"
++#line 18453 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -18554,7 +18556,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 18557 "configure"
++#line 18559 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -29297,17 +29299,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
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index 36124b8ce90..8356e579a20 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -5965,14 +5965,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/8.2.0/gentoo/README.history b/8.2.0/gentoo/README.history
new file mode 100644
index 0000000..4ebb819
--- /dev/null
+++ b/8.2.0/gentoo/README.history
@@ -0,0 +1,18 @@
+1.0            08 Aug 2018
+       + 95_all_ia64-TEXTREL.patch
+       + 97_all_disable-systemtap-switch.patch
+       + 94_all_mips-o32-asan.patch
+       + 13_all_default-ssp-fix.patch
+       + 35_all_i386_libgcc_note.GNU-stack.patch
+       + 55_all_extra-options.patch
+       + 92_all_sh-drop-sysroot-suffix.patch
+       + 10_all_default-fortify-source.patch
+       + 11_all_default-warn-format-security.patch
+       + 12_all_default-warn-trampolines.patch
+       + 13_all_default-ssp-fix.patch
+       + 25_all_alpha-mieee-default.patch
+       + 34_all_ia64_note.GNU-stack.patch
+       + 50_all_libiberty-asprintf.patch
+       + 51_all_libiberty-pic.patch
+       + 54_all_nopie-all-flags.patch
+       + 90_all_pr55930-dependency-tracking.patch

Reply via email to