Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package gcc7.15515 for 
openSUSE:Leap:15.2:Update checked in at 2021-01-17 18:23:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2:Update/gcc7.15515 (Old)
 and      /work/SRC/openSUSE:Leap:15.2:Update/.gcc7.15515.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "gcc7.15515"

Sun Jan 17 18:23:14 2021 rev:1 rq:863130 version:7.5.0+r278197

Changes:
--------
New Changes file:

--- /dev/null   2021-01-11 18:20:20.070723563 +0100
+++ 
/work/SRC/openSUSE:Leap:15.2:Update/.gcc7.15515.new.28504/cross-aarch64-gcc7.changes
        2021-01-17 18:23:15.316010263 +0100
@@ -0,0 +1,645 @@
+-------------------------------------------------------------------
+Mon Jan  4 09:29:07 UTC 2021 - Richard Biener <[email protected]>
+
+- Amend gcc7-aarch64-moutline-atomics.patch for glibc namespace
+  violation with getauxval.  [bsc#1167939]
+
+-------------------------------------------------------------------
+Thu Nov 26 17:17:44 UTC 2020 - Michael Matz <[email protected]>
+
+- Add gcc7-aarch64-sls-miti-1.patch, gcc7-aarch64-sls-miti-2.patch,
+  gcc7-aarch64-sls-miti-3.patch to backport aarch64 Straight Line
+  Speculation mitigation [bsc#1172798, CVE-2020-13844]
+- Add gcc7-fix-retrieval-of-testnames.patch to support usage in
+  testcases added by the above.
+
+-------------------------------------------------------------------
+Thu Nov 26 15:06:50 UTC 2020 - Richard Biener <[email protected]>
+
+- Enable fortran for the nvptx offload compiler. 
+- Do not specify alternate offload compiler location at
+  configure time.
+- Update README.First-for.SuSE.packagers
+
+-------------------------------------------------------------------
+Thu Nov 26 07:58:17 UTC 2020 - Richard Biener <[email protected]>
+
+- Add gcc7-pr88522.patch to avoid assembler errors with AVX512
+  gather and scatter instructions when using -masm=intel.
+- Amend gcc7-remove-Wexpansion-to-defined-from-Wextra.patch to
+  reflect changes in option handling in the testsuite.
+- Add gcc7-testsuite-fixes.patch to fix PR98001 and PR98002 which
+  are broken testcases showing with malloc debugging enabled.
+
+-------------------------------------------------------------------
+Thu Nov 19 08:22:09 UTC 2020 - Richard Biener <[email protected]>
+
+- Add gcc7-aarch64-moutline-atomics.patch to backport the aarch64
+  -moutline-atomics feature and accumulated fixes but not its
+  default enabling.  [jsc#SLE-12209, bsc#1167939]
+- Order gcc7-pr92692.patch after gcc7-aarch64-moutline-atomics.patch
+  and refresh.
+
+-------------------------------------------------------------------
+Mon Nov 16 07:45:55 UTC 2020 - Richard Biener <[email protected]>
+
+- Revert gcc7-pr97774.patch as it causes gdb to crash.
+
+-------------------------------------------------------------------
+Thu Nov 12 13:51:26 UTC 2020 - Richard Biener <[email protected]>
+
+- Fix 32bit libgnat.so link.  [bsc#1178675]
+- Quote %{cross_arch} consistently when comparing expansion
+  against string in RPM %if condition.
+
+-------------------------------------------------------------------
+Tue Nov 10 15:24:57 UTC 2020 - Richard Biener <[email protected]>
+
+- Add gcc7-pr97535.patch to fix memcpy miscompilation on aarch64.
+  [bsc#1178624, bsc#1178577]
+
+-------------------------------------------------------------------
+Tue Nov 10 10:11:33 UTC 2020 - Richard Biener <[email protected]>
+
+- Add gcc7-pr97774.patch to fix debug line info for try/catch.
+  [bsc#1178614]
+
+-------------------------------------------------------------------
+Fri Sep 18 07:25:53 UTC 2020 - Guillaume GARDET <[email protected]>
+
+- Remove -mbranch-protection=standard (aarch64 flag) when gcc7 is
+  used to build gcc7 (ie when ada is enabled)
+
+-------------------------------------------------------------------
+Mon Mar 16 07:20:32 UTC 2020 - Richard Biener <[email protected]>
+
+- Add gcc7-pr94148.patch to fix corruption of pass private ->aux
+  via DF.  [gcc#94148]
+
+-------------------------------------------------------------------
+Wed Mar  4 12:58:17 UTC 2020 - Richard Biener <[email protected]>
+
+- Add gcc7-pr93888.patch to fix debug information issue with
+  inlined functions and passed by reference arguments.  [gcc#93888]
+
+-------------------------------------------------------------------
+Fri Feb 28 16:59:30 UTC 2020 - Martin Li??ka <[email protected]>
+
+- Add gcc7-pr93965.patch in order to fix binutils release
+  date detection issue.
+
+-------------------------------------------------------------------
+Wed Jan 29 09:56:19 UTC 2020 - Richard Biener <[email protected]>
+
+- Add gcc48-bsc1161913.patch to fix register allocation issue with
+  exception handling code on s390x.  [bsc#1161913] 
+
+-------------------------------------------------------------------
+Wed Jan 22 17:25:50 UTC 2020 - [email protected]
+
+- Add gcc7-pr92692.patch: Backport PR target/92692 to fix 
+  miscompilation of some atomic code on aarch64. [bsc#1150164]
+
+-------------------------------------------------------------------
+Mon Jan 20 12:04:04 UTC 2020 - Richard Biener <[email protected]>
+
+- Add gcc7-pr93246.patch: Backport PR middle-end/93246
+
+-------------------------------------------------------------------
+Thu Jan  9 14:26:17 UTC 2020 - Andreas Schwab <[email protected]>
+
+- gcc7-pr92154.patch: Backport PR sanitizer/92154
+
+-------------------------------------------------------------------
+Tue Jan  7 08:38:25 UTC 2020 - Richard Biener <[email protected]>
+
+- Add gcc7-bsc1160086.patch to fix miscompilation in vectorized code
+  for s390x.  [bsc#1160086] [gcc#92950]
+
+-------------------------------------------------------------------
+Thu Nov 14 09:29:39 UTC 2019 - Richard Biener <[email protected]>
+
+- Update to GCC 7.5.0 release.
+- Add gcc7-pr85887.patch to fix miscompilation with thread-safe local
+  static initialization.  [gcc#85887]
+
+-------------------------------------------------------------------
+Wed Oct  2 07:46:40 UTC 2019 - Richard Biener <[email protected]>
+
+- Add gcc7-bsc1146475.patch to fix debug info created for array
+  definitions that complete an earlier declaration.  [bsc#1146475]
+
+-------------------------------------------------------------------
+Mon Sep  9 07:33:54 UTC 2019 - Richard Biener <[email protected]>
+
+- Rework shared spec file parts to allow custom Summary and
+  Description for cross compilers.  Clarify their Summary
+  and Description.  [bsc#1148517]
+- Reorder things in cross.spec.in so the Version define comes before
+  the first use of %version.
+
+-------------------------------------------------------------------
+Thu Sep  5 13:29:56 UTC 2019 - Richard Biener <[email protected]>
+
+- Update to gcc-7-branch head (r275405).
+  * Pulls fix for POWER9 DARN miscompilation.
+    (bsc#1149145, CVE-2019-15847)
+  * Includes gcc8-pr89752.patch
+
+-------------------------------------------------------------------
+Fri Aug 16 09:51:33 UTC 2019 - Richard Biener <[email protected]>
+
+- Remove bogus fixed include bits/statx.h from glibc 2.30.  [gcc#91085]
+
+-------------------------------------------------------------------
+Thu Jul 25 10:51:53 UTC 2019 - [email protected]
+
+- Update to gcc-7-branch head (r273795).
+  * Includes fix for LTO linker plugin heap overflow.
+    (bsc#1142649, CVE-2019-14250)
+
+-------------------------------------------------------------------
+Mon Jul 22 09:47:10 UTC 2019 - [email protected]
+
+- Update to gcc-7-branch head (r273666).
+  * Fixes build with -Werror=return-type.
+
+-------------------------------------------------------------------
+Thu Jul 18 07:10:26 UTC 2019 - [email protected]
+
+- Update to gcc-7-branch head (r273559).
+  * Includes fix for vector shift miscompilation on s390.  [bsc#1141897]
+
+-------------------------------------------------------------------
+Wed Jun 12 10:37:51 UTC 2019 - Martin Li??ka <[email protected]>
+
+- Add gcc7-flive-patching.patch patch.  [bsc#1071995, fate#323487]
+
+-------------------------------------------------------------------
+Wed May 22 12:56:05 UTC 2019 - Martin Li??ka <[email protected]>
+
+- Strip -flto from $optflags.
+
+-------------------------------------------------------------------
+Wed Apr 24 09:52:10 UTC 2019 - [email protected]
+
+- Update to gcc-7-branch head (r270528).
+  * Disables switch jump-tables when retpolines are used.
+  [bsc#1131264, jsc#SLE-6738]
+
+-------------------------------------------------------------------
+Thu Mar 28 08:21:08 UTC 2019 - [email protected]
+
+- Add gcc8-pr89752.patch to fix ICE compiling tensorflow on aarch64.
+  [bsc#1129389]
+
+-------------------------------------------------------------------
+Thu Mar 14 09:19:08 UTC 2019 - [email protected]
++++ 448 more lines (skipped)
++++ between /dev/null
++++ and 
/work/SRC/openSUSE:Leap:15.2:Update/.gcc7.15515.new.28504/cross-aarch64-gcc7.changes
New Changes file:

cross-arm-gcc7.changes: same change
New Changes file:

cross-arm-none-gcc7-bootstrap.changes: same change
New Changes file:

cross-arm-none-gcc7.changes: same change
New Changes file:

cross-avr-gcc7-bootstrap.changes: same change
New Changes file:

cross-avr-gcc7.changes: same change
New Changes file:

cross-epiphany-gcc7-bootstrap.changes: same change
New Changes file:

cross-epiphany-gcc7.changes: same change
New Changes file:

cross-hppa-gcc7.changes: same change
New Changes file:

cross-i386-gcc7.changes: same change
New Changes file:

cross-m68k-gcc7.changes: same change
New Changes file:

cross-mips-gcc7.changes: same change
New Changes file:

cross-nvptx-gcc7.changes: same change
New Changes file:

cross-ppc64-gcc7.changes: same change
New Changes file:

cross-ppc64le-gcc7.changes: same change
New Changes file:

cross-rx-gcc7-bootstrap.changes: same change
New Changes file:

cross-rx-gcc7.changes: same change
New Changes file:

cross-s390x-gcc7.changes: same change
New Changes file:

cross-sparc-gcc7.changes: same change
New Changes file:

cross-sparc64-gcc7.changes: same change
New Changes file:

cross-x86_64-gcc7.changes: same change
New Changes file:

gcc7-testresults.changes: same change
New Changes file:

gcc7.changes: same change

New:
----
  README.First-for.SuSE.packagers
  _constraints
  change_spec
  check-build.sh
  cross-aarch64-gcc7.changes
  cross-aarch64-gcc7.spec
  cross-arm-gcc7.changes
  cross-arm-gcc7.spec
  cross-arm-none-gcc7-bootstrap.changes
  cross-arm-none-gcc7-bootstrap.spec
  cross-arm-none-gcc7.changes
  cross-arm-none-gcc7.spec
  cross-avr-gcc7-bootstrap.changes
  cross-avr-gcc7-bootstrap.spec
  cross-avr-gcc7.changes
  cross-avr-gcc7.spec
  cross-epiphany-gcc7-bootstrap.changes
  cross-epiphany-gcc7-bootstrap.spec
  cross-epiphany-gcc7.changes
  cross-epiphany-gcc7.spec
  cross-hppa-gcc7.changes
  cross-hppa-gcc7.spec
  cross-i386-gcc7.changes
  cross-i386-gcc7.spec
  cross-m68k-gcc7.changes
  cross-m68k-gcc7.spec
  cross-mips-gcc7.changes
  cross-mips-gcc7.spec
  cross-nvptx-gcc7.changes
  cross-nvptx-gcc7.spec
  cross-ppc64-gcc7.changes
  cross-ppc64-gcc7.spec
  cross-ppc64le-gcc7.changes
  cross-ppc64le-gcc7.spec
  cross-rx-gcc7-bootstrap.changes
  cross-rx-gcc7-bootstrap.spec
  cross-rx-gcc7.changes
  cross-rx-gcc7.spec
  cross-s390x-gcc7.changes
  cross-s390x-gcc7.spec
  cross-sparc-gcc7.changes
  cross-sparc-gcc7.spec
  cross-sparc64-gcc7.changes
  cross-sparc64-gcc7.spec
  cross-x86_64-gcc7.changes
  cross-x86_64-gcc7.spec
  cross.spec.in
  gcc-7.5.0+r278197.tar.xz
  gcc-add-defaultsspec.diff
  gcc.spec.in
  gcc41-ppc32-retaddr.patch
  gcc43-no-unwind-tables.diff
  gcc44-rename-info-files.patch
  gcc44-textdomain.patch
  gcc48-bsc1161913.patch
  gcc48-libstdc++-api-reference.patch
  gcc48-remove-mpfr-2.4.0-requirement.patch
  gcc5-no-return-gcc43-workaround.patch
  gcc7-aarch64-moutline-atomics.patch
  gcc7-aarch64-sls-miti-1.patch
  gcc7-aarch64-sls-miti-2.patch
  gcc7-aarch64-sls-miti-3.patch
  gcc7-avoid-fixinc-error.diff
  gcc7-bsc1146475.patch
  gcc7-bsc1160086.patch
  gcc7-fix-retrieval-of-testnames.patch
  gcc7-flive-patching.patch
  gcc7-pr82248.diff
  gcc7-pr85887.patch
  gcc7-pr88522.patch
  gcc7-pr92154.patch
  gcc7-pr92692.patch
  gcc7-pr93246.patch
  gcc7-pr93888.patch
  gcc7-pr93965.patch
  gcc7-pr94148.patch
  gcc7-pr97535.patch
  gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
  gcc7-rpmlintrc
  gcc7-stack-probe.diff
  gcc7-testresults.changes
  gcc7-testresults.spec
  gcc7-testsuite-fixes.patch
  gcc7.changes
  gcc7.spec
  nvptx-newlib.tar.xz
  pre_checkin.sh
  tls-no-direct.diff

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ cross-aarch64-gcc7.spec ++++++
++++ 846 lines (skipped)

cross-arm-gcc7.spec: same change
cross-arm-none-gcc7-bootstrap.spec: same change
cross-arm-none-gcc7.spec: same change
cross-avr-gcc7-bootstrap.spec: same change
cross-avr-gcc7.spec: same change
cross-epiphany-gcc7-bootstrap.spec: same change
cross-epiphany-gcc7.spec: same change
cross-hppa-gcc7.spec: same change
cross-i386-gcc7.spec: same change
cross-m68k-gcc7.spec: same change
cross-mips-gcc7.spec: same change
cross-nvptx-gcc7.spec: same change
cross-ppc64-gcc7.spec: same change
cross-ppc64le-gcc7.spec: same change
cross-rx-gcc7-bootstrap.spec: same change
cross-rx-gcc7.spec: same change
cross-s390x-gcc7.spec: same change
cross-sparc-gcc7.spec: same change
cross-sparc64-gcc7.spec: same change
cross-x86_64-gcc7.spec: same change
gcc7-testresults.spec: same change
gcc7.spec: same change
++++++ README.First-for.SuSE.packagers ++++++
IMPORTANT: Please change gcc.spec.in or cross.spec.in and then
run ./pre_checkin.sh!  Do not change any .spec directly!

Since GCC comes with a testsuite that runs for quite a long time and
that test suite also contains some known failures, we should run the
testsuite of GCC whenever the compiler is changed to ensure a high
quality compiler.

The package is now split into two parts, gcc$VER and gcc$VER-testresults
(plus various spec files for cross and offload).  The testsuite is run from
gcc$VER-testresults.spec, a dummy source package with the actual testresults,
gcc$VER-testresults, generated from it which contains testing logfiles and
a summary.

Before checking in a new compiler, please do the following steps as QA
measure to check that the new compiler does not introduce any new
failures:

- In your branch project make sure at least gcc$VER and gcc$VER-testresults
  are built for all relevant architectures of the product

- When the build finished, call
    /suse/rguenther/bin/compare-testresults-bs.sh \
      gcc$VER-testresults gcc$VER-testresults \
      SUSE:SLE-15:Update standard .1234 \
      home:user:branches:gcc standard
  It will compare testresults of the base (shipped in the product already,
  look for the magic .1234 suffix as to the latest released update) to
  your proposed update.  The differences will be recorded in a temporary
  directory which is printed as output, they should not contain any new
  failures.  If they do, please fix them or discuss this with the gcc
  package maintainers.

- Do not remove this file.

Thanks,
Your GCC packagers.
++++++ _constraints ++++++
<constraints>
  <hardware>
    <disk>
      <size unit="G">16</size>
    </disk>
    <physicalmemory>
      <size unit="G">4</size>
    </physicalmemory>
    <processors>4</processors>
  </hardware>
</constraints>
++++++ change_spec ++++++
#!/bin/bash

do_crosses=1
do_optional_compiler_languages=0
rm -f gcc*-testresults.spec gcc*-testresults.changes gcc*.spec cross*.spec 
cross*.changes

# Default is to generate the normal gcc package
# unless a parameter is given.  In case that it is '-*',
# that parameter will be used as suffix for the package name
# and as suffix for the install path (/opt/gccSUFFIX)
# In case that it is '[0-9]*', that parameter will be used
# as a suffix for a versioned package name.

if [ $# -lt 1 ]; then
        echo No package suffix given
        outfile=gcc.spec
else
        case $1 in
        [0-9]*)
          base_ver=$1
          outfile=gcc$1.spec
        ;;
        *)
          echo Invalid package suffix
          exit 1
        ;;
        esac
fi

        : > $outfile
        if test "$do_optional_compiler_languages" = "1"; then
            echo '%define build_optional_compiler_languages 1' >> $outfile
        fi
        sed -e 's%@base_ver@%'$base_ver'%g' \
            gcc.spec.in \
        | sed -n -e '{
/^# PACKAGE-BEGIN/h
/^# PACKAGE-BEGIN/,/^# PACKAGE-END/H
/^# PACKAGE-BEGIN/,/^# PACKAGE-END/!p
/^# PACKAGE-END/{g
s/@variant@//g
p
g
s/@variant@/-32bit/g
p
g
s/@variant@/-64bit/g
p
}
}' >> $outfile

        echo '%define building_testsuite 1' > gcc$base_ver-testresults.spec
        echo '%define run_tests 1' >> gcc$base_ver-testresults.spec
        sed -e '/^# GCC-TESTSUITE-DELETE-BEGIN/,/^# 
GCC-TESTSUITE-DELETE-END/d;s/-n 
gcc@base_ver@-testresults$//g;s/^Name:[[:space:]]*gcc@base_ver@/Name: 
gcc@base_ver@-testresults/g' \
            gcc.spec.in \
        | sed -e 's%@base_ver@%'$base_ver'%g' \
>> gcc$base_ver-testresults.spec
  test -f gcc$base_ver.changes \
    && ( ln -f gcc$base_ver.changes gcc$base_ver-testresults.changes; )



add_cross() {
  local pkgname="$1"; shift
  local rpmtarget="$1"; shift
  local triplet="$1"; shift

  echo "%define pkgname $pkgname" > $pkgname.spec
  echo "%define cross_arch $rpmtarget" >> $pkgname.spec
  echo "%define gcc_target_arch $triplet" >> $pkgname.spec
  echo "$@" >> $pkgname.spec
  { sed -n -e '1,/SRC-COMMON-BEGIN/p' cross.spec.in
    sed -n -e '/SRC-COMMON-BEGIN/,/SRC-COMMON-END/p' $outfile
    sed -n -e '/SRC-COMMON-END/,/BUILD-COMMON-BEGIN/p' cross.spec.in
    sed -n -e '/BUILD-COMMON-BEGIN/,/BUILD-COMMON-END/p' $outfile
    sed -n -e '/BUILD-COMMON-END/,$p' cross.spec.in; } |
    sed -e "s#@base_ver@#$base_ver#" \
        -e "s/^\(ExclusiveArch.*\) $rpmtarget[^ \r]*/\1 /" \
      >> $pkgname.spec
  test -f gcc$base_ver.changes && ln -f gcc$base_ver.changes $pkgname.changes
}

add_newlib_cross() {
  add_cross $1-bootstrap $2 $3 "%define gcc_target_newlib 1
%define gcc_libc_bootstrap 1"
  add_cross $1           $2 $3 "%define gcc_target_newlib 1"
}

# We now support "proper" cross-compilers to suse targets via a
# cross-glibc package, enable that via for example
#
# add_cross cross-aarch64-gcc$base_ver aarch64 aarch64-suse-linux
#
# For now keep the old way of doing things
if test "$do_crosses" = 1 ; then
add_cross cross-aarch64-gcc$base_ver aarch64 aarch64-suse-linux %define 
gcc_icecream 1
add_cross cross-arm-gcc$base_ver arm arm-suse-linux-gnueabi %define 
gcc_icecream 0
add_cross cross-avr-gcc$base_ver-bootstrap avr avr "%define gcc_libc_bootstrap 
1"
add_cross cross-avr-gcc$base_ver avr avr
add_cross cross-i386-gcc$base_ver i386 i586-suse-linux %define gcc_icecream 1
add_cross cross-x86_64-gcc$base_ver x86_64 x86_64-suse-linux %define 
gcc_icecream 1
add_cross cross-s390x-gcc$base_ver s390x s390x-suse-linux %define gcc_icecream 1
add_cross cross-sparc-gcc$base_ver sparcv9 sparc-suse-linux %define 
gcc_icecream 1
add_cross cross-sparc64-gcc$base_ver sparc64 sparc64-suse-linux %define 
gcc_icecream 1
add_cross cross-ppc64-gcc$base_ver ppc64 powerpc64-suse-linux %define 
gcc_icecream 1
add_cross cross-ppc64le-gcc$base_ver ppc64le powerpc64le-suse-linux %define 
gcc_icecream 1
add_cross cross-m68k-gcc$base_ver m68k m68k-suse-linux %define gcc_icecream 1
add_cross cross-mips-gcc$base_ver mips mips-suse-linux %define gcc_icecream 1
add_cross cross-hppa-gcc$base_ver hppa hppa-suse-linux %define gcc_icecream 1
add_newlib_cross cross-arm-none-gcc$base_ver arm-none arm-none-eabi
add_newlib_cross cross-epiphany-gcc$base_ver epiphany epiphany-elf
add_newlib_cross cross-rx-gcc$base_ver rx rx-elf
#add_newlib_cross cross-rl78-gcc$base_ver rl78 rl78-elf
#add_newlib_cross cross-nds32le-gcc$base_ver nds32le nds32le-elf
fi
# the nvptx cross is used for offloading
add_cross cross-nvptx-gcc$base_ver nvptx nvptx-none %define gcc_accel 1

for f in *.spec; do
  sed -i -e '/^# .*-\(BEGIN\|END\)$/d' $f
done

osc service localrun format_spec_file

exit 0
++++++ check-build.sh ++++++
#!/bin/bash
# Copyright (c) 2003,2005 SUSE Linux Products GmbH, Germany.  All rights 
reserved.
#
# Authors: Thorsten Kukuk <[email protected]>
#
# this script use the following variable(s):
# 
# - $BUILD_BASENAME
#

case $BUILD_BASENAME in
   *ppc*)
        # Our biarch 32-bit compiler needs to be build on a 64-bit machine,
        # otherwise some configure checks fail.
        # Note that we cannot use uname here since powerpc32 was invoked
        # already.
        grep 'series64\|ppc64' /proc/version > /dev/null
        if [ $? -ne 0 ] ; then
          echo "build does not work on `hostname` for gcc"
          exit 1
        fi
        ;;
   *x86_64*)
        #if [ `ulimit -v` -le 740000 ] ; then
        #  echo "build does not work on ("`hostname`" for gcc)"
        #  exit 1
        #fi
        if [ `getconf _NPROCESSORS_CONF` -lt  2 ] ; then
          echo "build does not work on `hostname` for gcc"
          exit 1
        fi
        ;;
   *)
        ;;
esac

exit 0

++++++ cross.spec.in ++++++
#
# spec file for package gcc (Version 4.0.1)
#
# Copyright (c) 2005 SUSE Linux AG, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://www.suse.de/feedback/
#

# nospeccleaner

%define build_cp 0%{!?gcc_accel:1}
%define build_ada 0
%define build_libjava 0
%define build_java 0

%define build_fortran 0%{?gcc_accel:1}
%define build_objc 0
%define build_objcp 0
%define build_go 0
%define build_hsa 0
%define build_nvptx 0

%define enable_plugins 0

%define binutils_target %{cross_arch}
%if "%{cross_arch}" == "armv7l" || "%{cross_arch}" == "armv7hl"
%define binutils_target arm
%endif
%if "%{cross_arch}" == "armv6l" || "%{cross_arch}" == "armv6hl"
%define binutils_target arm
%endif
%if "%{cross_arch}" == "armv5tel"
%define binutils_target arm
%endif
%if "%{cross_arch}" == "arm-none"
%define binutils_target arm
%define build_cp 0
%endif
%if "%{cross_arch}" == "sparcv9"
%define binutils_target sparc
%endif
%define canonical_target %(echo %{binutils_target} | sed -e 
"s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
%if "%{binutils_target}" == "avr" || "%{binutils_target}" == "spu"
%define binutils_os %{canonical_target}
%else
%if "%{binutils_target}" == "epiphany" || "%{binutils_target}" == "nds32le" || 
"%{binutils_target}" == "rl78" || "%{binutils_target}" == "rx"
%define binutils_os %{canonical_target}-elf
%else
%if "%{binutils_target}" == "arm"
%define binutils_os %{canonical_target}-suse-linux-gnueabi
%else
%if 0%{?gcc_accel:1}
%define binutils_os %{gcc_target_arch}
%else
%define binutils_os %{canonical_target}-suse-linux
%endif
%endif
%endif
%endif

%if 0%{?gcc_icecream:1}
%define sysroot %{_prefix}/%{gcc_target_arch}
%else
# offloading builds newlib in-tree and can install in
# the GCC private path without extra sysroot
%if 0%{!?gcc_accel:1}
# use same sysroot as in binutils.spec
%define sysroot %{_prefix}/%{binutils_os}/sys-root
%endif
%endif

%if %{suse_version} >= 1220
%define selfconflict() %1
%else
%define selfconflict() otherproviders(%1)
%endif

Name:         %{pkgname}
# SRC-COMMON-BEGIN
# SRC-COMMON-END
%if "%{cross_arch}" != "nvptx"
BuildRequires: cross-%{binutils_target}-binutils
Requires: cross-%{binutils_target}-binutils
%endif
BuildRequires: gcc-c++
BuildRequires: bison
BuildRequires: flex
BuildRequires: gettext-devel
BuildRequires: glibc-devel-32bit
BuildRequires: mpc-devel
BuildRequires: mpfr-devel
BuildRequires: perl
%if %{suse_version} > 1220
BuildRequires: makeinfo
%else
BuildRequires: texinfo
%endif
BuildRequires: zlib-devel
%ifarch %ix86 x86_64 ppc ppc64 s390 s390x ia64 %sparc hppa %arm
BuildRequires: isl-devel
%endif
%ifarch ia64
BuildRequires: libunwind-devel
%endif
%if 0%{!?gcc_icecream:1}
%if 0%{?gcc_target_newlib:1} && 0%{!?gcc_libc_bootstrap:1}
BuildRequires: cross-%cross_arch-newlib-devel
%endif
%if 0%{!?gcc_libc_bootstrap:1} && "%{cross_arch}" == "avr"
BuildRequires: avr-libc
%endif
%if 0%{?gcc_target_glibc:1}
BuildRequires: cross-%cross_arch-glibc-devel
%endif
%if "%{cross_arch}" == "nvptx"
BuildRequires: nvptx-tools
Requires: nvptx-tools
Requires: cross-nvptx-newlib-devel >= %{version}-%{release}
ExclusiveArch: x86_64
%define nvptx_newlib 1
%endif
%endif
%if 0%{?gcc_icecream:1}
ExclusiveArch: ppc64le ppc64 x86_64 s390x aarch64
%endif
%define _binary_payload w.ufdio
# Obsolete cross-ppc-gcc49 from cross-ppc64-gcc49 which has
# file conflicts with it and is no longer packaged
%if "%pkgname" == "cross-ppc64-gcc49"
Obsoletes: cross-ppc-gcc49 <= 4.9.0+r209354
%endif
%if 0%{?gcc_target_newlib:1}
# Generally only one cross for the same target triplet can be installed
# at the same time as we are populating a non-version-specific sysroot
Provides: %{gcc_target_arch}-gcc
Conflicts: %selfconflict %{gcc_target_arch}-gcc
%endif
%if 0%{?gcc_libc_bootstrap:1}
# The -bootstrap packages file-conflict with the non-bootstrap variants.
# Even if we don't actually (want to) distribute the bootstrap variants
# the following avoids repo-checker spamming us endlessly.
Conflicts: cross-%{cross_arch}-gcc@base_ver@
%endif
#!BuildIgnore: gcc-PIE
BuildRequires:  update-alternatives
Requires(post): update-alternatives
Requires(preun): update-alternatives
Summary:       The GNU Compiler Collection targeting %{cross_arch}
License:       GPL-3.0-or-later

%description
The GNU Compiler Collection as a cross-compiler targeting %{cross_arch}.
%if 0%{?gcc_icecream:1}
Note this is only useful for building freestanding things like the
kernel since it fails to include target libraries and headers.
%endif
%if 0%{?gcc_libc_bootstrap:1}
This is a package that is necessary for bootstrapping another package
only, it is not intended for any other use.
%endif

# BUILD-COMMON-BEGIN
# BUILD-COMMON-END
%if 0%{!?gcc_icecream:1} && 0%{!?gcc_libc_bootstrap:1}
make %{?_smp_mflags}
%else
make %{?_smp_mflags} all-host
%endif


%if 0%{?gcc_icecream:%gcc_icecream}
%package -n cross-%cross_arch-gcc@base_ver@-icecream-backend
Summary: Icecream backend for the GNU C Compiler
Group:  Development/Languages/C and C++

%description -n cross-%cross_arch-gcc@base_ver@-icecream-backend
This package contains the icecream environment for the GNU C Compiler
%endif


%if 0%{?nvptx_newlib:1}
%package -n cross-nvptx-newlib@base_ver@-devel
Summary: newlib for the nvptx offload target
Group:  Development/Languages/C and C++
Provides: cross-nvptx-newlib-devel = %{version}-%{release}
Conflicts: cross-nvptx-newlib-devel

%description -n cross-nvptx-newlib@base_ver@-devel
Newlib development files for the nvptx offload target compiler.
%endif


%define targetlibsubdir %{_libdir}/gcc/%{gcc_target_arch}/%{gcc_dir_version}

%install
cd obj-%{GCCDIST}

# install and fixup host parts
make DESTDIR=$RPM_BUILD_ROOT install-host
rm -rf $RPM_BUILD_ROOT/%{targetlibsubdir}/install-tools
rm -f $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.la
# common fixup
rm -f $RPM_BUILD_ROOT%{_libdir}/libiberty.a


# install and fixup target parts
# debugedit is not prepared for this and crashes
%if 0%{?gcc_icecream:1}
# so expect the sysroot to be populated from natively built binaries
%else
%if 0%{!?gcc_libc_bootstrap:1}
export NO_BRP_STRIP_DEBUG=true
export NO_DEBUGINFO_STRIP_DEBUG=true
%define __debug_install_post %{nil}
: >../debugfiles.list
: >../debugsourcefiles.list
: >../debugsources.list
# We want shared libraries to reside in the sysroot but the .so symlinks
# on the host.  Once we have a cross target that has shared libs we need
# to manually fix up things here like we do for non-cross compilers
mkdir -p $RPM_BUILD_ROOT/%{?sysroot:%sysroot}
make DESTDIR=$RPM_BUILD_ROOT install-target
%if %{build_cp}
# So we installed libstdc++ headers into %prefix where they conflict
# with other host compilers.  Rip out the non-target specific parts
# again.  Note not all cross targets support libstdc++, so create the
# directory to make things easier.
mkdir -p $RPM_BUILD_ROOT/%_prefix/include/c++/%{gcc_dir_version}
find $RPM_BUILD_ROOT/%_prefix/include/c++/%{gcc_dir_version} -mindepth 1 
-maxdepth 1 -type d -a -not -name %{gcc_target_arch} | xargs -r rm -r
find $RPM_BUILD_ROOT/%_prefix/include/c++/%{gcc_dir_version} -maxdepth 1 -type 
f | xargs -r rm
# And also remove installed pretty printers which conflict in similar ways
rm -rf $RPM_BUILD_ROOT/%{_datadir}/gcc%{binsuffix}
%endif
%endif
%endif

%if 0%{?binutils_os:1}
for prog in as ld; do
  ln -s /usr/%{binutils_os}/bin/$prog $RPM_BUILD_ROOT%{targetlibsubdir}/
done
%endif

# remove docs
rm -rf $RPM_BUILD_ROOT%{_mandir}
rm -rf $RPM_BUILD_ROOT%{_infodir}

# for accelerators remove all frontends but lto1 and also install-tools
%if 0%{?gcc_accel:1}
rm -f $RPM_BUILD_ROOT%{libsubdir}/accel/%{gcc_target_arch}/cc1
rm -f $RPM_BUILD_ROOT%{libsubdir}/accel/%{gcc_target_arch}/cc1plus
rm -rf $RPM_BUILD_ROOT%{libsubdir}/accel/%{gcc_target_arch}/install-tools
rm -rf $RPM_BUILD_ROOT%{targetlibsubdir}/install-tools
# also move things from target directories into the accel path since
# that is the place where we later search for (only)
( cd $RPM_BUILD_ROOT%{targetlibsubdir} && tar cf - . ) | ( cd 
$RPM_BUILD_ROOT%{libsubdir}/accel/%{gcc_target_arch} && tar xf - )
rm -rf $RPM_BUILD_ROOT%{targetlibsubdir}
%endif

%if 0%{?gcc_icecream:%gcc_icecream}
# Build an icecream environment
# The assembler comes from the cross-binutils, and hence is _not_
# named funnily, not even on ppc, so there we need the original target
install -s -D %{_prefix}/bin/%{binutils_os}-as \
        $RPM_BUILD_ROOT/env/usr/bin/as
install -s $RPM_BUILD_ROOT/%{_prefix}/bin/%{gcc_target_arch}-g++%{binsuffix} \
        $RPM_BUILD_ROOT/env/usr/bin/g++
install -s $RPM_BUILD_ROOT/%{_prefix}/bin/%{gcc_target_arch}-gcc%{binsuffix} \
        $RPM_BUILD_ROOT/env/usr/bin/gcc

for back in cc1 cc1plus; do 
        install -s -D $RPM_BUILD_ROOT/%{targetlibsubdir}/$back \
                $RPM_BUILD_ROOT/env%{targetlibsubdir}/$back
done
if test -f $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.so; then
  install -s -D $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.so \
                $RPM_BUILD_ROOT/env%{targetlibsubdir}/liblto_plugin.so
fi

# Make sure to also pull in all shared library requirements for the
# binaries we put into the environment which is operated by chrooting
# into it and execing the compiler
libs=`for bin in $RPM_BUILD_ROOT/env/usr/bin/* 
$RPM_BUILD_ROOT/env%{targetlibsubdir}/*; do \
  ldd $bin | sed -n '\,^[^/]*\(/[^ ]*\).*,{ s//\1/; p; }'  ;\
done | sort -u `
for lib in $libs; do
  # Check wether the same library also exists in the parent directory,
  # and prefer that on the assumption that it is a more generic one.
  baselib=`echo "$lib" | sed 's,/[^/]*\(/[^/]*\)$,\1,'`
  test -f "$baselib" && lib=$baselib
  install -s -D $lib $RPM_BUILD_ROOT/env$lib
done

cd $RPM_BUILD_ROOT/env
tar --no-recursion --mtime @${SOURCE_DATE_EPOCH:-$(date +%s)} --format=gnu -cv 
`find *|LC_ALL=C sort` |\
  gzip -n9 > ../%{name}_%{_arch}.tar.gz
cd ..
mkdir -p usr/share/icecream-envs
mv %{name}_%{_arch}.tar.gz usr/share/icecream-envs
rpm -q --changelog glibc >  usr/share/icecream-envs/%{name}_%{_arch}.glibc
rpm -q --changelog binutils >  usr/share/icecream-envs/%{name}_%{_arch}.binutils
rm -r env
%endif

# we provide update-alternatives for selecting a compiler version for
# crosses
%if 0%{!?gcc_accel:1}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for ex in gcc cpp \
%if %{build_cp}
          c++ g++ \
%endif
          gcc-ar gcc-nm gcc-ranlib gcov gcov-dump gcov-tool; do
  ln -s %{_sysconfdir}/alternatives/%{gcc_target_arch}-$ex \
        %{buildroot}%{_bindir}/%{gcc_target_arch}-$ex
done

%post
%{_sbindir}/update-alternatives \
  --install %{_bindir}/%{gcc_target_arch}-gcc %{gcc_target_arch}-gcc 
%{_bindir}/%{gcc_target_arch}-gcc%{binsuffix} @base_ver@ \
  --slave %{_bindir}/%{gcc_target_arch}-cpp %{gcc_target_arch}-cpp 
%{_bindir}/%{gcc_target_arch}-cpp%{binsuffix} \
%if %{build_cp}
  --slave %{_bindir}/%{gcc_target_arch}-c++ %{gcc_target_arch}-c++ 
%{_bindir}/%{gcc_target_arch}-c++%{binsuffix} \
  --slave %{_bindir}/%{gcc_target_arch}-g++ %{gcc_target_arch}-g++ 
%{_bindir}/%{gcc_target_arch}-g++%{binsuffix} \
%endif
  --slave %{_bindir}/%{gcc_target_arch}-gcc-ar %{gcc_target_arch}-gcc-ar 
%{_bindir}/%{gcc_target_arch}-gcc-ar%{binsuffix} \
  --slave %{_bindir}/%{gcc_target_arch}-gcc-nm %{gcc_target_arch}-gcc-nm 
%{_bindir}/%{gcc_target_arch}-gcc-nm%{binsuffix} \
  --slave %{_bindir}/%{gcc_target_arch}-gcc-ranlib 
%{gcc_target_arch}-gcc-ranlib 
%{_bindir}/%{gcc_target_arch}-gcc-ranlib%{binsuffix} \
  --slave %{_bindir}/%{gcc_target_arch}-gcov %{gcc_target_arch}-gcov 
%{_bindir}/%{gcc_target_arch}-gcov%{binsuffix} \
  --slave %{_bindir}/%{gcc_target_arch}-gcov-dump %{gcc_target_arch}-gcov-dump 
%{_bindir}/%{gcc_target_arch}-gcov-dump%{binsuffix} \
  --slave %{_bindir}/%{gcc_target_arch}-gcov-tool %{gcc_target_arch}-gcov-tool 
%{_bindir}/%{gcc_target_arch}-gcov-tool%{binsuffix}

%postun
if [ ! -f %{_bindir}/%{gcc_target_arch}-gcc ] ; then
  %{_sbindir}/update-alternatives --remove %{gcc_target_arch}-gcc 
%{_bindir}/%{gcc_target_arch}-gcc%{binsuffix}
fi
%endif

%files
%defattr(-,root,root)
%if 0%{?gcc_accel:1}
%{_prefix}/bin/%{GCCDIST}-accel-%{gcc_target_arch}-*
%dir %{libsubdir}
%dir %{libsubdir}/accel
%{libsubdir}/accel/%{gcc_target_arch}
%else
%{_prefix}/bin/%{gcc_target_arch}-gcc%{binsuffix}
%{_prefix}/bin/%{gcc_target_arch}-cpp%{binsuffix}
%{_prefix}/bin/%{gcc_target_arch}-gcc-ar%{binsuffix}
%{_prefix}/bin/%{gcc_target_arch}-gcc-nm%{binsuffix}
%{_prefix}/bin/%{gcc_target_arch}-gcc-ranlib%{binsuffix}
%{_prefix}/bin/%{gcc_target_arch}-gcov%{binsuffix}
%{_prefix}/bin/%{gcc_target_arch}-gcov-dump%{binsuffix}
%{_prefix}/bin/%{gcc_target_arch}-gcov-tool%{binsuffix}
%{_prefix}/bin/%{gcc_target_arch}-gcc
%{_prefix}/bin/%{gcc_target_arch}-cpp
%{_prefix}/bin/%{gcc_target_arch}-gcc-ar
%{_prefix}/bin/%{gcc_target_arch}-gcc-nm
%{_prefix}/bin/%{gcc_target_arch}-gcc-ranlib
%{_prefix}/bin/%{gcc_target_arch}-gcov
%{_prefix}/bin/%{gcc_target_arch}-gcov-dump
%{_prefix}/bin/%{gcc_target_arch}-gcov-tool
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-cpp
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc-ar
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc-nm
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc-ranlib
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcov
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcov-dump
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcov-tool
%if %{build_cp}
%{_prefix}/bin/%{gcc_target_arch}-c++%{binsuffix}
%{_prefix}/bin/%{gcc_target_arch}-g++%{binsuffix}
%{_prefix}/bin/%{gcc_target_arch}-c++
%{_prefix}/bin/%{gcc_target_arch}-g++
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-c++
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-g++
%if 0%{!?gcc_libc_bootstrap:1}
%if "%{cross_arch}" == "avr" || 0%{?gcc_target_newlib:1} || 
0%{?gcc_target_glibc:1}
%{_prefix}/include/c++
%endif
%endif
%endif
%dir %{targetlibsubdir}
%dir %{_libdir}/gcc/%{gcc_target_arch}
%{targetlibsubdir}
%endif
%if 0%{!?gcc_icecream:1} && 0%{!?gcc_libc_bootstrap:1} && 0%{?sysroot:1}
%{sysroot}
%endif

%if 0%{?gcc_icecream:%gcc_icecream}
%files -n cross-%cross_arch-gcc@base_ver@-icecream-backend
%defattr(-,root,root)
/usr/share/icecream-envs
%endif

%if 0%{?nvptx_newlib:1}
%files -n cross-nvptx-newlib@base_ver@-devel
%defattr(-,root,root)
%{_prefix}/%{gcc_target_arch}
%endif

%changelog -n cross-%{pkgname}-gcc@base_ver@
++++++ gcc-add-defaultsspec.diff ++++++
Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c.orig      2013-11-26 15:41:59.000000000 +0100
+++ gcc/gcc.c   2013-11-26 16:40:35.780548125 +0100
@@ -258,6 +258,7 @@ static const char *replace_outfile_spec_
 static const char *remove_outfile_spec_function (int, const char **);
 static const char *version_compare_spec_function (int, const char **);
 static const char *include_spec_function (int, const char **);
+static const char *include_noerr_spec_function (int, const char **);
 static const char *find_file_spec_function (int, const char **);
 static const char *find_plugindir_spec_function (int, const char **);
 static const char *print_asm_header_spec_function (int, const char **);
@@ -1357,6 +1358,7 @@ static const struct spec_function static
   { "remove-outfile",          remove_outfile_spec_function },
   { "version-compare",         version_compare_spec_function },
   { "include",                 include_spec_function },
+  { "include_noerr",            include_noerr_spec_function },
   { "find-file",               find_file_spec_function },
   { "find-plugindir",          find_plugindir_spec_function },
   { "print-asm-header",                print_asm_header_spec_function },
@@ -6480,6 +6482,8 @@ main (int argc, char **argv)
   if (access (specs_file, R_OK) == 0)
     read_specs (specs_file, true, false);
 
+  do_self_spec ("%:include_noerr(defaults.spec)%(default_spec)");
+
   /* Process any configure-time defaults specified for the command line
      options, via OPTION_DEFAULT_SPECS.  */
   for (i = 0; i < ARRAY_SIZE (option_default_specs); i++)
@@ -8401,6 +8405,21 @@ get_random_number (void)
   return ret ^ getpid ();
 }
 
+static const char *
+include_noerr_spec_function (int argc, const char **argv)
+{
+  char *file;
+
+  if (argc != 1)
+    abort ();
+
+  file = find_a_file (&startfile_prefixes, argv[0], R_OK, 0);
+  if (file)
+    read_specs (file, FALSE, TRUE);
+
+  return NULL;
+}
+
 /* %:compare-debug-dump-opt spec function.  Save the last argument,
    expected to be the last -fdump-final-insns option, or generate a
    temporary.  */
++++++ gcc.spec.in ++++++
++++ 2531 lines (skipped)

++++++ gcc41-ppc32-retaddr.patch ++++++
2005-11-28  Jakub Jelinek  <[email protected]>

        * config/rs6000/rs6000.c (rs6000_return_addr): If COUNT == 0,
        read word RETURN_ADDRESS_OFFSET bytes above arg_pointer_rtx
        instead of doing an extran indirection from frame_pointer_rtx.

        * gcc.dg/20051128-1.c: New test.

#Index: gcc/config/rs6000/rs6000.c
#===================================================================
#--- gcc/config/rs6000/rs6000.c.orig    2013-11-26 15:42:33.000000000 +0100
#+++ gcc/config/rs6000/rs6000.c 2013-11-26 16:44:14.566089231 +0100
#@@ -20878,18 +20878,22 @@ rs6000_return_addr (int count, rtx frame
   if (count != 0
       || ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN) && flag_pic))
     {
+      rtx x;
       cfun->machine->ra_needs_full_frame = 1;
 
-      return
-       gen_rtx_MEM
-         (Pmode,
-          memory_address
-          (Pmode,
-           plus_constant (Pmode,
-                          copy_to_reg
-                          (gen_rtx_MEM (Pmode,
-                                        memory_address (Pmode, frame))),
-                          RETURN_ADDRESS_OFFSET)));
+      if (count == 0)
+       {
+         gcc_assert (frame == frame_pointer_rtx);
+         x = arg_pointer_rtx;
+       }
+      else
+       {
+         x = memory_address (Pmode, frame);
+         x = copy_to_reg (gen_rtx_MEM (Pmode, x));
+       }
+
+      x = plus_constant (Pmode, x, RETURN_ADDRESS_OFFSET);
+      return gen_rtx_MEM (Pmode, memory_address (Pmode, x));
     }
 
   cfun->machine->ra_need_lr = 1;
Index: gcc/testsuite/gcc.dg/20051128-1.c
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ gcc/testsuite/gcc.dg/20051128-1.c   2013-11-26 16:44:14.566089231 +0100
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fpic" } */
+
+extern void exit (int);
+extern void abort (void);
+
+int b;
+
+struct A
+{
+  void *pad[147];
+  void *ra, *h;
+  long o;
+};
+
+void
+__attribute__((noinline))
+foo (struct A *a, void *x)
+{
+  __builtin_memset (a, 0, sizeof (a));
+  if (!b)
+    exit (0);
+}
+
+void
+__attribute__((noinline))
+bar (void)
+{
+  struct A a;
+
+  __builtin_unwind_init ();
+  foo (&a, __builtin_return_address (0));
+}
+
+int
+main (void)
+{
+  bar ();
+  abort ();
+  return 0;
+}
++++++ gcc43-no-unwind-tables.diff ++++++
Index: libgcc/Makefile.in
===================================================================
--- libgcc/Makefile.in.orig     2015-12-14 11:33:03.225790694 +0100
+++ libgcc/Makefile.in  2015-12-17 15:09:45.415136693 +0100
@@ -288,7 +288,7 @@ CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(IN
   $(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)
+  $(INHIBIT_LIBC_CFLAGS) -fno-unwind-tables -fno-asynchronous-unwind-tables
 
 # Extra flags to use when compiling crt{begin,end}.o.
 CRTSTUFF_T_CFLAGS =
++++++ gcc44-rename-info-files.patch ++++++
++++ 665 lines (skipped)

++++++ gcc44-textdomain.patch ++++++
#! /bin/sh -e

# DP: Set gettext's domain and textdomain to the versioned package name.

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        ;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0


Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in.orig        2013-11-26 16:46:03.000000000 +0100
+++ gcc/Makefile.in     2013-11-26 16:46:43.271816000 +0100
@@ -3795,8 +3795,8 @@ install-po:
          dir=$(localedir)/$$lang/LC_MESSAGES; \
          echo $(mkinstalldirs) $(DESTDIR)$$dir; \
          $(mkinstalldirs) $(DESTDIR)$$dir || exit 1; \
-         echo $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/gcc.mo; \
-         $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/gcc.mo; \
+         echo $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/gcc-7.mo; \
+         $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/gcc-7.mo; \
        done
 
 # Rule for regenerating the message template (gcc.pot).
Index: gcc/intl.c
===================================================================
--- gcc/intl.c.orig     2013-11-26 15:42:31.000000000 +0100
+++ gcc/intl.c  2013-11-26 16:46:43.271816000 +0100
@@ -55,8 +55,8 @@ gcc_init_libintl (void)
   setlocale (LC_ALL, "");
 #endif
 
-  (void) bindtextdomain ("gcc", LOCALEDIR);
-  (void) textdomain ("gcc");
+  (void) bindtextdomain ("gcc-7", LOCALEDIR);
+  (void) textdomain ("gcc-7");
 
   /* Opening quotation mark.  */
   open_quote = _("`");
Index: libcpp/Makefile.in
===================================================================
--- libcpp/Makefile.in.orig     2013-11-26 16:26:56.000000000 +0100
+++ libcpp/Makefile.in  2013-11-26 16:47:15.764193260 +0100
@@ -49,6 +49,7 @@ LDFLAGS = @LDFLAGS@
 LIBICONV = @LIBICONV@
 LIBINTL = @LIBINTL@
 PACKAGE = @PACKAGE@
+PACKAGE_SUFFIX = -7
 RANLIB = @RANLIB@
 SHELL = @SHELL@
 USED_CATALOGS = @USED_CATALOGS@
@@ -74,8 +75,10 @@ INCLUDES = -I$(srcdir) -I. -I$(srcdir)/.
        -I$(srcdir)/include
 
 ALL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(INCLUDES) $(CPPFLAGS) $(PICFLAG)
+ALL_CFLAGS += -DPACKAGE_SUFFIX=\"$(strip $(PACKAGE_SUFFIX))\"
 ALL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(NOEXCEPTION_FLAGS) $(INCLUDES) \
        $(CPPFLAGS) $(PICFLAG)
+ALL_CXXFLAGS += -DPACKAGE_SUFFIX=\"$(strip $(PACKAGE_SUFFIX))\"
 
 # The name of the compiler to use.
 COMPILER = $(CXX)
@@ -164,8 +167,8 @@ install-strip install: all installdirs
          else continue; \
          fi; \
          dir=$(localedir)/$$lang/LC_MESSAGES; \
-         echo $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
-         $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
+         echo $(INSTALL_DATA) $$cat 
$(DESTDIR)$$dir/$(PACKAGE)$(PACKAGE_SUFFIX).mo; \
+         $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE)$(PACKAGE_SUFFIX).mo; 
\
        done
 
 mostlyclean:
Index: libcpp/system.h
===================================================================
--- libcpp/system.h.orig        2013-01-15 10:49:52.000000000 +0100
+++ libcpp/system.h     2013-11-26 16:46:43.271816000 +0100
@@ -280,7 +280,7 @@ extern int errno;
 #endif
 
 #ifndef _
-# define _(msgid) dgettext (PACKAGE, msgid)
+# define _(msgid) dgettext (PACKAGE PACKAGE_SUFFIX, msgid)
 #endif
 
 #ifndef N_
Index: libcpp/init.c
===================================================================
--- libcpp/init.c.orig  2013-11-26 15:42:40.000000000 +0100
+++ libcpp/init.c       2013-11-26 16:46:43.271816000 +0100
@@ -152,7 +152,7 @@ init_library (void)
       init_trigraph_map ();
 
 #ifdef ENABLE_NLS
-       (void) bindtextdomain (PACKAGE, LOCALEDIR);
+       (void) bindtextdomain (PACKAGE PACKAGE_SUFFIX, LOCALEDIR);
 #endif
     }
 }
++++++ gcc48-bsc1161913.patch ++++++
commit 5c8a1211b9873a1b69ef7b2fddae181535bc3b0a
Author: Vladimir N. Makarov <[email protected]>
Date:   Tue Jan 28 15:43:44 2020 -0500

    Fix for PR93272 - LRA: EH reg allocated to hold local variable
    
    2020-01-28  Vladimir Makarov  <[email protected]>
    
            PR rtl-optimization/93272
            * ira-lives.c (process_out_of_region_eh_regs): New function.
            (process_bb_node_lives): Call it.

diff --git a/gcc/ira-lives.c b/gcc/ira-lives.c
index 31635dd3438..71c545ef105 100644
--- a/gcc/ira-lives.c
+++ b/gcc/ira-lives.c
@@ -1116,6 +1116,50 @@ find_call_crossed_cheap_reg (rtx insn)
   return cheap_reg;
 }  
 
+#ifdef EH_RETURN_DATA_REGNO
+
+/* Add EH return hard registers as conflict hard registers to allocnos
+   living at end of BB.  For most allocnos it is already done in
+   process_bb_node_lives when we processing input edges but it does
+   not work when and EH edge is edge out of the current region.  This
+   function covers such out of region edges. */
+static void
+process_out_of_region_eh_regs (basic_block bb)
+{
+  edge e;
+  edge_iterator ei;
+  unsigned int i;
+  bitmap_iterator bi;
+  bool eh_p = false;
+
+  FOR_EACH_EDGE (e, ei, bb->succs)
+    if ((e->flags & EDGE_EH)
+       && IRA_BB_NODE (e->dest)->parent != IRA_BB_NODE (bb)->parent)
+      eh_p = true;
+
+  if (! eh_p)
+    return;
+
+  EXECUTE_IF_SET_IN_BITMAP (df_get_live_out (bb), FIRST_PSEUDO_REGISTER, i, bi)
+    {
+      ira_allocno_t a = ira_curr_regno_allocno_map[i];
+      for (int n = ALLOCNO_NUM_OBJECTS (a) - 1; n >= 0; n--)
+       {
+         ira_object_t obj = ALLOCNO_OBJECT (a, n);
+         for (int k = 0; ; k++)
+           {
+             unsigned int regno = EH_RETURN_DATA_REGNO (k);
+             if (regno == INVALID_REGNUM)
+               break;
+             SET_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno);
+             SET_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno);
+           }
+       }
+    }
+}
+
+#endif
+
 /* Process insns of the basic block given by its LOOP_TREE_NODE to
    update allocno live ranges, allocno hard register conflicts,
    intersected calls, and register pressure info for allocnos for the
@@ -1170,6 +1214,10 @@ process_bb_node_lives (ira_loop_tree_node_t 
loop_tree_node)
       EXECUTE_IF_SET_IN_BITMAP (reg_live_out, FIRST_PSEUDO_REGISTER, j, bi)
        mark_pseudo_regno_live (j);
 
+#ifdef EH_RETURN_DATA_REGNO
+      process_out_of_region_eh_regs (bb);
+#endif
+
       freq = REG_FREQ_FROM_BB (bb);
       if (freq == 0)
        freq = 1;
++++++ gcc48-libstdc++-api-reference.patch ++++++
Index: libstdc++-v3/doc/html/index.html
===================================================================
--- libstdc++-v3/doc/html/index.html    (revision 210144)
+++ libstdc++-v3/doc/html/index.html    (working copy)
@@ -18,7 +18,7 @@
          </p></li><li class="listitem"><p>
            <a class="link" href="faq.html" title="Frequently Asked 
Questions">Frequently Asked Questions</a>
          </p></li><li class="listitem"><p>
-           <a class="link" href="api.html" title="The GNU C++ Library API 
Reference">API and Source Documentation</a>
+           <a class="link" href="api/index.html" title="The GNU C++ Library 
API Reference">API and Source Documentation</a>
          </p></li></ul></div><p>
     </p></div></div></div><hr /></div><div class="toc"><p><strong>Table of 
Contents</strong></p><dl class="toc"><dt><span class="book"><a 
href="manual/index.html">The GNU C++ Library 
Manual</a></span></dt><dd><dl><dt><span class="part"><a 
href="manual/intro.html">I. 
   Introduction

++++++ gcc48-remove-mpfr-2.4.0-requirement.patch ++++++
Index: configure.ac
===================================================================
--- configure.ac        (revision 216911)
+++ configure.ac        (working copy)
@@ -1454,7 +1454,7 @@ if test -d ${srcdir}/gcc && test "x$have
     AC_MSG_CHECKING([for the correct version of mpfr.h])
     AC_TRY_COMPILE([#include <gmp.h>
     #include <mpfr.h>],[
-    #if MPFR_VERSION < MPFR_VERSION_NUM(2,4,0)
+    #if MPFR_VERSION < MPFR_VERSION_NUM(2,3,1)
     choke me
     #endif
     ], [AC_TRY_COMPILE([#include <gmp.h>
Index: configure
===================================================================
--- configure   (revision 216911)
+++ configure   (working copy)
@@ -5524,7 +5524,7 @@ int
 main ()
 {
 
-    #if MPFR_VERSION < MPFR_VERSION_NUM(2,4,0)
+    #if MPFR_VERSION < MPFR_VERSION_NUM(2,3,1)
     choke me
     #endif
 
Index: gcc/fortran/simplify.c
===================================================================
--- gcc/fortran/simplify.c      (revision 216911)
+++ gcc/fortran/simplify.c      (working copy)
@@ -4278,10 +4278,7 @@ gfc_simplify_mod (gfc_expr *a, gfc_expr
            return &gfc_bad_expr;
          }
 
-       gfc_set_model_kind (kind);
-       mpfr_fmod (result->value.real, a->value.real, p->value.real,
-                  GFC_RND_MODE);
-       break;
+       return NULL;
 
       default:
        gfc_internal_error ("gfc_simplify_mod(): Bad arguments");
@@ -4327,19 +4324,7 @@ gfc_simplify_modulo (gfc_expr *a, gfc_ex
            return &gfc_bad_expr;
          }
 
-       gfc_set_model_kind (kind);
-       mpfr_fmod (result->value.real, a->value.real, p->value.real,
-                  GFC_RND_MODE);
-       if (mpfr_cmp_ui (result->value.real, 0) != 0)
-         {
-           if (mpfr_signbit (a->value.real) != mpfr_signbit (p->value.real))
-             mpfr_add (result->value.real, result->value.real, p->value.real,
-                       GFC_RND_MODE);
-         }
-       else
-         mpfr_copysign (result->value.real, result->value.real,
-                        p->value.real, GFC_RND_MODE);
-       break;
+       return NULL;
 
       default:
        gfc_internal_error ("gfc_simplify_modulo(): Bad arguments");
Index: gcc/ubsan.c
===================================================================
--- gcc/ubsan.c.orig    2015-06-01 14:52:11.717105684 +0200
+++ gcc/ubsan.c 2015-06-01 14:52:26.945253071 +0200
@@ -1564,40 +1564,6 @@
          min = build_real (expr_type, minval2);
        }
     }
-  else if (REAL_MODE_FORMAT (mode)->b == 10)
-    {
-      /* For _Decimal128 up to 34 decimal digits, - sign,
-        dot, e, exponent.  */
-      char buf[64];
-      mpfr_t m;
-      int p = REAL_MODE_FORMAT (mode)->p;
-      REAL_VALUE_TYPE maxval, minval;
-
-      /* Use mpfr_snprintf rounding to compute the smallest
-        representable decimal number greater or equal than
-        1 << (prec - !uns_p).  */
-      mpfr_init2 (m, prec + 2);
-      mpfr_set_ui_2exp (m, 1, prec - !uns_p, GMP_RNDN);
-      mpfr_snprintf (buf, sizeof buf, "%.*RUe", p - 1, m);
-      decimal_real_from_string (&maxval, buf);
-      max = build_real (expr_type, maxval);
-
-      /* For unsigned, assume -1.0 is always representable.  */
-      if (uns_p)
-       min = build_minus_one_cst (expr_type);
-      else
-       {
-         /* Use mpfr_snprintf rounding to compute the largest
-            representable decimal number less or equal than
-            (-1 << (prec - 1)) - 1.  */
-         mpfr_set_si_2exp (m, -1, prec - 1, GMP_RNDN);
-         mpfr_sub_ui (m, m, 1, GMP_RNDN);
-         mpfr_snprintf (buf, sizeof buf, "%.*RDe", p - 1, m);
-         decimal_real_from_string (&minval, buf);
-         min = build_real (expr_type, minval);
-       }
-      mpfr_clear (m);
-    }
   else
     return NULL_TREE;
 
Index: gcc/gimple-ssa-sprintf.c
===================================================================
--- gcc/gimple-ssa-sprintf.c    (revision 257728)
+++ gcc/gimple-ssa-sprintf.c    (working copy)
@@ -1637,18 +1637,7 @@ get_mpfr_format_length (mpfr_ptr x, cons
        p = 1024;
     }
 
-  len = mpfr_snprintf (NULL, 0, fmtstr, (int)p, x);
-
-  /* Handle the unlikely (impossible?) error by returning more than
-     the maximum dictated by the function's return type.  */
-  if (len < 0)
-    return target_dir_max () + 1;
-
-  /* Adjust the return value by the difference.  */
-  if (p < prec)
-    len += prec - p;
-
-  return len;
+  return target_dir_max () + 1;
 }
 
 /* Return the number of bytes to format using the format specifier

Index: gcc/fortran/simplify.c
===================================================================
--- gcc/fortran/simplify.c      (revision 257983)
+++ gcc/fortran/simplify.c      (working copy)
@@ -1745,51 +1745,6 @@ simplify_trig_call (gfc_expr *icall)
     }
 }
 
-/* Convert a floating-point number from radians to degrees.  */
-
-static void
-degrees_f (mpfr_t x, mp_rnd_t rnd_mode)
-{
-  mpfr_t tmp;
-  mpfr_init (tmp);
-
-  /* Set x = x % 2pi to avoid offsets with large angles.  */
-  mpfr_const_pi (tmp, rnd_mode);
-  mpfr_mul_ui (tmp, tmp, 2, rnd_mode);
-  mpfr_fmod (tmp, x, tmp, rnd_mode);
-
-  /* Set x = x * 180.  */
-  mpfr_mul_ui (x, x, 180, rnd_mode);
-
-  /* Set x = x / pi.  */
-  mpfr_const_pi (tmp, rnd_mode);
-  mpfr_div (x, x, tmp, rnd_mode);
-
-  mpfr_clear (tmp);
-}
-
-/* Convert a floating-point number from degrees to radians.  */
-
-static void
-radians_f (mpfr_t x, mp_rnd_t rnd_mode)
-{
-  mpfr_t tmp;
-  mpfr_init (tmp);
-
-  /* Set x = x % 360 to avoid offsets with large angles.  */
-  mpfr_set_ui (tmp, 360, rnd_mode);
-  mpfr_fmod (tmp, x, tmp, rnd_mode);
-
-  /* Set x = x * pi.  */
-  mpfr_const_pi (tmp, rnd_mode);
-  mpfr_mul (x, x, tmp, rnd_mode);
-
-  /* Set x = x / 180.  */
-  mpfr_div_ui (x, x, 180, rnd_mode);
-
-  mpfr_clear (tmp);
-}
-
 
 /* Convert argument to radians before calling a trig function.  */
 
@@ -1803,12 +1758,7 @@ gfc_simplify_trigd (gfc_expr *icall)
   if (arg->ts.type != BT_REAL)
     gfc_internal_error ("in gfc_simplify_trigd(): Bad type");
 
-  if (arg->expr_type == EXPR_CONSTANT)
-    /* Convert constant to radians before passing off to simplifier.  */
-    radians_f (arg->value.real, GFC_RND_MODE);
-
-  /* Let the usual simplifier take over - we just simplified the arg.  */
-  return simplify_trig_call (icall);
+  return NULL;
 }
 
 /* Convert result of an inverse trig function to degrees.  */
@@ -1816,21 +1766,9 @@ gfc_simplify_trigd (gfc_expr *icall)
 gfc_expr *
 gfc_simplify_atrigd (gfc_expr *icall)
 {
-  gfc_expr *result;
-
   if (icall->value.function.actual->expr->ts.type != BT_REAL)
     gfc_internal_error ("in gfc_simplify_atrigd(): Bad type");
 
-  /* See if another simplifier has work to do first.  */
-  result = simplify_trig_call (icall);
-
-  if (result && result->expr_type == EXPR_CONSTANT)
-    {
-      /* Convert constant to degrees after passing off to actual simplifier.  
*/
-      degrees_f (result->value.real, GFC_RND_MODE);
-      return result;
-    }
-
   /* Let gfc_resolve_atrigd take care of the non-constant case.  */
   return NULL;
 }
@@ -1840,21 +1778,9 @@ gfc_simplify_atrigd (gfc_expr *icall)
 gfc_expr *
 gfc_simplify_atan2d (gfc_expr *y, gfc_expr *x)
 {
-  gfc_expr *result;
-
   if (x->ts.type != BT_REAL || y->ts.type != BT_REAL)
     gfc_internal_error ("in gfc_simplify_atan2d(): Bad type");
 
-  if (x->expr_type == EXPR_CONSTANT && y->expr_type == EXPR_CONSTANT)
-    {
-      result = gfc_simplify_atan2 (y, x);
-      if (result != NULL)
-       {
-         degrees_f (result->value.real, GFC_RND_MODE);
-         return result;
-       }
-    }
-
   /* Let gfc_resolve_atan2d take care of the non-constant case.  */
   return NULL;
 }
++++++ gcc5-no-return-gcc43-workaround.patch ++++++
Workaround

[ 3445s] I: Program returns random data in a function
[ 3445s] E: gcc5 no-return-in-nonvoid-function ../../gcc/cp/constexpr.c:3676

during stage1 when compiling with a GCC 4.3 host compiler

--- gcc/cp/constexpr.c.orig     2015-06-02 09:33:15.085636193 +0200
+++ gcc/cp/constexpr.c  2015-06-02 09:34:04.637080196 +0200
@@ -3668,11 +3668,10 @@
        {
          r = get_target_expr (r);
          TREE_CONSTANT (r) = true;
-         return r;
        }
     }
-  else
-    return r;
+
+  return r;
 }
 
 /* Returns true if T is a valid subexpression of a constant expression,
++++++ gcc7-aarch64-moutline-atomics.patch ++++++
++++ 4298 lines (skipped)

++++++ gcc7-aarch64-sls-miti-1.patch ++++++
Backport to gcc7 of the below commit for bsc#1172798

commit 20da13e395bde597d8337167c712039c8f923c3b
Author: Matthew Malcomson <[email protected]>
Date:   Thu Jul 9 09:11:58 2020 +0100

    aarch64: New Straight Line Speculation (SLS) mitigation flags
    
    Here we introduce the flags that will be used for straight line speculation.
    
    The new flag introduced is `-mharden-sls=`.
    This flag can take arguments of `none`, `all`, or a comma seperated list
    of one or more of `retbr` or `blr`.
    `none` indicates no special mitigation of the straight line speculation
    vulnerability.
    `all` requests all mitigations currently implemented.
    `retbr` requests that the RET and BR instructions have a speculation
    barrier inserted after them.
    `blr` requests that BLR instructions are replaced by a BL to a function
    stub using a BR with a speculation barrier after it.
    
    Setting this on a per-function basis using attributes or the like is not
    enabled, but may be in the future.
    
    (cherry picked from commit a9ba2a9b77bec7eacaf066801f22d1c366a2bc86)
    
    gcc/ChangeLog:
    
    2020-06-02  Matthew Malcomson  <[email protected]>
    
            * config/aarch64/aarch64-protos.h (aarch64_harden_sls_retbr_p):
            New.
            (aarch64_harden_sls_blr_p): New.
            * config/aarch64/aarch64.c (enum aarch64_sls_hardening_type):
            New.
            (aarch64_harden_sls_retbr_p): New.
            (aarch64_harden_sls_blr_p): New.
            (aarch64_validate_sls_mitigation): New.
            (aarch64_override_options): Parse options for SLS mitigation.
            * config/aarch64/aarch64.opt (-mharden-sls): New option.
            * doc/invoke.texi: Document new option.

Index: gcc-7.5.0+r278197/gcc/config/aarch64/aarch64-protos.h
===================================================================
--- gcc-7.5.0+r278197.orig/gcc/config/aarch64/aarch64-protos.h
+++ gcc-7.5.0+r278197/gcc/config/aarch64/aarch64-protos.h
@@ -485,4 +485,7 @@ extern const atomic_ool_names aarch64_oo
 extern const atomic_ool_names aarch64_ool_ldclr_names;
 extern const atomic_ool_names aarch64_ool_ldeor_names;
 
+extern bool aarch64_harden_sls_retbr_p (void);
+extern bool aarch64_harden_sls_blr_p (void);
+
 #endif /* GCC_AARCH64_PROTOS_H */
Index: gcc-7.5.0+r278197/gcc/config/aarch64/aarch64.c
===================================================================
--- gcc-7.5.0+r278197.orig/gcc/config/aarch64/aarch64.c
+++ gcc-7.5.0+r278197/gcc/config/aarch64/aarch64.c
@@ -8814,6 +8814,79 @@ aarch64_validate_mcpu (const char *str,
   return false;
 }
 
+/* Straight line speculation indicators.  */
+enum aarch64_sls_hardening_type
+{
+  SLS_NONE = 0,
+  SLS_RETBR = 1,
+  SLS_BLR = 2,
+  SLS_ALL = 3,
+};
+static enum aarch64_sls_hardening_type aarch64_sls_hardening;
+
+/* Return whether we should mitigatate Straight Line Speculation for the RET
+   and BR instructions.  */
+bool
+aarch64_harden_sls_retbr_p (void)
+{
+  return aarch64_sls_hardening & SLS_RETBR;
+}
+
+/* Return whether we should mitigatate Straight Line Speculation for the BLR
+   instruction.  */
+bool
+aarch64_harden_sls_blr_p (void)
+{
+  return aarch64_sls_hardening & SLS_BLR;
+}
+
+/* As of yet we only allow setting these options globally, in the future we may
+   allow setting them per function.  */
+static void
+aarch64_validate_sls_mitigation (const char *const_str)
+{
+  char *token_save = NULL;
+  char *str = NULL;
+
+  if (strcmp (const_str, "none") == 0)
+    {
+      aarch64_sls_hardening = SLS_NONE;
+      return;
+    }
+  if (strcmp (const_str, "all") == 0)
+    {
+      aarch64_sls_hardening = SLS_ALL;
+      return;
+    }
+
+  char *str_root = xstrdup (const_str);
+  str = strtok_r (str_root, ",", &token_save);
+  if (!str)
+    error ("invalid argument given to %<-mharden-sls=%>");
+
+  int temp = SLS_NONE;
+  while (str)
+    {
+      if (strcmp (str, "blr") == 0)
+       temp |= SLS_BLR;
+      else if (strcmp (str, "retbr") == 0)
+       temp |= SLS_RETBR;
+      else if (strcmp (str, "none") == 0 || strcmp (str, "all") == 0)
+       {
+         error ("%<%s%> must be by itself for %<-mharden-sls=%>", str);
+         break;
+       }
+      else
+       {
+         error ("invalid argument %<%s%> for %<-mharden-sls=%>", str);
+         break;
+       }
+      str = strtok_r (NULL, ",", &token_save);
+    }
+  aarch64_sls_hardening = (aarch64_sls_hardening_type) temp;
+  free (str_root);
+}
+
 /* Validate a command-line -march option.  Parse the arch and extensions
    (if any) specified in STR and throw errors if appropriate.  Put the
    results, if they are valid, in RES and ISA_FLAGS.  Return whether the
@@ -8930,6 +9003,9 @@ aarch64_override_options (void)
   selected_arch = NULL;
   selected_tune = NULL;
 
+  if (aarch64_harden_sls_string)
+    aarch64_validate_sls_mitigation (aarch64_harden_sls_string);
+
   /* -mcpu=CPU is shorthand for -march=ARCH_FOR_CPU, -mtune=CPU.
      If either of -march or -mtune is given, they override their
      respective component of -mcpu.  */
Index: gcc-7.5.0+r278197/gcc/config/aarch64/aarch64.opt
===================================================================
--- gcc-7.5.0+r278197.orig/gcc/config/aarch64/aarch64.opt
+++ gcc-7.5.0+r278197/gcc/config/aarch64/aarch64.opt
@@ -68,6 +68,10 @@ mgeneral-regs-only
 Target Report RejectNegative Mask(GENERAL_REGS_ONLY) Save
 Generate code which uses only the general registers.
 
+mharden-sls=
+Target RejectNegative Joined Var(aarch64_harden_sls_string)
+Generate code to mitigate against straight line speculation.
+
 mfix-cortex-a53-835769
 Target Report Var(aarch64_fix_a53_err835769) Init(2) Save
 Workaround for ARM Cortex-A53 Erratum number 835769.
Index: gcc-7.5.0+r278197/gcc/doc/invoke.texi
===================================================================
--- gcc-7.5.0+r278197.orig/gcc/doc/invoke.texi
+++ gcc-7.5.0+r278197/gcc/doc/invoke.texi
@@ -589,6 +589,7 @@ Objective-C and Objective-C++ Dialects}.
 -mlow-precision-recip-sqrt  -mno-low-precision-recip-sqrt@gol
 -mlow-precision-sqrt  -mno-low-precision-sqrt@gol
 -mlow-precision-div  -mno-low-precision-div @gol
+-mharden-sls=@var{opts} @gol
 -march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}}
 
 @emph{Adapteva Epiphany Options}
@@ -14143,6 +14144,17 @@ Permissible values are @samp{none}, whic
 functions, and @samp{all}, which enables pointer signing for all functions.  
The
 default value is @samp{none}.
 
+@item -mharden-sls=@var{opts}
+@opindex mharden-sls
+Enable compiler hardening against straight line speculation (SLS).
+@var{opts} is a comma-separated list of the following options:
+@table @samp
+@item retbr
+@item blr
+@end table
+In addition, @samp{-mharden-sls=all} enables all SLS hardening while
+@samp{-mharden-sls=none} disables all SLS hardening.
+
 @end table
 
 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
++++++ gcc7-aarch64-sls-miti-2.patch ++++++
++++ 606 lines (skipped)

++++++ gcc7-aarch64-sls-miti-3.patch ++++++
Backport of below commit for bsc#1172798

commit 2155170525f93093b90a1a065e7ed71a925566e9
Author: Matthew Malcomson <[email protected]>
Date:   Thu Jul 9 09:11:59 2020 +0100

    aarch64: Mitigate SLS for BLR instruction
    
    This patch introduces the mitigation for Straight Line Speculation past
    the BLR instruction.
    
    This mitigation replaces BLR instructions with a BL to a stub which uses
    a BR to jump to the original value.  These function stubs are then
    appended with a speculation barrier to ensure no straight line
    speculation happens after these jumps.
    
    When optimising for speed we use a set of stubs for each function since
    this should help the branch predictor make more accurate predictions
    about where a stub should branch.
    
    When optimising for size we use one set of stubs for all functions.
    This set of stubs can have human readable names, and we are using
    `__call_indirect_x<N>` for register x<N>.
    
    When BTI branch protection is enabled the BLR instruction can jump to a
    `BTI c` instruction using any register, while the BR instruction can
    only jump to a `BTI c` instruction using the x16 or x17 registers.
    Hence, in order to ensure this transformation is safe we mov the value
    of the original register into x16 and use x16 for the BR.
    
    As an example when optimising for size:
    a
        BLR x0
    instruction would get transformed to something like
        BL __call_indirect_x0
    where __call_indirect_x0 labels a thunk that contains
    __call_indirect_x0:
        MOV X16, X0
        BR X16
        <speculation barrier>
    
    The first version of this patch used local symbols specific to a
    compilation unit to try and avoid relocations.
    This was mistaken since functions coming from the same compilation unit
    can still be in different sections, and the assembler will insert
    relocations at jumps between sections.
    
    On any relocation the linker is permitted to emit a veneer to handle
    jumps between symbols that are very far apart.  The registers x16 and
    x17 may be clobbered by these veneers.
    Hence the function stubs cannot rely on the values of x16 and x17 being
    the same as just before the function stub is called.
    
    Similar can be said for the hot/cold partitioning of single functions,
    so function-local stubs have the same restriction.
    
    This updated version of the patch never emits function stubs for x16 and
    x17, and instead forces other registers to be used.
    
    Given the above, there is now no benefit to local symbols (since they
    are not enough to avoid dealing with linker intricacies).  This patch
    now uses global symbols with hidden visibility each stored in their own
    COMDAT section.  This means stubs can be shared between compilation
    units while still avoiding the PLT indirection.
    
    This patch also removes the `__call_indirect_x30` stub (and
    function-local equivalent) which would simply jump back to the original
    location.
    
    The function-local stubs are emitted to the assembly output file in one
    chunk, which means we need not add the speculation barrier directly
    after each one.
    This is because we know for certain that the instructions directly after
    the BR in all but the last function stub will be from another one of
    these stubs and hence will not contain a speculation gadget.
    Instead we add a speculation barrier at the end of the sequence of
    stubs.
    
    The global stubs are emitted in COMDAT/.linkonce sections by
    themselves so that the linker can remove duplicates from multiple object
    files.  This means they are not emitted in one chunk, and each one must
    include the speculation barrier.
    
    Another difference is that since the global stubs are shared across
    compilation units we do not know that all functions will be targeting an
    architecture supporting the SB instruction.
    Rather than provide multiple stubs for each architecture, we provide a
    stub that will work for all architectures -- using the DSB+ISB barrier.
    
    This mitigation does not apply for BLR instructions in the following
    places:
    - Some accesses to thread-local variables use a code sequence with a BLR
      instruction.  This code sequence is part of the binary interface between
      compiler and linker. If this BLR instruction needs to be mitigated, it'd
      probably be best to do so in the linker. It seems that the code sequence
      for thread-local variable access is unlikely to lead to a Spectre 
Revalation
      Gadget.
    - PLT stubs are produced by the linker and each contain a BLR instruction.
      It seems that at most only after the last PLT stub a Spectre Revalation
      Gadget might appear.
    
    Testing:
      Bootstrap and regtest on AArch64
        (with BOOT_CFLAGS="-mharden-sls=retbr,blr")
      Used a temporary hack(1) in gcc-dg.exp to use these options on every
      test in the testsuite, a slight modification to emit the speculation
      barrier after every function stub, and a script to check that the
      output never emitted a BLR, or unmitigated BR or RET instruction.
      Similar on an aarch64-none-elf cross-compiler.
    
    1) Temporary hack emitted a speculation barrier at the end of every stub
    function, and used a script to ensure that:
      a) Every RET or BR is immediately followed by a speculation barrier.
      b) No BLR instruction is emitted by compiler.
    
    (cherry picked from 96b7f495f9269d5448822e4fc28882edb35a58d7)
    
    gcc/ChangeLog:
    
            * config/aarch64/aarch64-protos.h (aarch64_indirect_call_asm):
            New declaration.
            * config/aarch64/aarch64.c (aarch64_regno_regclass): Handle new
            stub registers class.
            (aarch64_class_max_nregs): Likewise.
            (aarch64_register_move_cost): Likewise.
            (aarch64_sls_shared_thunks): Global array to store stub labels.
            (aarch64_sls_emit_function_stub): New.
            (aarch64_create_blr_label): New.
            (aarch64_sls_emit_blr_function_thunks): New.
            (aarch64_sls_emit_shared_blr_thunks): New.
            (aarch64_asm_file_end): New.
            (aarch64_indirect_call_asm): New.
            (TARGET_ASM_FILE_END): Use aarch64_asm_file_end.
            (TARGET_ASM_FUNCTION_EPILOGUE): Use
            aarch64_sls_emit_blr_function_thunks.
            * config/aarch64/aarch64.h (STB_REGNUM_P): New.
            (enum reg_class): Add STUB_REGS class.
            (machine_function): Introduce `call_via` array for
            function-local stub labels.
            * config/aarch64/aarch64.md (*call_insn, *call_value_insn): Use
            aarch64_indirect_call_asm to emit code when hardening BLR
            instructions.
            * config/aarch64/constraints.md (Ucr): New constraint
            representing registers for indirect calls.  Is GENERAL_REGS
            usually, and STUB_REGS when hardening BLR instruction against
            SLS.
            * config/aarch64/predicates.md (aarch64_general_reg): STUB_REGS 
class
            is also a general register.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/aarch64/sls-mitigation/sls-miti-blr-bti.c: New test.
            * gcc.target/aarch64/sls-mitigation/sls-miti-blr.c: New test.

Index: gcc-7.5.0+r278197/gcc/config/aarch64/aarch64-protos.h
===================================================================
--- gcc-7.5.0+r278197.orig/gcc/config/aarch64/aarch64-protos.h
+++ gcc-7.5.0+r278197/gcc/config/aarch64/aarch64-protos.h
@@ -486,6 +486,7 @@ extern const atomic_ool_names aarch64_oo
 extern const atomic_ool_names aarch64_ool_ldeor_names;
 
 const char *aarch64_sls_barrier (int);
+const char *aarch64_indirect_call_asm (rtx);
 extern bool aarch64_harden_sls_retbr_p (void);
 extern bool aarch64_harden_sls_blr_p (void);
 
Index: gcc-7.5.0+r278197/gcc/config/aarch64/aarch64.c
===================================================================
--- gcc-7.5.0+r278197.orig/gcc/config/aarch64/aarch64.c
+++ gcc-7.5.0+r278197/gcc/config/aarch64/aarch64.c
@@ -5471,6 +5471,9 @@ aarch64_label_mentioned_p (rtx x)
 enum reg_class
 aarch64_regno_regclass (unsigned regno)
 {
+  if (STUB_REGNUM_P (regno))
+    return STUB_REGS;
+
   if (GP_REGNUM_P (regno))
     return GENERAL_REGS;
 
@@ -5799,6 +5802,7 @@ aarch64_class_max_nregs (reg_class_t reg
 {
   switch (regclass)
     {
+    case STUB_REGS:
     case TAILCALL_ADDR_REGS:
     case POINTER_REGS:
     case GENERAL_REGS:
@@ -7880,10 +7884,12 @@ aarch64_register_move_cost (machine_mode
     = aarch64_tune_params.regmove_cost;
 
   /* Caller save and pointer regs are equivalent to GENERAL_REGS.  */
-  if (to == TAILCALL_ADDR_REGS || to == POINTER_REGS)
+  if (to == TAILCALL_ADDR_REGS || to == POINTER_REGS
+      || to == STUB_REGS)
     to = GENERAL_REGS;
 
-  if (from == TAILCALL_ADDR_REGS || from == POINTER_REGS)
+  if (from == TAILCALL_ADDR_REGS || from == POINTER_REGS
+      || from == STUB_REGS)
     from = GENERAL_REGS;
 
   /* Moving between GPR and stack cost is the same as GP2GP.  */
@@ -14699,6 +14705,215 @@ aarch64_sls_barrier (int mitigation_requ
     : "";
 }
 
+static GTY (()) tree aarch64_sls_shared_thunks[30];
+static GTY (()) bool aarch64_sls_shared_thunks_needed = false;
+const char *indirect_symbol_names[30] = {
+    "__call_indirect_x0",
+    "__call_indirect_x1",
+    "__call_indirect_x2",
+    "__call_indirect_x3",
+    "__call_indirect_x4",
+    "__call_indirect_x5",
+    "__call_indirect_x6",
+    "__call_indirect_x7",
+    "__call_indirect_x8",
+    "__call_indirect_x9",
+    "__call_indirect_x10",
+    "__call_indirect_x11",
+    "__call_indirect_x12",
+    "__call_indirect_x13",
+    "__call_indirect_x14",
+    "__call_indirect_x15",
+    "", /* "__call_indirect_x16",  */
+    "", /* "__call_indirect_x17",  */
+    "__call_indirect_x18",
+    "__call_indirect_x19",
+    "__call_indirect_x20",
+    "__call_indirect_x21",
+    "__call_indirect_x22",
+    "__call_indirect_x23",
+    "__call_indirect_x24",
+    "__call_indirect_x25",
+    "__call_indirect_x26",
+    "__call_indirect_x27",
+    "__call_indirect_x28",
+    "__call_indirect_x29",
+};
+
+/* Function to create a BLR thunk.  This thunk is used to mitigate straight
+   line speculation.  Instead of a simple BLR that can be speculated past,
+   we emit a BL to this thunk, and this thunk contains a BR to the relevant
+   register.  These thunks have the relevant speculation barries put after
+   their indirect branch so that speculation is blocked.
+
+   We use such a thunk so the speculation barriers are kept off the
+   architecturally executed path in order to reduce the performance overhead.
+
+   When optimizing for size we use stubs shared by the linked object.
+   When optimizing for performance we emit stubs for each function in the hope
+   that the branch predictor can better train on jumps specific for a given
+   function.  */
+rtx
+aarch64_sls_create_blr_label (int regnum)
+{
+  gcc_assert (STUB_REGNUM_P (regnum));
+  if (optimize_function_for_size_p (cfun))
+    {
+      /* For the thunks shared between different functions in this compilation
+        unit we use a named symbol -- this is just for users to more easily
+        understand the generated assembly.  */
+      aarch64_sls_shared_thunks_needed = true;
+      const char *thunk_name = indirect_symbol_names[regnum];
+      if (aarch64_sls_shared_thunks[regnum] == NULL)
+       {
+         /* Build a decl representing this function stub and record it for
+            later.  We build a decl here so we can use the GCC machinery for
+            handling sections automatically (through `get_named_section` and
+            `make_decl_one_only`).  That saves us a lot of trouble handling
+            the specifics of different output file formats.  */
+         tree decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
+                                 get_identifier (thunk_name),
+                                 build_function_type_list (void_type_node,
+                                                           NULL_TREE));
+         DECL_RESULT (decl) = build_decl (BUILTINS_LOCATION, RESULT_DECL,
+                                          NULL_TREE, void_type_node);
+         TREE_PUBLIC (decl) = 1;
+         TREE_STATIC (decl) = 1;
+         DECL_IGNORED_P (decl) = 1;
+         DECL_ARTIFICIAL (decl) = 1;
+         make_decl_one_only (decl, DECL_ASSEMBLER_NAME (decl));
+         resolve_unique_section (decl, 0, false);
+         aarch64_sls_shared_thunks[regnum] = decl;
+       }
+
+      return gen_rtx_SYMBOL_REF (Pmode, thunk_name);
+    }
+
+  if (cfun->machine->call_via[regnum] == NULL)
+    cfun->machine->call_via[regnum]
+      = gen_rtx_LABEL_REF (Pmode, gen_label_rtx ());
+  return cfun->machine->call_via[regnum];
+}
+
+/* Helper function for aarch64_sls_emit_blr_function_thunks and
+   aarch64_sls_emit_shared_blr_thunks below.  */
+static void
+aarch64_sls_emit_function_stub (FILE *out_file, int regnum)
+{
+  /* Save in x16 and branch to that function so this transformation does
+     not prevent jumping to `BTI c` instructions.  */
+  asm_fprintf (out_file, "\tmov\tx16, x%d\n", regnum);
+  asm_fprintf (out_file, "\tbr\tx16\n");
+}
+
+/* Emit all BLR stubs for this particular function.
+   Here we emit all the BLR stubs needed for the current function.  Since we
+   emit these stubs in a consecutive block we know there will be no speculation
+   gadgets between each stub, and hence we only emit a speculation barrier at
+   the end of the stub sequences.
+
+   This is called in the TARGET_ASM_FUNCTION_EPILOGUE hook.  */
+void
+aarch64_sls_emit_blr_function_thunks (FILE *out_file, HOST_WIDE_INT)
+{
+  if (! aarch64_harden_sls_blr_p ())
+    return;
+
+  bool any_functions_emitted = false;
+  /* We must save and restore the current function section since this assembly
+     is emitted at the end of the function.  This means it can be emitted *just
+     after* the cold section of a function.  That cold part would be emitted in
+     a different section.  That switch would trigger a `.cfi_endproc` directive
+     to be emitted in the original section and a `.cfi_startproc` directive to
+     be emitted in the new section.  Switching to the original section without
+     restoring would mean that the `.cfi_endproc` emitted as a function ends
+     would happen in a different section -- leaving an unmatched
+     `.cfi_startproc` in the cold text section and an unmatched `.cfi_endproc`
+     in the standard text section.  */
+  section *save_text_section = in_section;
+  switch_to_section (function_section (current_function_decl));
+  for (int regnum = 0; regnum < 30; ++regnum)
+    {
+      rtx specu_label = cfun->machine->call_via[regnum];
+      if (specu_label == NULL)
+       continue;
+
+      targetm.asm_out.print_operand (out_file, specu_label, 0);
+      asm_fprintf (out_file, ":\n");
+      aarch64_sls_emit_function_stub (out_file, regnum);
+      any_functions_emitted = true;
+    }
+  if (any_functions_emitted)
+    /* Can use the SB if needs be here, since this stub will only be used
+      by the current function, and hence for the current target.  */
+    asm_fprintf (out_file, "\t%s\n", aarch64_sls_barrier (true));
+  switch_to_section (save_text_section);
+}
+
+/* Emit shared BLR stubs for the current compilation unit.
+   Over the course of compiling this unit we may have converted some BLR
+   instructions to a BL to a shared stub function.  This is where we emit those
+   stub functions.
+   This function is for the stubs shared between different functions in this
+   compilation unit.  We share when optimizing for size instead of speed.
+
+   This function is called through the TARGET_ASM_FILE_END hook.  */
+void
+aarch64_sls_emit_shared_blr_thunks (FILE *out_file)
+{
+  if (! aarch64_sls_shared_thunks_needed)
+    return;
+
+  for (int regnum = 0; regnum < 30; ++regnum)
+    {
+      tree decl = aarch64_sls_shared_thunks[regnum];
+      if (!decl)
+       continue;
+
+      const char *name = indirect_symbol_names[regnum];
+      switch_to_section (get_named_section (decl, NULL, 0));
+      ASM_OUTPUT_ALIGN (out_file, 2);
+      targetm.asm_out.globalize_label (out_file, name);
+      /* Only emits if the compiler is configured for an assembler that can
+        handle visibility directives.  */
+      targetm.asm_out.assemble_visibility (decl, VISIBILITY_HIDDEN);
+      ASM_OUTPUT_TYPE_DIRECTIVE (out_file, name, "function");
+      ASM_OUTPUT_LABEL (out_file, name);
+      aarch64_sls_emit_function_stub (out_file, regnum);
+      /* Use the most conservative target to ensure it can always be used by 
any
+        function in the translation unit.  */
+      asm_fprintf (out_file, "\tdsb\tsy\n\tisb\n");
+      ASM_DECLARE_FUNCTION_SIZE (out_file, name, decl);
+    }
+}
+
+/* Implement TARGET_ASM_FILE_END.  */
+void
+aarch64_asm_file_end ()
+{
+  aarch64_sls_emit_shared_blr_thunks (asm_out_file);
+  /* Since this function will be called for the ASM_FILE_END hook, we ensure
+     that what would be called otherwise (e.g. `file_end_indicate_exec_stack`
+     for FreeBSD) still gets called.  */
+#ifdef TARGET_ASM_FILE_END
+  TARGET_ASM_FILE_END ();
+#endif
+}
+
+const char *
+aarch64_indirect_call_asm (rtx addr)
+{
+  gcc_assert (REG_P (addr));
+  if (aarch64_harden_sls_blr_p ())
+    {
+      rtx stub_label = aarch64_sls_create_blr_label (REGNO (addr));
+      output_asm_insn ("bl\t%0", &stub_label);
+    }
+  else
+   output_asm_insn ("blr\t%0", &addr);
+  return "";
+}
+
 /* Target-specific selftests.  */
 
 #if CHECKING_P
@@ -15132,6 +15347,12 @@ aarch64_libgcc_floating_mode_supported_p
 #define TARGET_RUN_TARGET_SELFTESTS selftest::aarch64_run_selftests
 #endif /* #if CHECKING_P */
 
+#undef TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END aarch64_asm_file_end
+
+#undef TARGET_ASM_FUNCTION_EPILOGUE
+#define TARGET_ASM_FUNCTION_EPILOGUE aarch64_sls_emit_blr_function_thunks
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-aarch64.h"
Index: gcc-7.5.0+r278197/gcc/config/aarch64/aarch64.h
===================================================================
--- gcc-7.5.0+r278197.orig/gcc/config/aarch64/aarch64.h
+++ gcc-7.5.0+r278197/gcc/config/aarch64/aarch64.h
@@ -435,6 +435,16 @@ extern unsigned aarch64_architecture_ver
 #define GP_REGNUM_P(REGNO)                                             \
   (((unsigned) (REGNO - R0_REGNUM)) <= (R30_REGNUM - R0_REGNUM))
 
+/* Registers known to be preserved over a BL instruction.  This consists of the
+   GENERAL_REGS without x16, x17, and x30.  The x30 register is changed by the
+   BL instruction itself, while the x16 and x17 registers may be used by
+   veneers which can be inserted by the linker.  */
+#define STUB_REGNUM_P(REGNO) \
+  (GP_REGNUM_P (REGNO) \
+   && (REGNO) != R16_REGNUM \
+   && (REGNO) != R17_REGNUM \
+   && (REGNO) != R30_REGNUM) \
+
 #define FP_REGNUM_P(REGNO)                     \
   (((unsigned) (REGNO - V0_REGNUM)) <= (V31_REGNUM - V0_REGNUM))
 
@@ -448,6 +458,7 @@ enum reg_class
 {
   NO_REGS,
   TAILCALL_ADDR_REGS,
+  STUB_REGS,
   GENERAL_REGS,
   STACK_REG,
   POINTER_REGS,
@@ -463,6 +474,7 @@ enum reg_class
 {                                              \
   "NO_REGS",                                   \
   "TAILCALL_ADDR_REGS",                                \
+  "STUB_REGS",                                 \
   "GENERAL_REGS",                              \
   "STACK_REG",                                 \
   "POINTER_REGS",                              \
@@ -475,6 +487,7 @@ enum reg_class
 {                                                                      \
   { 0x00000000, 0x00000000, 0x00000000 },      /* NO_REGS */           \
   { 0x0004ffff, 0x00000000, 0x00000000 },      /* TAILCALL_ADDR_REGS */\
+  { 0x3ffcffff, 0x00000000, 0x00000000 },      /* STUB_REGS */         \
   { 0x7fffffff, 0x00000000, 0x00000003 },      /* GENERAL_REGS */      \
   { 0x80000000, 0x00000000, 0x00000000 },      /* STACK_REG */         \
   { 0xffffffff, 0x00000000, 0x00000003 },      /* POINTER_REGS */      \
@@ -609,6 +622,8 @@ typedef struct GTY (()) machine_function
   struct aarch64_frame frame;
   /* One entry for each hard register.  */
   bool reg_is_wrapped_separately[LAST_SAVED_REGNUM];
+  /* One entry for each general purpose register.  */
+  rtx call_via[SP_REGNUM];
 } machine_function;
 #endif
 
Index: gcc-7.5.0+r278197/gcc/config/aarch64/aarch64.md
===================================================================
--- gcc-7.5.0+r278197.orig/gcc/config/aarch64/aarch64.md
+++ gcc-7.5.0+r278197/gcc/config/aarch64/aarch64.md
@@ -778,12 +778,12 @@
 )
 
 (define_insn "*call_reg"
-  [(call (mem:DI (match_operand:DI 0 "register_operand" "r"))
+  [(call (mem:DI (match_operand:DI 0 "register_operand" "Ucr"))
         (match_operand 1 "" ""))
    (use (match_operand 2 "" ""))
    (clobber (reg:DI LR_REGNUM))]
   ""
-  "blr\\t%0"
+  "* return aarch64_indirect_call_asm (operands[0]);"
   [(set_attr "type" "call")]
 )
 
@@ -840,12 +840,12 @@
 
 (define_insn "*call_value_reg"
   [(set (match_operand 0 "" "")
-       (call (mem:DI (match_operand:DI 1 "register_operand" "r"))
+       (call (mem:DI (match_operand:DI 1 "register_operand" "Ucr"))
                      (match_operand 2 "" "")))
    (use (match_operand 3 "" ""))
    (clobber (reg:DI LR_REGNUM))]
   ""
-  "blr\\t%1"
+  "* return aarch64_indirect_call_asm (operands[1]);"
   [(set_attr "type" "call")]
 
 )
Index: gcc-7.5.0+r278197/gcc/config/aarch64/constraints.md
===================================================================
--- gcc-7.5.0+r278197.orig/gcc/config/aarch64/constraints.md
+++ gcc-7.5.0+r278197/gcc/config/aarch64/constraints.md
@@ -24,6 +24,15 @@
 (define_register_constraint "Ucs" "TAILCALL_ADDR_REGS"
   "@internal Registers suitable for an indirect tail call")
 
+(define_register_constraint "Ucr"
+    "aarch64_harden_sls_blr_p () ? STUB_REGS : GENERAL_REGS"
+  "@internal Registers to be used for an indirect call.
+   This is usually the general registers, but when we are hardening against
+   Straight Line Speculation we disallow x16, x17, and x30 so we can use
+   indirection stubs.  These indirection stubs cannot use the above registers
+   since they will be reached by a BL that may have to go through a linker
+   veneer.")
+
 (define_register_constraint "w" "FP_REGS"
   "Floating point and SIMD vector registers.")
 
Index: 
gcc-7.5.0+r278197/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr.c
===================================================================
--- /dev/null
+++ 
gcc-7.5.0+r278197/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr.c
@@ -0,0 +1,33 @@
+/* { dg-additional-options "-mharden-sls=blr -save-temps" } */
+/* Ensure that the SLS hardening of BLR leaves no BLR instructions.
+   We only test that all BLR instructions have been removed, not that the
+   resulting code makes sense.  */
+typedef int (foo) (int, int);
+typedef void (bar) (int, int);
+struct sls_testclass {
+    foo *x;
+    bar *y;
+    int left;
+    int right;
+};
+
+/* We test both RTL patterns for a call which returns a value and a call which
+   does not.  */
+int blr_call_value (struct sls_testclass x)
+{
+  int retval = x.x(x.left, x.right);
+  if (retval % 10)
+    return 100;
+  return 9;
+}
+
+int blr_call (struct sls_testclass x)
+{
+  x.y(x.left, x.right);
+  if (x.left % 10)
+    return 100;
+  return 9;
+}
+
+/* { dg-final { scan-assembler-not {\tblr\t} } } */
+/* { dg-final { scan-assembler {\tbr\tx[0-9][0-9]?} } } */
++++++ gcc7-avoid-fixinc-error.diff ++++++
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in     (revision 255402)
+++ gcc/Makefile.in     (working copy)
@@ -2993,13 +2993,6 @@ stmp-fixinc: gsyslimits.h macro_list fix
            sysroot_headers_suffix=`echo $${ml} | sed -e 's/;.*$$//'`; \
            multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
            fix_dir=include-fixed$${multi_dir}; \
-           if ! $(inhibit_libc) && test ! -d ${SYSTEM_HEADER_DIR}; then \
-             echo The directory that should contain system headers does not 
exist: >&2 ; \
-             echo "  ${SYSTEM_HEADER_DIR}" >&2 ; \
-             tooldir_sysinc=`echo "${gcc_tooldir}/sys-include" | sed -e :a -e 
"s,[^/]*/\.\.\/,," -e ta`; \
-             if test "x${SYSTEM_HEADER_DIR}" = "x$${tooldir_sysinc}"; \
-             then sleep 1; else exit 1; fi; \
-           fi; \
            $(mkinstalldirs) $${fix_dir}; \
            chmod a+rx $${fix_dir} || true; \
            (TARGET_MACHINE='$(target)'; srcdir=`cd $(srcdir); ${PWD_COMMAND}`; 
\
++++++ gcc7-bsc1146475.patch ++++++
2019-10-01  Alexandre Oliva <[email protected]>

        PR debug/91507
        * dwarf2out.c (override_type_for_decl_p): New.
        (gen_variable_die): Use it.

        * gcc.dg/debug/dwarf2/array-0.c: New.
        * gcc.dg/debug/dwarf2/array-1.c: New.
        * gcc.dg/debug/dwarf2/array-2.c: New.
        * gcc.dg/debug/dwarf2/array-3.c: New.
        * g++.dg/debug/dwarf2/array-0.C: New.
        * g++.dg/debug/dwarf2/array-1.C: New.
        * g++.dg/debug/dwarf2/array-2.C: New.  Based on libstdc++-v3's
        src/c++98/pool_allocator.cc:__pool_alloc_base::_S_heap_size.
        * g++.dg/debug/dwarf2/array-3.C: New.  Based on
        gcc's config/i386/i386-features.c:xlogue_layout::s_instances.
        * g++.dg/debug/dwarf2/array-4.C: New.

Index: gcc/testsuite/gcc.dg/debug/dwarf2/array-0.c
===================================================================
--- gcc/testsuite/gcc.dg/debug/dwarf2/array-0.c (nonexistent)
+++ gcc/testsuite/gcc.dg/debug/dwarf2/array-0.c (revision 276403)
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-gdwarf-2 -dA" } */
+extern int array[42];
+
+int array[42];
+
+/* Verify that we get only one DW_TAG_subtrange_type (plus abbrev),
+   with a DW_AT_upper_bound.  */
+/* { dg-final { scan-assembler-times " DW_TAG_subrange_type" 2 } } */
+/* { dg-final { scan-assembler-times " DW_AT_upper_bound" 1 } } */
Index: gcc/testsuite/gcc.dg/debug/dwarf2/array-2.c
===================================================================
--- gcc/testsuite/gcc.dg/debug/dwarf2/array-2.c (nonexistent)
+++ gcc/testsuite/gcc.dg/debug/dwarf2/array-2.c (revision 276403)
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-gdwarf-2 -dA" } */
+int array[42];
+
+/* Verify that we get only one DW_TAG_subtrange_type (plus abbrev)
+   with DW_AT_upper_bound.  */
+/* { dg-final { scan-assembler-times " DW_TAG_subrange_type" 2 } } */
+/* { dg-final { scan-assembler-times " DW_AT_upper_bound" 1 } } */
Index: gcc/testsuite/gcc.dg/debug/dwarf2/array-1.c
===================================================================
--- gcc/testsuite/gcc.dg/debug/dwarf2/array-1.c (nonexistent)
+++ gcc/testsuite/gcc.dg/debug/dwarf2/array-1.c (revision 276403)
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-gdwarf-2 -dA" } */
+extern int array[];
+
+int array[42];
+
+/* Verify that we get two DW_TAG_subtrange_type (each with an abbrev),
+   but only one DW_AT_upper_bound.  */
+/* { dg-final { scan-assembler-times " DW_TAG_subrange_type" 4 } } */
+/* { dg-final { scan-assembler-times " DW_AT_upper_bound" 1 } } */
Index: gcc/testsuite/gcc.dg/debug/dwarf2/array-3.c
===================================================================
--- gcc/testsuite/gcc.dg/debug/dwarf2/array-3.c (nonexistent)
+++ gcc/testsuite/gcc.dg/debug/dwarf2/array-3.c (revision 276403)
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-gdwarf-2 -dA" } */
+int array[] = { 0, 1, 2 };
+
+/* Verify that we get only one DW_TAG_subtrange_type (plus abbrev)
+   with DW_AT_upper_bound.  */
+/* { dg-final { scan-assembler-times " DW_TAG_subrange_type" 2 } } */
+/* { dg-final { scan-assembler-times " DW_AT_upper_bound" 1 } } */
Index: gcc/testsuite/g++.dg/debug/dwarf2/array-1.C
===================================================================
--- gcc/testsuite/g++.dg/debug/dwarf2/array-1.C (nonexistent)
+++ gcc/testsuite/g++.dg/debug/dwarf2/array-1.C (revision 276403)
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-gdwarf-2 -dA" } */
+struct S
+{
+  static int array[];
+};
+
+int S::array[42];
+
+/* Verify that we get two DW_TAG_subrange_type, only one of which with
+   a DW_AT_upper_bound.  */
+/* { dg-final { scan-assembler-times " DW_TAG_subrange_type" 4 } } */
+/* { dg-final { scan-assembler-times " DW_AT_upper_bound" 1 } } */
Index: gcc/testsuite/g++.dg/debug/dwarf2/array-2.C
===================================================================
--- gcc/testsuite/g++.dg/debug/dwarf2/array-2.C (nonexistent)
+++ gcc/testsuite/g++.dg/debug/dwarf2/array-2.C (revision 276403)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-gdwarf-2 -dA" } */
+struct S
+{
+  typedef int i_t;
+  static i_t array[42];
+};
+
+int S::array[42];
+
+/* Verify that we get two DW_TAG_subrange_type (plus abbrev), and two
+   DW_AT_upper_bound, because a different symbolic name is used for
+   the array element type.  */
+/* { dg-final { scan-assembler-times " DW_TAG_subrange_type" 3 } } */
+/* { dg-final { scan-assembler-times " DW_AT_upper_bound" 2 } } */
Index: gcc/testsuite/g++.dg/debug/dwarf2/array-3.C
===================================================================
--- gcc/testsuite/g++.dg/debug/dwarf2/array-3.C (nonexistent)
+++ gcc/testsuite/g++.dg/debug/dwarf2/array-3.C (revision 276403)
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-gdwarf-2 -dA" } */
+struct S
+{
+  S() {}
+  ~S() {}
+  static const S array[2];
+};
+
+const S S::array[2] = { S(), S() };
+
+/* Verify that we get only one DW_TAG_subrange_type (plus the abbrev),
+   and one DW_AT_upper_bound (non-abbrev), because the array
+   definition loses the readonly wrapper for the array type because of
+   the dynamic initializers.  The const types are 4: S, S*, int, and
+   S[4], plus the abbrev.  A const version of S[4] doesn't make sense,
+   but we output it.  */
+/* { dg-final { scan-assembler-times " DW_TAG_const_type" 5 } } */
+/* { dg-final { scan-assembler-times " DW_TAG_subrange_type" 2 } } */
+/* { dg-final { scan-assembler-times " DW_AT_upper_bound" 1 } } */
Index: gcc/testsuite/g++.dg/debug/dwarf2/array-0.C
===================================================================
--- gcc/testsuite/g++.dg/debug/dwarf2/array-0.C (nonexistent)
+++ gcc/testsuite/g++.dg/debug/dwarf2/array-0.C (revision 276403)
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-gdwarf-2 -dA" } */
+struct S
+{
+  static int array[42];
+};
+
+int S::array[42];
+
+/* Verify that we get only one DW_TAG_subrange_type with a
+   DW_AT_upper_bound.  */
+/* { dg-final { scan-assembler-times " DW_TAG_subrange_type" 2 } } */
+/* { dg-final { scan-assembler-times " DW_AT_upper_bound" 1 } } */
Index: gcc/testsuite/g++.dg/debug/dwarf2/array-4.C
===================================================================
--- gcc/testsuite/g++.dg/debug/dwarf2/array-4.C (nonexistent)
+++ gcc/testsuite/g++.dg/debug/dwarf2/array-4.C (revision 276403)
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-gdwarf-2 -dA" } */
+struct S
+{
+  S() {}
+  ~S() {}
+};
+
+const S array[2] = { S(), S() };
+
+/* Like array-3, but with a non-member array without a separate
+   declaration, to check that we don't issue the nonsensical
+   DW_TAG_const_type used by the member array declaration there.  */
+/* { dg-final { scan-assembler-times " DW_TAG_const_type" 4 } } */
+/* { dg-final { scan-assembler-times " DW_TAG_subrange_type" 2 } } */
+/* { dg-final { scan-assembler-times " DW_AT_upper_bound" 1 } } */
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c     (revision 276402)
+++ gcc/dwarf2out.c     (revision 276403)
@@ -23705,6 +23705,34 @@ local_function_static (tree decl)
     && TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL;
 }
 
+/* Return true iff DECL overrides (presumably completes) the type of
+   OLD_DIE within CONTEXT_DIE.  */
+
+static bool
+override_type_for_decl_p (tree decl, dw_die_ref old_die,
+                         dw_die_ref context_die)
+{
+  tree type = TREE_TYPE (decl);
+  int cv_quals;
+
+  if (decl_by_reference_p (decl))
+    {
+      type = TREE_TYPE (type);
+      cv_quals = TYPE_UNQUALIFIED;
+    }
+  else
+    cv_quals = decl_quals (decl);
+
+  dw_die_ref type_die = modified_type_die (type,
+                                          cv_quals | TYPE_QUALS (type),
+                                          false,
+                                          context_die);
+
+  dw_die_ref old_type_die = get_AT_ref (old_die, DW_AT_type);
+
+  return type_die != old_type_die;
+}
+
 /* Generate a DIE to represent a declared data object.
    Either DECL or ORIGIN must be non-null.  */
 
@@ -23957,7 +23985,9 @@ gen_variable_die (tree decl, tree origin
          && !DECL_ABSTRACT_P (decl_or_origin)
          && variably_modified_type_p (TREE_TYPE (decl_or_origin),
                                       decl_function_context
-                                                       (decl_or_origin))))
+                                      (decl_or_origin)))
+      || (old_die && specialization_p
+         && override_type_for_decl_p (decl_or_origin, old_die, context_die)))
     {
       tree type = TREE_TYPE (decl_or_origin);
 
++++++ gcc7-bsc1160086.patch ++++++
2019-12-17  Andreas Krebbel  <[email protected]>

        Backport from mainline
        2019-12-16  Andreas Krebbel  <[email protected]>

        PR target/92950
        * config/s390/vector.md ("mov<mode>" for V_8): Replace lh, lhy,
        and lhrl with llc.

        * gcc.target/s390/vector/pr92950.c: New test.

Index: gcc/testsuite/gcc.target/s390/vector/pr92950.c
===================================================================
--- gcc/testsuite/gcc.target/s390/vector/pr92950.c      (nonexistent)
+++ gcc/testsuite/gcc.target/s390/vector/pr92950.c      (revision 279454)
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mzarch -march=z13" } */
+
+struct a {
+  int b;
+  char c;
+};
+struct a d = {1, 16};
+struct a *e = &d;
+
+int f = 0;
+
+int main() {
+  struct a g = {0, 0 };
+  f = 0;
+
+  for (; f <= 1; f++) {
+    g = d;
+    *e = g;
+  }
+
+  if (d.c != 16)
+    __builtin_abort();
+}
Index: gcc/config/s390/vector.md
===================================================================
--- gcc/config/s390/vector.md   (revision 279453)
+++ gcc/config/s390/vector.md   (revision 279454)
@@ -289,9 +289,9 @@ (define_split
 ; However, this would probably be slower.
 
 (define_insn "mov<mode>"
-  [(set (match_operand:V_8 0 "nonimmediate_operand" "=v,v,d,v,R,  v,  v,  v,  
v,d,  Q,  S,  Q,  S,  d,  d,d,d,d,R,T")
-        (match_operand:V_8 1 "general_operand"      " 
v,d,v,R,v,j00,jm1,jyy,jxx,d,j00,j00,jm1,jm1,j00,jm1,R,T,b,d,d"))]
-  ""
+  [(set (match_operand:V_8 0 "nonimmediate_operand" "=v,v,d,v,R,  v,  v,  v,  
v,d,  Q,  S,  Q,  S,  d,  d,d,R,T")
+        (match_operand:V_8 1 "general_operand"      " 
v,d,v,R,v,j00,jm1,jyy,jxx,d,j00,j00,jm1,jm1,j00,jm1,T,d,d"))]
+  "TARGET_VX"
   "@
    vlr\t%v0,%v1
    vlvgb\t%v0,%1,0
@@ -309,12 +309,10 @@ (define_insn "mov<mode>"
    mviy\t%0,-1
    lhi\t%0,0
    lhi\t%0,-1
-   lh\t%0,%1
-   lhy\t%0,%1
-   lhrl\t%0,%1
+   llc\t%0,%1
    stc\t%1,%0
    stcy\t%1,%0"
-  [(set_attr "op_type"      
"VRR,VRS,VRS,VRX,VRX,VRI,VRI,VRI,VRI,RR,SI,SIY,SI,SIY,RI,RI,RX,RXY,RIL,RX,RXY")])
+  [(set_attr "op_type"      
"VRR,VRS,VRS,VRX,VRX,VRI,VRI,VRI,VRI,RR,SI,SIY,SI,SIY,RI,RI,RXY,RX,RXY")])
 
 (define_insn "mov<mode>"
   [(set (match_operand:V_16 0 "nonimmediate_operand" "=v,v,d,v,R,  v,  v,  v,  
v,d,  Q,  Q,  d,  d,d,d,d,R,T,b")
++++++ gcc7-fix-retrieval-of-testnames.patch ++++++
Backport of the below

commit db489777bb0185e64cf4b9b8c7afed4dcc6669bd
Author: Thomas Preud'homme <[email protected]>
Date:   Fri Nov 10 09:42:45 2017 +0000

    [testsuite] Fix retrieval of testname
    
    When gcc-dg-runtest is used to run a test the test is run several times
    with different options. For clarity of the log, the test infrastructure
    then append the options to the testname. This means that all the code
    that must deal with the testcase itself (eg. removing the output files
    after the test has run) needs to remove the option name.
    
    There is already a pattern (see below) for this in several place of the
    testsuite framework but it is also missing in many places. This patch
    fixes all of these places. The pattern is as follows:
    
    set testcase [testname-for-summary]
    ; The name might include a list of options; extract the file name.
    set testcase [lindex $testcase 0]
    
    2017-11-10  Thomas Preud'homme  <[email protected]>
    
        gcc/testsuite/
        * lib/scanasm.exp (scan-assembler): Extract filename from testname used
        in summary.
        (scan-assembler-not): Likewise.
        (scan-hidden): Likewise.
        (scan-not-hidden): Likewise.
        (scan-stack-usage): Likewise.
        (scan-stack-usage-not): Likewise.
        (scan-assembler-times): Likewise.
        (scan-assembler-dem): Likewise.
        (scan-assembler-dem-not): Likewise.
        (object-size): Likewise.
        (scan-lto-assembler): Likewise.
        * lib/scandump.exp (scan-dump): Likewise.
        (scan-dump-times): Likewise.
        (scan-dump-not): Likewise.
        (scan-dump-dem): Likewise.
        (scan-dump-dem-not): Likewise
    
    From-SVN: r254622

Index: gcc-7.5.0+r278197/gcc/testsuite/lib/scanasm.exp
===================================================================
--- gcc-7.5.0+r278197.orig/gcc/testsuite/lib/scanasm.exp
+++ gcc-7.5.0+r278197/gcc/testsuite/lib/scanasm.exp
@@ -78,7 +78,9 @@ proc dg-scan { name positive testcase ou
 
 proc scan-assembler { args } {
     set testcase [testname-for-summary]
-    set output_file "[file rootname [file tail $testcase]].s"
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
+    set output_file "[file rootname [file tail $filename]].s"
     dg-scan "scan-assembler" 1 $testcase $output_file $args
 }
 
@@ -89,7 +91,9 @@ force_conventional_output_for scan-assem
 
 proc scan-assembler-not { args } {
     set testcase [testname-for-summary]
-    set output_file "[file rootname [file tail $testcase]].s"
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
+    set output_file "[file rootname [file tail $filename]].s"
 
     dg-scan "scan-assembler-not" 0 $testcase $output_file $args
 }
@@ -117,7 +121,9 @@ proc hidden-scan-for { symbol } {
 
 proc scan-hidden { args } {
     set testcase [testname-for-summary]
-    set output_file "[file rootname [file tail $testcase]].s"
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
+    set output_file "[file rootname [file tail $filename]].s"
 
     set symbol [lindex $args 0]
 
@@ -133,7 +139,9 @@ proc scan-hidden { args } {
 
 proc scan-not-hidden { args } {
     set testcase [testname-for-summary]
-    set output_file "[file rootname [file tail $testcase]].s"
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
+    set output_file "[file rootname [file tail $filename]].s"
 
     set symbol [lindex $args 0]
     set hidden_scan [hidden-scan-for $symbol]
@@ -163,7 +171,9 @@ proc scan-file-not { output_file args }
 
 proc scan-stack-usage { args } {
     set testcase [testname-for-summary]
-    set output_file "[file rootname [file tail $testcase]].su"
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
+    set output_file "[file rootname [file tail $filename]].su"
 
     dg-scan "scan-file" 1 $testcase $output_file $args
 }
@@ -173,7 +183,9 @@ proc scan-stack-usage { args } {
 
 proc scan-stack-usage-not { args } {
     set testcase [testname-for-summary]
-    set output_file "[file rootname [file tail $testcase]].su"
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
+    set output_file "[file rootname [file tail $filename]].su"
 
     dg-scan "scan-file-not" 0 $testcase $output_file $args
 }
@@ -230,11 +242,13 @@ proc scan-assembler-times { args } {
     }
 
     set testcase [testname-for-summary]
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
     set pattern [lindex $args 0]
     set pp_pattern [make_pattern_printable $pattern]
 
     # This must match the rule in gcc-dg.exp.
-    set output_file "[file rootname [file tail $testcase]].s"
+    set output_file "[file rootname [file tail $filename]].s"
 
     set files [glob -nocomplain $output_file]
     if { $files == "" } {
@@ -290,9 +304,11 @@ proc scan-assembler-dem { args } {
     }
 
     set testcase [testname-for-summary]
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
     set pattern [lindex $args 0]
     set pp_pattern [make_pattern_printable $pattern]
-    set output_file "[file rootname [file tail $testcase]].s"
+    set output_file "[file rootname [file tail $filename]].s"
 
     set files [glob -nocomplain $output_file]
     if { $files == "" } {
@@ -344,9 +360,11 @@ proc scan-assembler-dem-not { args } {
     }
 
     set testcase [testname-for-summary]
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
     set pattern [lindex $args 0]
     set pp_pattern [make_pattern_printable $pattern]
-    set output_file "[file rootname [file tail $testcase]].s"
+    set output_file "[file rootname [file tail $filename]].s"
 
     set files [glob -nocomplain $output_file]
     if { $files == "" } {
@@ -399,6 +417,8 @@ proc object-size { args } {
     }
 
     set testcase [testname-for-summary]
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
     set what [lindex $args 0]
     set where [lsearch { text data bss total } $what]
     if { $where == -1 } {
@@ -416,7 +436,7 @@ proc object-size { args } {
         return
     }
 
-    set output_file "[file rootname [file tail $testcase]].o"
+    set output_file "[file rootname [file tail $filename]].o"
     if ![file_on_host exists $output_file] {
        verbose -log "$testcase: $output_file does not exist"
        unresolved "$testcase object-size $what $cmp $with"
@@ -510,7 +530,9 @@ proc dg-function-on-line { args } {
 
 proc scan-lto-assembler { args } {
     set testcase [testname-for-summary]
-    set output_file "[file rootname [file tail $testcase]].exe.ltrans0.s"
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
+    set output_file "[file rootname [file tail $filename]].exe.ltrans0.s"
     verbose "output_file: $output_file"
     dg-scan "scan-assembler" 1 $testcase $output_file $args
 }
Index: gcc-7.5.0+r278197/gcc/testsuite/lib/scandump.exp
===================================================================
--- gcc-7.5.0+r278197.orig/gcc/testsuite/lib/scandump.exp
+++ gcc-7.5.0+r278197/gcc/testsuite/lib/scandump.exp
@@ -45,11 +45,13 @@ proc scan-dump { args } {
     }
 
     set testcase [testname-for-summary]
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
 
     set printable_pattern [make_pattern_printable [lindex $args 1]]
     set suf [dump-suffix [lindex $args 2]]
     set testname "$testcase scan-[lindex $args 0]-dump $suf 
\"$printable_pattern\""
-    set src [file tail [lindex $testcase 0]]
+    set src [file tail $filename]
     set output_file "[glob -nocomplain $src.[lindex $args 2]]"
     if { $output_file == "" } {
        verbose -log "$testcase: dump file does not exist"
@@ -86,10 +88,12 @@ proc scan-dump-times { args } {
     }
 
     set testcase [testname-for-summary]
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
     set suf [dump-suffix [lindex $args 3]]
     set printable_pattern [make_pattern_printable [lindex $args 1]]
     set testname "$testcase scan-[lindex $args 0]-dump-times $suf 
\"$printable_pattern\" [lindex $args 2]"
-    set src [file tail [lindex $testcase 0]]
+    set src [file tail $filename]
     set output_file "[glob -nocomplain $src.[lindex $args 3]]"
     if { $output_file == "" } {
        verbose -log "$testcase: dump file does not exist"
@@ -126,10 +130,12 @@ proc scan-dump-not { args } {
     }
 
     set testcase [testname-for-summary]
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
     set printable_pattern [make_pattern_printable [lindex $args 1]]
     set suf [dump-suffix [lindex $args 2]]
     set testname "$testcase scan-[lindex $args 0]-dump-not $suf 
\"$printable_pattern\""
-    set src [file tail [lindex $testcase 0]]
+    set src [file tail $filename]
     set output_file "[glob -nocomplain $src.[lindex $args 2]]"
     if { $output_file == "" } {
        verbose -log "$testcase: dump file does not exist"
@@ -179,10 +185,12 @@ proc scan-dump-dem { args } {
     }
 
     set testcase [testname-for-summary]
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
     set printable_pattern [make_pattern_printable [lindex $args 1]]
     set suf [dump-suffix [lindex $args 2]]
     set testname "$testcase scan-[lindex $args 0]-dump-dem $suf 
\"$printable_pattern\""
-    set src [file tail [lindex $testcase 0]]
+    set src [file tail $filename]
     set output_file "[glob -nocomplain $src.[lindex $args 2]]"
     if { $output_file == "" } {
        verbose -log "$testcase: dump file does not exist"
@@ -231,10 +239,12 @@ proc scan-dump-dem-not { args } {
     }
 
     set testcase [testname-for-summary]
+    # The name might include a list of options; extract the file name.
+    set filename [lindex $testcase 0]
     set printable_pattern [make_pattern_printable [lindex $args 1]
     set suf [dump-suffix [lindex $args 2]]
     set testname "$testcase scan-[lindex $args 0]-dump-dem-not $suf 
\"$printable_pattern\""
-    set src [file tail [lindex $testcase 0]]
+    set src [file tail $filename]
     set output_file "[glob -nocomplain $src.[lindex $args 2]]"
     if { $output_file == "" } {
        verbose -log "$testcase: dump file does not exist"
++++++ gcc7-flive-patching.patch ++++++
++++ 662 lines (skipped)

++++++ gcc7-pr82248.diff ++++++
Index: gcc/config/arm/arm.md
===================================================================
--- gcc/config/arm/arm.md       (revision 255006)
+++ gcc/config/arm/arm.md       (working copy)
@@ -8613,7 +8613,7 @@ (define_insn "blockage"
 )
 
 (define_insn "probe_stack"
-  [(set (match_operand:SI 0 "memory_operand" "=m")
+  [(set (match_operand:SI 0 "memory_operand" "=o")
         (unspec:SI [(const_int 0)] UNSPEC_PROBE_STACK))]
   "TARGET_32BIT"
   "str%?\\tr0, %0"
++++++ gcc7-pr85887.patch ++++++
2019-10-22  Jakub Jelinek  <[email protected]>

        PR tree-optimization/85887
        * decl.c (expand_static_init): Drop ECF_LEAF from __cxa_guard_acquire
        and __cxa_guard_release.

Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c       (revision 277292)
+++ gcc/cp/decl.c       (revision 277293)
@@ -8589,14 +8589,14 @@ expand_static_init (tree decl, tree init
              (acquire_name, build_function_type_list (integer_type_node,
                                                       TREE_TYPE (guard_addr),
                                                       NULL_TREE),
-              NULL_TREE, ECF_NOTHROW | ECF_LEAF);
+              NULL_TREE, ECF_NOTHROW);
          if (!release_fn || !abort_fn)
            vfntype = build_function_type_list (void_type_node,
                                                TREE_TYPE (guard_addr),
                                                NULL_TREE);
          if (!release_fn)
            release_fn = push_library_fn (release_name, vfntype, NULL_TREE,
-                                          ECF_NOTHROW | ECF_LEAF);
+                                         ECF_NOTHROW);
          if (!abort_fn)
            abort_fn = push_library_fn (abort_name, vfntype, NULL_TREE,
                                        ECF_NOTHROW | ECF_LEAF);

++++++ gcc7-pr88522.patch ++++++
backport: re PR target/88522 (Error: operand size mismatch for `vpgatherqq')

Backported from mainline
2018-12-21  Jakub Jelinek  <[email protected]>

PR target/88522
* config/i386/sse.md (*avx512pf_gatherpf<mode>sf_mask,
*avx512pf_gatherpf<mode>df_mask, *avx512pf_scatterpf<mode>sf_mask,
*avx512pf_scatterpf<mode>df_mask): Use %X5 instead of %5 for
-masm=intel.
(gatherq_mode): Remove mode iterator.
(*avx512f_gathersi<mode>, *avx512f_gathersi<mode>_2): Use X instead
of <xtg_mode>.
(*avx512f_gatherdi<mode>): Use X instead of <gatherq_mode>.
(*avx512f_gatherdi<mode>_2, *avx512f_scattersi<mode>,
*avx512f_scatterdi<mode>): Use %X5 for -masm=intel.


diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index c8b314abaa6..aecd98851a5 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -16039,9 +16039,9 @@
   switch (INTVAL (operands[4]))
     {
     case 3:
-      return "%M2vgatherpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
+      return "%M2vgatherpf0<ssemodesuffix>ps\t{%5%{%0%}|%X5%{%0%}}";
     case 2:
-      return "%M2vgatherpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
+      return "%M2vgatherpf1<ssemodesuffix>ps\t{%5%{%0%}|%X5%{%0%}}";
     default:
       gcc_unreachable ();
     }
@@ -16084,9 +16084,9 @@
   switch (INTVAL (operands[4]))
     {
     case 3:
-      return "%M2vgatherpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
+      return "%M2vgatherpf0<ssemodesuffix>pd\t{%5%{%0%}|%X5%{%0%}}";
     case 2:
-      return "%M2vgatherpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
+      return "%M2vgatherpf1<ssemodesuffix>pd\t{%5%{%0%}|%X5%{%0%}}";
     default:
       gcc_unreachable ();
     }
@@ -16130,10 +16130,10 @@
     {
     case 3:
     case 7:
-      return "%M2vscatterpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
+      return "%M2vscatterpf0<ssemodesuffix>ps\t{%5%{%0%}|%X5%{%0%}}";
     case 2:
     case 6:
-      return "%M2vscatterpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
+      return "%M2vscatterpf1<ssemodesuffix>ps\t{%5%{%0%}|%X5%{%0%}}";
     default:
       gcc_unreachable ();
     }
@@ -16177,10 +16177,10 @@
     {
     case 3:
     case 7:
-      return "%M2vscatterpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
+      return "%M2vscatterpf0<ssemodesuffix>pd\t{%5%{%0%}|%X5%{%0%}}";
     case 2:
     case 6:
-      return "%M2vscatterpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
+      return "%M2vscatterpf1<ssemodesuffix>pd\t{%5%{%0%}|%X5%{%0%}}";
     default:
       gcc_unreachable ();
     }
@@ -19180,12 +19180,6 @@
    (set_attr "prefix" "vex")
    (set_attr "mode" "<sseinsnmode>")])
 
-;; Memory operand override for -masm=intel of the v*gatherq* patterns.
-(define_mode_attr gatherq_mode
-  [(V4SI "q") (V2DI "x") (V4SF "q") (V2DF "x")
-   (V8SI "x") (V4DI "t") (V8SF "x") (V4DF "t")
-   (V16SI "t") (V8DI "g") (V16SF "t") (V8DF "g")])
-
 (define_expand "<avx512>_gathersi<mode>"
   [(parallel [(set (match_operand:VI48F 0 "register_operand")
                   (unspec:VI48F
@@ -19219,7 +19213,7 @@
          UNSPEC_GATHER))
    (clobber (match_scratch:<avx512fmaskmode> 2 "=&Yk"))]
   "TARGET_AVX512F"
-  "%M4v<sseintprefix>gatherd<ssemodesuffix>\t{%6, %0%{%2%}|%0%{%2%}, 
%<xtg_mode>6}"
+  "%M4v<sseintprefix>gatherd<ssemodesuffix>\t{%6, %0%{%2%}|%0%{%2%}, %X6}"
   [(set_attr "type" "ssemov")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -19238,7 +19232,7 @@
          UNSPEC_GATHER))
    (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
   "TARGET_AVX512F"
-  "%M3v<sseintprefix>gatherd<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, 
%<xtg_mode>5}"
+  "%M3v<sseintprefix>gatherd<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %X5}"
   [(set_attr "type" "ssemov")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -19278,7 +19272,7 @@
    (clobber (match_scratch:QI 2 "=&Yk"))]
   "TARGET_AVX512F"
 {
-  return "%M4v<sseintprefix>gatherq<ssemodesuffix>\t{%6, %1%{%2%}|%1%{%2%}, 
%<gatherq_mode>6}";
+  return "%M4v<sseintprefix>gatherq<ssemodesuffix>\t{%6, %1%{%2%}|%1%{%2%}, 
%X6}";
 }
   [(set_attr "type" "ssemov")
    (set_attr "prefix" "evex")
@@ -19302,11 +19296,11 @@
   if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
     {
       if (<MODE_SIZE> != 64)
-       return "%M3v<sseintprefix>gatherq<ssemodesuffix>\t{%5, 
%x0%{%1%}|%x0%{%1%}, %<gatherq_mode>5}";
+       return "%M3v<sseintprefix>gatherq<ssemodesuffix>\t{%5, 
%x0%{%1%}|%x0%{%1%}, %X5}";
       else
-       return "%M3v<sseintprefix>gatherq<ssemodesuffix>\t{%5, 
%t0%{%1%}|%t0%{%1%}, %t5}";
+       return "%M3v<sseintprefix>gatherq<ssemodesuffix>\t{%5, 
%t0%{%1%}|%t0%{%1%}, %X5}";
     }
-  return "%M3v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, 
%<gatherq_mode>5}";
+  return "%M3v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, 
%X5}";
 }
   [(set_attr "type" "ssemov")
    (set_attr "prefix" "evex")
@@ -19343,7 +19337,7 @@
          UNSPEC_SCATTER))
    (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
   "TARGET_AVX512F"
-  "%M0v<sseintprefix>scatterd<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}"
+  "%M0v<sseintprefix>scatterd<ssemodesuffix>\t{%3, %5%{%1%}|%X5%{%1%}, %3}"
   [(set_attr "type" "ssemov")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -19379,11 +19373,7 @@
          UNSPEC_SCATTER))
    (clobber (match_scratch:QI 1 "=&Yk"))]
   "TARGET_AVX512F"
-{
-  if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 8)
-    return "%M0v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, 
%3}";
-  return "%M0v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%t5%{%1%}, 
%3}";
-}
+  "%M0v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%X5%{%1%}, %3}"
   [(set_attr "type" "ssemov")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
++++++ gcc7-pr92154.patch ++++++
2019-11-26  Jakub Jelinek  <[email protected]>

        PR sanitizer/92154
        * sanitizer_common/sanitizer_platform_limits_posix.h: Cherry-pick
        llvm-project revision 947f9692440836dcb8d88b74b69dd379d85974ce.
        * sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise.

Index: 
gcc-7.5.0+r278197/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
===================================================================
--- 
gcc-7.5.0+r278197.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ 
gcc-7.5.0+r278197/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1145,8 +1145,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
+#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
+/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
+   on many architectures.  */
 CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
 #endif
 
Index: 
gcc-7.5.0+r278197/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
===================================================================
--- 
gcc-7.5.0+r278197.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ 
gcc-7.5.0+r278197/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -204,27 +204,14 @@ namespace __sanitizer {
     unsigned __seq;
     u64 __unused1;
     u64 __unused2;
-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
-    unsigned int mode;
-    unsigned short __seq;
-    unsigned short __pad1;
-    unsigned long __unused1;
-    unsigned long __unused2;
 #elif defined(__sparc__)
-# if defined(__arch64__)
     unsigned mode;
-    unsigned short __pad1;
-# else
-    unsigned short __pad1;
-    unsigned short mode;
     unsigned short __pad2;
-# endif
     unsigned short __seq;
     unsigned long long __unused1;
     unsigned long long __unused2;
 #else
-    unsigned short mode;
-    unsigned short __pad1;
+    unsigned int mode;
     unsigned short __seq;
     unsigned short __pad2;
 #if defined(__x86_64__) && !defined(_LP64)
++++++ gcc7-pr92692.patch ++++++
Backported to gcc7 from:

From: Wilco Dijkstra <[email protected]>
Date: Fri, 17 Jan 2020 13:17:21 +0000 (+0000)
Subject: [AArch64] Fix shrinkwrapping interactions with atomics (PR92692)
X-Git-Url: 
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;a=commitdiff_plain;h=e5e07b68187b9aa334519746c45b8cffc5eb7e5c

[AArch64] Fix shrinkwrapping interactions with atomics (PR92692)

The separate shrinkwrapping pass may insert stores in the middle
of atomics loops which can cause issues on some implementations.
Avoid this by delaying splitting atomics patterns until after
prolog/epilog generation.

gcc/
        PR target/92692
        * config/aarch64/aarch64.c (aarch64_split_compare_and_swap)
        Add assert to ensure prolog has been emitted.
        (aarch64_split_atomic_op): Likewise.
        * config/aarch64/atomics.md (aarch64_compare_and_swap<mode>)
        Use epilogue_completed rather than reload_completed.
        (aarch64_atomic_exchange<mode>): Likewise.
        (aarch64_atomic_<atomic_optab><mode>): Likewise.
        (atomic_nand<mode>): Likewise.
        (aarch64_atomic_fetch_<atomic_optab><mode>): Likewise.
        (atomic_fetch_nand<mode>): Likewise.
        (aarch64_atomic_<atomic_optab>_fetch<mode>): Likewise.
        (atomic_nand_fetch<mode>): Likewise.
---

Index: gcc-7.5.0+r278197/gcc/config/aarch64/aarch64.c
===================================================================
--- gcc-7.5.0+r278197.orig/gcc/config/aarch64/aarch64.c
+++ gcc-7.5.0+r278197/gcc/config/aarch64/aarch64.c
@@ -12121,6 +12121,9 @@ aarch64_emit_post_barrier (enum memmodel
 void
 aarch64_split_compare_and_swap (rtx operands[])
 {
+  /* Split after prolog/epilog to avoid interactions with shrinkwrapping.  */
+  gcc_assert (epilogue_completed);
+
   rtx rval, mem, oldval, newval, scratch, x, model_rtx;
   machine_mode mode;
   bool is_weak;
@@ -12205,6 +12208,9 @@ void
 aarch64_split_atomic_op (enum rtx_code code, rtx old_out, rtx new_out, rtx mem,
                         rtx value, rtx model_rtx, rtx cond)
 {
+  /* Split after prolog/epilog to avoid interactions with shrinkwrapping.  */
+  gcc_assert (epilogue_completed);
+
   machine_mode mode = GET_MODE (mem);
   machine_mode wmode = (mode == DImode ? DImode : SImode);
   const enum memmodel model = memmodel_from_int (INTVAL (model_rtx));
Index: gcc-7.5.0+r278197/gcc/config/aarch64/atomics.md
===================================================================
--- gcc-7.5.0+r278197.orig/gcc/config/aarch64/atomics.md
+++ gcc-7.5.0+r278197/gcc/config/aarch64/atomics.md
@@ -59,7 +59,7 @@
    (clobber (match_scratch:SI 7 "=&r"))]
   ""
   "#"
-  "&& reload_completed"
+  "&& epilogue_completed"
   [(const_int 0)]
   {
     aarch64_split_compare_and_swap (operands);
@@ -83,7 +83,7 @@
    (clobber (match_scratch:SI 7 "=&r"))]
   ""
   "#"
-  "&& reload_completed"
+  "&& epilogue_completed"
   [(const_int 0)]
   {
     aarch64_split_compare_and_swap (operands);
@@ -226,7 +226,7 @@
    (clobber (match_scratch:SI 4 "=&r"))]
   ""
   "#"
-  "&& reload_completed"
+  "&& epilogue_completed"
   [(const_int 0)]
   {
     aarch64_split_atomic_op (SET, operands[0], NULL, operands[1],
@@ -347,7 +347,7 @@
   (clobber (match_scratch:SI 4 "=&r"))]
   ""
   "#"
-  "&& reload_completed"
+  "&& epilogue_completed"
   [(const_int 0)]
   {
     aarch64_split_atomic_op (<CODE>, NULL, operands[3], operands[0],
@@ -403,7 +403,7 @@
    (clobber (match_scratch:SI 4 "=&r"))]
   ""
   "#"
-  "&& reload_completed"
+  "&& epilogue_completed"
   [(const_int 0)]
   {
      aarch64_split_atomic_op (NOT, NULL, operands[3], operands[0],
@@ -507,7 +507,7 @@
    (clobber (match_scratch:SI 5 "=&r"))]
   ""
   "#"
-  "&& reload_completed"
+  "&& epilogue_completed"
   [(const_int 0)]
   {
     aarch64_split_atomic_op (<CODE>, operands[0], operands[4], operands[1],
@@ -554,7 +554,7 @@
    (clobber (match_scratch:SI 5 "=&r"))]
   ""
   "#"
-  "&& reload_completed"
+  "&& epilogue_completed"
   [(const_int 0)]
   {
     aarch64_split_atomic_op (NOT, operands[0], operands[4], operands[1],
@@ -607,7 +607,7 @@
    (clobber (match_scratch:SI 4 "=&r"))]
   ""
   "#"
-  "&& reload_completed"
+  "&& epilogue_completed"
   [(const_int 0)]
   {
     aarch64_split_atomic_op (<CODE>, NULL, operands[0], operands[1],
@@ -631,7 +631,7 @@
    (clobber (match_scratch:SI 4 "=&r"))]
   ""
   "#"
-  "&& reload_completed"
+  "&& epilogue_completed"
   [(const_int 0)]
   {
     aarch64_split_atomic_op (NOT, NULL, operands[0], operands[1],
++++++ gcc7-pr93246.patch ++++++
commit 20e9d78543493f2f6aeef19af4cea54696247fc8
Author: Richard Biener <[email protected]>
Date:   Tue Jan 14 08:43:32 2020 +0100

    PR middle-end/93246 - missing alias subsets
    
    Starting with the introduction of TYPE_TYPELESS_STORAGE the situation
    of having a alias-set zero aggregate field became more common which
    prevents recording alias-sets of fields of said aggregate as subset
    of the outer aggregate.  component_uses_parent_alias_set_from in the
    past fended off some of the issues with that but the alias oracles
    use of the alias set of the base of an access path never appropriately
    handled it.
    
    The following makes it so that alias-sets of fields of alias-set zero
    aggregate fields are still recorded as subset of the container.
    
    2020-01-14  Richard Biener  <[email protected]>
    
            PR middle-end/93246
            * alias.c (record_component_aliases): Take superset to record
            into, recurse for alias-set zero fields.
            (record_component_aliases): New oveerload wrapping around the above.
    
            * g++.dg/torture/pr93246.C: New testcase.

diff --git a/gcc/alias.c b/gcc/alias.c
index b64e3ea264d..053c3494e79 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -1186,15 +1186,14 @@ record_alias_subset (alias_set_type superset, 
alias_set_type subset)
     }
 }
 
-/* Record that component types of TYPE, if any, are part of that type for
+/* Record that component types of TYPE, if any, are part of SUPERSET for
    aliasing purposes.  For record types, we only record component types
    for fields that are not marked non-addressable.  For array types, we
    only record the component type if it is not marked non-aliased.  */
 
 void
-record_component_aliases (tree type)
+record_component_aliases (tree type, alias_set_type superset)
 {
-  alias_set_type superset = get_alias_set (type);
   tree field;
 
   if (superset == 0)
@@ -1244,7 +1243,21 @@ record_component_aliases (tree type)
                                       == get_alias_set (TREE_TYPE (field)));
              }
 
-           record_alias_subset (superset, get_alias_set (t));
+           alias_set_type set = get_alias_set (t);
+           record_alias_subset (superset, set);
+           /* If the field has alias-set zero make sure to still record
+              any componets of it.  This makes sure that for
+                struct A {
+                  struct B {
+                    int i;
+                    char c[4];
+                  } b;
+                };
+              in C++ even though 'B' has alias-set zero because
+              TYPE_TYPELESS_STORAGE is set, 'A' has the alias-set of
+              'int' as subset.  */
+           if (set == 0)
+             record_component_aliases (t, superset);
          }
       break;
 
@@ -1260,6 +1273,19 @@ record_component_aliases (tree type)
     }
 }
 
+/* Record that component types of TYPE, if any, are part of that type for
+   aliasing purposes.  For record types, we only record component types
+   for fields that are not marked non-addressable.  For array types, we
+   only record the component type if it is not marked non-aliased.  */
+
+void
+record_component_aliases (tree type)
+{
+  alias_set_type superset = get_alias_set (type);
+  record_component_aliases (type, superset);
+}
+
+
 /* Allocate an alias set for use in storing and reading from the varargs
    spill area.  */
 
diff --git a/gcc/testsuite/g++.dg/torture/pr93246.C 
b/gcc/testsuite/g++.dg/torture/pr93246.C
new file mode 100644
index 00000000000..4c523443175
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr93246.C
@@ -0,0 +1,31 @@
+// { dg-do run }
+// { dg-additional-options "-fstrict-aliasing" }
+
+template <typename = void> struct Optional {
+  auto is_present() const { const bool &p = inner.present; return p; }
+  auto set_present() { if (not is_present()) inner.present = true; }
+  struct InnerType {
+    bool present = false;
+    char padding[1] = {0};
+  };
+  using inner_t = InnerType;
+  inner_t inner = {};
+};
+
+template <typename WrappedType> struct Wrapper {
+  auto operator-> () { return value; }
+  WrappedType *value;
+};
+
+void __attribute__((noinline,noclone)) foo(Optional<>& x) { __asm__ volatile 
("":::"memory"); }
+
+int main()
+{
+  Optional<> buf{};
+  foo(buf);
+  Wrapper<Optional<>> wo = {&buf};
+  wo->set_present();
+  auto x = wo->is_present();
+  if (!x)
+    __builtin_abort ();
+}
++++++ gcc7-pr93888.patch ++++++
commit 64ba6d17022eeb65f56f0b141c2640f9ab938f97
Author: Jakub Jelinek <[email protected]>
Date:   Wed Mar 4 12:59:04 2020 +0100

    inliner: Copy DECL_BY_REFERENCE in copy_decl_to_var [PR93888]
    
    In the following testcase we emit wrong debug info for the karg
    parameter in the DW_TAG_inlined_subroutine into main.
    The problem is that the karg PARM_DECL is DECL_BY_REFERENCE and thus
    in the IL has const K & type, but in the source just const K.
    When the function is inlined, we create a VAR_DECL for it, but don't
    set DECL_BY_REFERENCE, so when emitting DW_AT_location, we treat it like
    a const K & typed variable, but it has DW_AT_abstract_origin which has
    just the const K type and thus the debugger thinks the variable has
    const K type.
    
    Fixed by copying the DECL_BY_REFERENCE flag.  Not doing it in
    copy_decl_for_dup_finish, because copy_decl_no_change already copies
    that flag through copy_node and in copy_result_decl_to_var it is
    undesirable, as we handle DECL_BY_REFERENCE in that case instead
    by changing the type.
    
    2020-03-04  Jakub Jelinek  <[email protected]>
    
            PR debug/93888
            * tree-inline.c (copy_decl_to_var): Copy DECL_BY_REFERENCE flag.
    
            * g++.dg/guality/pr93888.C: New test.

diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 23941dade55..59798ec0454 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -5929,6 +5929,7 @@ copy_decl_to_var (tree decl, copy_body_data *id)
   TREE_READONLY (copy) = TREE_READONLY (decl);
   TREE_THIS_VOLATILE (copy) = TREE_THIS_VOLATILE (decl);
   DECL_GIMPLE_REG_P (copy) = DECL_GIMPLE_REG_P (decl);
+  DECL_BY_REFERENCE (copy) = DECL_BY_REFERENCE (decl);
 
   return copy_decl_for_dup_finish (id, decl, copy);
 }
++++++ gcc7-pr93965.patch ++++++
>From 08bf7bde9f2987b1c623d272cc71fc14a1622442 Mon Sep 17 00:00:00 2001
From: Martin Liska <[email protected]>
Date: Fri, 28 Feb 2020 17:52:57 +0100
Subject: [PATCH] Improve detection of ld_date.

        PR other/93965
        * configure.ac: Improve detection of ld_date by requiring
        either two dashes or none.
        * configure: Regenerate.
---
 gcc/ChangeLog    | 7 +++++++
 gcc/configure    | 2 +-
 gcc/configure.ac | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index f55cdb8c77f..5381e107bce 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -23384,7 +23384,7 @@ if test $in_tree_ld != yes ; then
       ld_vers=`echo $ld_ver | sed -n \
          -e 's,^.*[     ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
     fi
-    ld_date=`echo $ld_ver | sed -n 
's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
+    ld_date=`echo $ld_ver | sed -n 
's,^.*\([2-9][0-9][0-9][0-9]\)\(-*\)\([01][0-9]\)\2\([0-3][0-9]\).*$,\1\3\4,p'`
     ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
     ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
     ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 0e6e475950d..0d6230e0ca1 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2804,7 +2804,7 @@ if test $in_tree_ld != yes ; then
       ld_vers=`echo $ld_ver | sed -n \
          -e 's,^.*[     ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
     fi
-    ld_date=`echo $ld_ver | sed -n 
's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
+    ld_date=`echo $ld_ver | sed -n 
's,^.*\([2-9][0-9][0-9][0-9]\)\(-*\)\([01][0-9]\)\2\([0-3][0-9]\).*$,\1\3\4,p'`
     ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
     ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
     ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
-- 
2.25.0

++++++ gcc7-pr94148.patch ++++++
commit 5c7e6d4bdf879b437b43037e10453275acabf521
Author: Segher Boessenkool <[email protected]>
Date:   Thu Mar 12 07:12:50 2020 +0000

    df: Don't abuse bb->aux (PR94148, PR94042)
    
    The df dataflow solvers use the aux field in the basic_block struct,
    although that is reserved for any use by passes.  And not only that,
    it is required that you set all such fields to NULL before calling
    the solvers, or you quietly get wrong results.
    
    This changes the solvers to use a local array for last_change_age
    instead, just like it already had a local array for last_visit_age.
    
            PR rtl-optimization/94148
            PR rtl-optimization/94042
            * df-core.c (BB_LAST_CHANGE_AGE): Delete.
            (df_worklist_propagate_forward): New parameter last_change_age, use
            that instead of bb->aux.
            (df_worklist_propagate_backward): Ditto.
            (df_worklist_dataflow_doublequeue): Use a local array 
last_change_age.

diff --git a/gcc/df-core.c b/gcc/df-core.c
index 346849e31be..9875a26895c 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -871,9 +871,6 @@ make_pass_df_finish (gcc::context *ctxt)
    The general data flow analysis engine.
 ----------------------------------------------------------------------------*/
 
-/* Return time BB when it was visited for last time.  */
-#define BB_LAST_CHANGE_AGE(bb) ((ptrdiff_t)(bb)->aux)
-
 /* Helper function for df_worklist_dataflow.
    Propagate the dataflow forward.
    Given a BB_INDEX, do the dataflow propagation
@@ -897,7 +894,8 @@ df_worklist_propagate_forward (struct dataflow *dataflow,
                                unsigned *bbindex_to_postorder,
                                bitmap pending,
                                sbitmap considered,
-                              ptrdiff_t age)
+                              vec<int> &last_change_age,
+                              int age)
 {
   edge e;
   edge_iterator ei;
@@ -908,7 +906,8 @@ df_worklist_propagate_forward (struct dataflow *dataflow,
   if (EDGE_COUNT (bb->preds) > 0)
     FOR_EACH_EDGE (e, ei, bb->preds)
       {
-        if (age <= BB_LAST_CHANGE_AGE (e->src)
+       if (bbindex_to_postorder[e->src->index] < last_change_age.length ()
+           && age <= last_change_age[bbindex_to_postorder[e->src->index]]
            && bitmap_bit_p (considered, e->src->index))
           changed |= dataflow->problem->con_fun_n (e);
       }
@@ -942,7 +941,8 @@ df_worklist_propagate_backward (struct dataflow *dataflow,
                                 unsigned *bbindex_to_postorder,
                                 bitmap pending,
                                 sbitmap considered,
-                               ptrdiff_t age)
+                               vec<int> &last_change_age,
+                               int age)
 {
   edge e;
   edge_iterator ei;
@@ -953,7 +953,8 @@ df_worklist_propagate_backward (struct dataflow *dataflow,
   if (EDGE_COUNT (bb->succs) > 0)
     FOR_EACH_EDGE (e, ei, bb->succs)
       {
-        if (age <= BB_LAST_CHANGE_AGE (e->dest)
+       if (bbindex_to_postorder[e->dest->index] < last_change_age.length ()
+           && age <= last_change_age[bbindex_to_postorder[e->dest->index]]
            && bitmap_bit_p (considered, e->dest->index))
           changed |= dataflow->problem->con_fun_n (e);
       }
@@ -991,10 +992,10 @@ df_worklist_propagate_backward (struct dataflow *dataflow,
    worklists (we are processing WORKLIST and storing new BBs to visit in
    PENDING).
 
-   As an optimization we maintain ages when BB was changed (stored in bb->aux)
-   and when it was last visited (stored in last_visit_age).  This avoids need
-   to re-do confluence function for edges to basic blocks whose source
-   did not change since destination was visited last time.  */
+   As an optimization we maintain ages when BB was changed (stored in
+   last_change_age) and when it was last visited (stored in last_visit_age).
+   This avoids need to re-do confluence function for edges to basic blocks
+   whose source did not change since destination was visited last time.  */
 
 static void
 df_worklist_dataflow_doublequeue (struct dataflow *dataflow,
@@ -1010,11 +1011,11 @@ df_worklist_dataflow_doublequeue (struct dataflow 
*dataflow,
   int age = 0;
   bool changed;
   vec<int> last_visit_age = vNULL;
+  vec<int> last_change_age = vNULL;
   int prev_age;
-  basic_block bb;
-  int i;
 
   last_visit_age.safe_grow_cleared (n_blocks);
+  last_change_age.safe_grow_cleared (n_blocks);
 
   /* Double-queueing. Worklist is for the current iteration,
      and pending is for the next. */
@@ -1032,30 +1033,30 @@ df_worklist_dataflow_doublequeue (struct dataflow 
*dataflow,
 
          bitmap_clear_bit (pending, index);
          bb_index = blocks_in_postorder[index];
-         bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
          prev_age = last_visit_age[index];
          if (dir == DF_FORWARD)
            changed = df_worklist_propagate_forward (dataflow, bb_index,
                                                     bbindex_to_postorder,
                                                     pending, considered,
+                                                    last_change_age,
                                                     prev_age);
          else
            changed = df_worklist_propagate_backward (dataflow, bb_index,
                                                      bbindex_to_postorder,
                                                      pending, considered,
+                                                     last_change_age,
                                                      prev_age);
          last_visit_age[index] = ++age;
          if (changed)
-           bb->aux = (void *)(ptrdiff_t)age;
+           last_change_age[index] = age;
        }
       bitmap_clear (worklist);
     }
-  for (i = 0; i < n_blocks; i++)
-    BASIC_BLOCK_FOR_FN (cfun, blocks_in_postorder[i])->aux = NULL;
 
   BITMAP_FREE (worklist);
   BITMAP_FREE (pending);
   last_visit_age.release ();
+  last_change_age.release ();
 
   /* Dump statistics. */
   if (dump_file)
++++++ gcc7-pr97535.patch ++++++
Backport of 0f801e0b6cc9f67c9a8983127e23161f6025c5b6

Index: gcc/config/aarch64/aarch64.c
===================================================================
--- gcc/config/aarch64/aarch64.c        (revision 278213)
+++ gcc/config/aarch64/aarch64.c        (working copy)
@@ -13453,7 +13453,6 @@ aarch64_copy_one_block_and_progress_poin
 bool
 aarch64_expand_movmem (rtx *operands)
 {
-  unsigned int n;
   rtx dst = operands[0];
   rtx src = operands[1];
   rtx base;
@@ -13467,7 +13466,7 @@ aarch64_expand_movmem (rtx *operands)
   if (!CONST_INT_P (operands[2]))
     return false;
 
-  n = UINTVAL (operands[2]);
+  unsigned HOST_WIDE_INT n = UINTVAL (operands[2]);
 
   /* Try to keep the number of instructions low.  For cases below 16 bytes we
      need to make at most two moves.  For cases above 16 bytes it will be one
++++++ gcc7-remove-Wexpansion-to-defined-from-Wextra.patch ++++++
Index: gcc/c-family/c.opt
===================================================================
--- gcc/c-family/c.opt  (revision 246224)
+++ gcc/c-family/c.opt  (working copy)
@@ -596,7 +596,7 @@ C ObjC C++ ObjC++ Var(warn_double_promot
 Warn about implicit conversions from \"float\" to \"double\".
 
 Wexpansion-to-defined
-C ObjC C++ ObjC++ CPP(warn_expansion_to_defined) 
CppReason(CPP_W_EXPANSION_TO_DEFINED) Var(cpp_warn_expansion_to_defined) 
Init(0) Warning EnabledBy(Wextra || Wpedantic)
+C ObjC C++ ObjC++ CPP(warn_expansion_to_defined) 
CppReason(CPP_W_EXPANSION_TO_DEFINED) Var(cpp_warn_expansion_to_defined) 
Init(0) Warning EnabledBy(Wpedantic)
 Warn if \"defined\" is used outside #if.
 
 Wimplicit-function-declaration
diff --git gcc/testsuite/gcc.dg/cpp/defined-Wextra.c 
gcc/testsuite/gcc.dg/cpp/defined-Wextra.c
index 460a1cb43b2..b4de2b72d97 100644
--- gcc/testsuite/gcc.dg/cpp/defined-Wextra.c
+++ gcc/testsuite/gcc.dg/cpp/defined-Wextra.c
@@ -1,7 +1,7 @@
 /* Copyright (C) 2000 Free Software Foundation, Inc.  */
 
 /* { dg-do preprocess } */
-/* { dg-options "-Wextra" } */
+/* { dg-options "-Wextra -Wexpansion-to-defined" } */
 
 /* Use of defined in different contexts.  */
 
++++++ gcc7-rpmlintrc ++++++
# This line is mandatory to access the configuration functions
from Config import *

# gcc/gcc-c++ are devel packages even if not called -devel...
addFilter ("gcc.*devel-file-in-non-devel-package")
addFilter ("gcc.*devel-dependency glibc-devel")
addFilter ("gcc.*devel-dependency libstdc")
# libstdc++6-devel is the devel package of libstdc++6, no better name exists
# and we do package static libs and the .so links (but in a gcc versioned
# directory)
addFilter ("libstdc.*shlib-policy-missing-lib")
# We have names lib libgcc_s1-gcc7 for non-default GCCs
addFilter ("shlib-policy-name-error")
addFilter ("shlib-legacy-policy-name-error")
# Packages provide libgcc_s1 = $version and conflict with other providers
# of libgcc_s1
addFilter ("conflicts-with-provides")

++++++ gcc7-stack-probe.diff ++++++
Index: gcc/common.opt
===================================================================
--- gcc/common.opt      (revision 244266)
+++ gcc/common.opt      (working copy)
@@ -2295,6 +2299,10 @@ fstack-check
 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)
+Insert probes per page for dynamically allocated stack space
+
 fstack-limit
 Common Var(common_deferred_options) Defer
 
Index: gcc/explow.c
===================================================================
--- gcc/explow.c        (revision 244266)
+++ gcc/explow.c        (working copy)
@@ -1277,6 +1277,8 @@ get_dynamic_stack_size (rtx *psize, unsi
   *psize = size;
 }
 
+#define PROBE_INTERVAL (1 << STACK_CHECK_PROBE_INTERVAL_EXP)
+
 /* Return an rtx representing the address of an area of memory dynamically
    pushed on the stack.
 
@@ -1305,6 +1307,8 @@ allocate_dynamic_stack_space (rtx size,
   HOST_WIDE_INT stack_usage_size = -1;
   rtx_code_label *final_label;
   rtx final_target, target;
+  rtx loop_lab, end_lab, skip_lab, last_size, before_skip;
+  int probe_pass = 0;
 
   /* If we're asking for zero bytes, it doesn't matter what we point
      to since we can't dereference it.  But return a reasonable
@@ -1440,6 +1444,30 @@ allocate_dynamic_stack_space (rtx size,
   /* Don't let anti_adjust_stack emit notes.  */
   suppress_reg_args_size = true;
 
+  if (flag_stack_clash_protection)
+    {
+#ifndef STACK_GROWS_DOWNWARD
+      sorry("-fstack-clash-protection is incompatible with upward growing 
stack");
+#endif
+      size = copy_to_mode_reg (Pmode, convert_to_mode (Pmode, size, 1));
+      loop_lab = gen_label_rtx ();
+      end_lab = gen_label_rtx ();
+      skip_lab = gen_label_rtx ();
+      /* We insert 'target = virtual_stack_dynamic_rtx' here, but target
+        is changed later, so that insn can be constructed only later.  */
+      before_skip = get_last_insn ();
+      emit_cmp_and_jump_insns (size, CONST0_RTX (Pmode), EQ, NULL_RTX,
+                              Pmode, 1, skip_lab);
+      emit_label (loop_lab);
+      emit_cmp_and_jump_insns (size, GEN_INT (PROBE_INTERVAL), LTU,
+                              NULL_RTX, Pmode, 1, end_lab);
+      last_size = expand_binop (Pmode, sub_optab, size, GEN_INT 
(PROBE_INTERVAL), size,
+                               1, OPTAB_WIDEN);
+      gcc_assert (last_size == size);
+      size = GEN_INT (PROBE_INTERVAL);
+    }
+
+again:
   /* Perform the required allocation from the stack.  Some systems do
      this differently than simply incrementing/decrementing from the
      stack pointer, such as acquiring the space by calling malloc().  */
@@ -1499,6 +1527,15 @@ allocate_dynamic_stack_space (rtx size,
       if (STACK_GROWS_DOWNWARD)
        emit_move_insn (target, virtual_stack_dynamic_rtx);
     }
+  if (flag_stack_clash_protection && probe_pass == 0)
+    {
+      probe_pass = 1;
+      emit_stack_probe (target);
+      emit_jump (loop_lab);
+      emit_label (end_lab);
+      size = last_size;
+      goto again;
+    }
 
   suppress_reg_args_size = false;
 
@@ -1510,6 +1547,17 @@ allocate_dynamic_stack_space (rtx size,
       emit_label (final_label);
       target = final_target;
     }
+  if (flag_stack_clash_protection)
+    {
+      rtx seq;
+      emit_stack_probe (target);
+      emit_label (skip_lab);
+      start_sequence ();
+      emit_move_insn (target, virtual_stack_dynamic_rtx);
+      seq = get_insns ();
+      end_sequence ();
+      emit_insn_after (seq, before_skip);
+    }
 
   target = align_dynamic_address (target, required_align);
 
@@ -1593,8 +1641,6 @@ emit_stack_probe (rtx address)
    the current stack pointer.  STACK_GROWS_DOWNWARD says whether to add
    or subtract them from the stack pointer.  */
 
-#define PROBE_INTERVAL (1 << STACK_CHECK_PROBE_INTERVAL_EXP)
-
 #if STACK_GROWS_DOWNWARD
 #define STACK_GROW_OP MINUS
 #define STACK_GROW_OPTAB sub_optab
++++++ gcc7-testsuite-fixes.patch ++++++
diff --git a/gcc/testsuite/gcc.dg/strncmp-2.c b/gcc/testsuite/gcc.dg/strncmp-2.c
index ed6c5fa0880..db46d0af4e0 100644
--- a/gcc/testsuite/gcc.dg/strncmp-2.c
+++ b/gcc/testsuite/gcc.dg/strncmp-2.c
@@ -40,6 +40,7 @@ static void test_driver_strncmp (void (test_strncmp)(const 
char *, const char *,
     e = lib_memcmp(buf1,p2,sz);
     (*test_memcmp)(buf1,p2,e);
   }
+  mprotect (buf2+pgsz,pgsz,PROT_READ|PROT_WRITE);
   free(buf2);
 }
 
diff --git a/libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc 
b/libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc
index ba566f869c6..ca51d6d1a78 100644
--- a/libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc
+++ b/libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc
@@ -26,10 +26,12 @@ void
 test01()
 {
   FILE* f = std::fopen("79820.txt", "w");
+    {
+      errno = 127;
+      __gnu_cxx::stdio_filebuf<char> b(f, std::ios::out, BUFSIZ);
+      VERIFY(errno == 127); // PR libstdc++/79820
+    }
   std::fclose(f);
-  errno = 127;
-  __gnu_cxx::stdio_filebuf<char> b(f, std::ios::out, BUFSIZ);
-  VERIFY(errno == 127); // PR libstdc++/79820
 }
 
 int
diff --git a/gcc/testsuite/gcc.target/i386/xop-hsubX.c 
b/gcc/testsuite/gcc.target/i386/xop-hsubX.c
index f0fa9b312f2..dc7944d8bb7 100644
--- a/gcc/testsuite/gcc.target/i386/xop-hsubX.c
+++ b/gcc/testsuite/gcc.target/i386/xop-hsubX.c
@@ -58,6 +58,7 @@ check_sbyte2word ()
            check_fails++;      
        }
     }
+  return check_fails;
 }
 
 static int
@@ -75,6 +76,7 @@ check_sword2dword ()
            check_fails++;      
        }
     }
+  return check_fails;
 }
 
 static int
@@ -92,6 +94,7 @@ check_dword2qword ()
            check_fails++;      
        }
     }
+  return check_fails;
 }
 
 static void
++++++ pre_checkin.sh ++++++
#!/bin/bash
# This script is called automatically during autobuild checkin.

case $0 in
  \./*)
    here=$PWD
    ;;
  */*)
    here=${0%/*}
    ;;
  *)
    here=$PWD
    ;;
esac
case ${here##*/} in
  gcc*.*)
    # Handle maintainance projects with .$REPO suffix
    suffix=${here##*/}
    suffix=${suffix%%\.*}
    set ${suffix#gcc}
    ;;
  gcc-*)
    suffix=${here##*/}
    set ${suffix#*-}-
    ;;
  gcc[0-9]*)
    suffix=${here##*/}
    set ${suffix#gcc}
    ;;
esac
. ${here}/change_spec
++++++ tls-no-direct.diff ++++++
For i?86 negative offsets to %fs segment accesses cause a hypervisor
trap for Xen.  Avoid this by making accesses indirect.

???  Note that similar to the behavior on SLE11 this only affects
the compiler built on %ix86, not that on x86_64, even with -m32.

Index: gcc/config/i386/linux.h
===================================================================
--- gcc/config/i386/linux.h.orig        2015-12-17 15:07:37.785650062 +0100
+++ gcc/config/i386/linux.h     2015-12-17 15:08:06.393983290 +0100
@@ -24,3 +24,9 @@ along with GCC; see the file COPYING3.
 
 #undef MUSL_DYNAMIC_LINKER
 #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
+
+/* This slows down Xen, so take a very small general performance hit
+   for not accessing the %fs segment with negative offsets by making
+   GCC not emit direct accesses to %fs at all.  */
+#undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT
+#define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT 0

Reply via email to