From f4e84891802028b52040d019d6d3bd9ab991c07392b882041ab43557d5e6ec1b Mon Sep 17 00:00:00 2001
From: Richard Biener
Date: Tue, 22 Oct 2024 08:05:40 +0000
Subject: [PATCH] - Remove epiphany build, newlib no longer builds for it.
OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gcc7?expand=0&rev=250
---
.gitattributes | 23 +
.gitignore | 1 +
README.First-for.SuSE.packagers | 37 +
_constraints | 11 +
_multibuild | 22 +
change_spec | 125 +
check-build.sh | 38 +
cross-aarch64-gcc7.spec | 928 ++++
cross-arm-gcc7.spec | 928 ++++
cross-arm-none-gcc7-bootstrap.spec | 929 ++++
cross-arm-none-gcc7.spec | 928 ++++
cross-avr-gcc7-bootstrap.spec | 928 ++++
cross-avr-gcc7.spec | 928 ++++
cross-epiphany-gcc7-bootstrap.spec | 929 ++++
cross-epiphany-gcc7.spec | 928 ++++
cross-hppa-gcc7.spec | 928 ++++
cross-i386-gcc7.spec | 928 ++++
cross-m68k-gcc7.spec | 928 ++++
cross-mips-gcc7.spec | 928 ++++
cross-nvptx-gcc7.spec | 928 ++++
cross-ppc64-gcc7.spec | 928 ++++
cross-ppc64le-gcc7.spec | 928 ++++
cross-rx-gcc7-bootstrap.spec | 929 ++++
cross-rx-gcc7.spec | 928 ++++
cross-s390x-gcc7.spec | 928 ++++
cross-sparc-gcc7.spec | 928 ++++
cross-sparc64-gcc7.spec | 928 ++++
cross-x86_64-gcc7.spec | 928 ++++
cross.spec.in | 405 ++
gcc-7.5.0+r278197.tar.xz | 3 +
gcc-add-defaultsspec.diff | 51 +
gcc.spec.in | 2619 ++++++++++
gcc41-ppc32-retaddr.patch | 91 +
gcc43-no-unwind-tables.diff | 13 +
gcc44-rename-info-files.patch | 665 +++
gcc44-textdomain.patch | 116 +
gcc48-bsc1161913.patch | 78 +
gcc48-libstdc++-api-reference.patch | 14 +
gcc48-remove-mpfr-2.4.0-requirement.patch | 247 +
gcc5-no-return-gcc43-workaround.patch | 23 +
gcc7-aarch64-bsc1214052.patch | 993 ++++
gcc7-aarch64-moutline-atomics.patch | 4298 +++++++++++++++++
gcc7-aarch64-sls-miti-1.patch | 193 +
gcc7-aarch64-sls-miti-2.patch | 606 +++
gcc7-aarch64-sls-miti-3.patch | 578 +++
gcc7-aarch64-untyped_call.patch | 63 +
gcc7-ada-MINSTKSZ.patch | 51 +
gcc7-ada-Target_Name.patch | 44 +
gcc7-avoid-fixinc-error.diff | 18 +
gcc7-bsc1146475.patch | 226 +
gcc7-bsc1160086.patch | 72 +
gcc7-bsc1216488.patch | 13 +
gcc7-fix-retrieval-of-testnames.patch | 260 +
gcc7-flive-patching.patch | 662 +++
...ude-linux-fs.h-when-building-gen-sys.patch | 35 +
...rry-pick-9cf13067cb5088626ba7-from-u.patch | 39 +
gcc7-lra-elim.patch | 47 +
...d-entry-for-patchable_function_entry.patch | 555 +++
...atchable-function-entry-tests-for-nv.patch | 53 +
...ut-on-nvptx-for-fpatchable-function-.patch | 61 +
...Adapt-scan-assembler-times-for-alpha.patch | 63 +
...le_function_entry-decl.c-Use-3-NOPs-.patch | 66 +
...se-the-dedicated-NOP-instructions-fo.patch | 387 ++
...ex-to-search-for-uppercase-NOP-instr.patch | 60 +
...mentation-fault-with-patchable_funct.patch | 205 +
...le_function_entry-decl.c-Pass-mcpu-g.patch | 70 +
...le_function_entry-decl.c-Do-not-run-.patch | 60 +
...le_function_entry-decl.c-Add-fno-pie.patch | 57 +
...946-ICE-in-assemble_start_function-a.patch | 153 +
...ks.c-default_print_patchable_functio.patch | 36 +
..._patchable_function_entries-to-POINT.patch | 34 +
...93242-patchable-function-entry-broke.patch | 43 +
...-Fix-patchable-function-entry-on-arc.patch | 38 +
...ch_area_size-and-patch_area_entry-to.patch | 249 +
...te-Adjust-patchable_function-tests-f.patch | 66 +
...-section-flag-o-for-__patchable_func.patch | 973 ++++
...Fix-up-__patchable_function_entries-.patch | 88 +
...Avoid-fpatchable-function-entry-regr.patch | 198 +
...unwinding-issues-when-pfe-is-enabled.patch | 355 ++
gcc7-pr55917.patch | 117 +
gcc7-pr72764.patch | 109 +
gcc7-pr78263.patch | 155 +
gcc7-pr81942.patch | 116 +
gcc7-pr82248.diff | 13 +
gcc7-pr85887.patch | 28 +
gcc7-pr87723.patch | 81 +
gcc7-pr88345-min-func-alignment.diff | 141 +
gcc7-pr88522.patch | 149 +
gcc7-pr89124.patch | 68 +
gcc7-pr92154.patch | 56 +
gcc7-pr92692.patch | 139 +
gcc7-pr93246.patch | 128 +
gcc7-pr93888.patch | 41 +
gcc7-pr93965.patch | 44 +
gcc7-pr94148.patch | 140 +
gcc7-pr97535.patch | 23 +
...ve-Wexpansion-to-defined-from-Wextra.patch | 26 +
gcc7-rpmlintrc | 19 +
gcc7-sanitizer-cyclades.patch | 87 +
gcc7-stack-probe.diff | 111 +
gcc7-testresults.spec | 922 ++++
gcc7-testsuite-fixes.patch | 60 +
gcc7.changes | 809 ++++
gcc7.spec | 3322 +++++++++++++
libgcc-riscv-div.patch | 121 +
nvptx-newlib.tar.xz | 3 +
pre_checkin.sh | 31 +
tls-no-direct.diff | 20 +
108 files changed, 43220 insertions(+)
create mode 100644 .gitattributes
create mode 100644 .gitignore
create mode 100644 README.First-for.SuSE.packagers
create mode 100644 _constraints
create mode 100644 _multibuild
create mode 100644 change_spec
create mode 100644 check-build.sh
create mode 100644 cross-aarch64-gcc7.spec
create mode 100644 cross-arm-gcc7.spec
create mode 100644 cross-arm-none-gcc7-bootstrap.spec
create mode 100644 cross-arm-none-gcc7.spec
create mode 100644 cross-avr-gcc7-bootstrap.spec
create mode 100644 cross-avr-gcc7.spec
create mode 100644 cross-epiphany-gcc7-bootstrap.spec
create mode 100644 cross-epiphany-gcc7.spec
create mode 100644 cross-hppa-gcc7.spec
create mode 100644 cross-i386-gcc7.spec
create mode 100644 cross-m68k-gcc7.spec
create mode 100644 cross-mips-gcc7.spec
create mode 100644 cross-nvptx-gcc7.spec
create mode 100644 cross-ppc64-gcc7.spec
create mode 100644 cross-ppc64le-gcc7.spec
create mode 100644 cross-rx-gcc7-bootstrap.spec
create mode 100644 cross-rx-gcc7.spec
create mode 100644 cross-s390x-gcc7.spec
create mode 100644 cross-sparc-gcc7.spec
create mode 100644 cross-sparc64-gcc7.spec
create mode 100644 cross-x86_64-gcc7.spec
create mode 100644 cross.spec.in
create mode 100644 gcc-7.5.0+r278197.tar.xz
create mode 100644 gcc-add-defaultsspec.diff
create mode 100644 gcc.spec.in
create mode 100644 gcc41-ppc32-retaddr.patch
create mode 100644 gcc43-no-unwind-tables.diff
create mode 100644 gcc44-rename-info-files.patch
create mode 100644 gcc44-textdomain.patch
create mode 100644 gcc48-bsc1161913.patch
create mode 100644 gcc48-libstdc++-api-reference.patch
create mode 100644 gcc48-remove-mpfr-2.4.0-requirement.patch
create mode 100644 gcc5-no-return-gcc43-workaround.patch
create mode 100644 gcc7-aarch64-bsc1214052.patch
create mode 100644 gcc7-aarch64-moutline-atomics.patch
create mode 100644 gcc7-aarch64-sls-miti-1.patch
create mode 100644 gcc7-aarch64-sls-miti-2.patch
create mode 100644 gcc7-aarch64-sls-miti-3.patch
create mode 100644 gcc7-aarch64-untyped_call.patch
create mode 100644 gcc7-ada-MINSTKSZ.patch
create mode 100644 gcc7-ada-Target_Name.patch
create mode 100644 gcc7-avoid-fixinc-error.diff
create mode 100644 gcc7-bsc1146475.patch
create mode 100644 gcc7-bsc1160086.patch
create mode 100644 gcc7-bsc1216488.patch
create mode 100644 gcc7-fix-retrieval-of-testnames.patch
create mode 100644 gcc7-flive-patching.patch
create mode 100644 gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
create mode 100644 gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
create mode 100644 gcc7-lra-elim.patch
create mode 100644 gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
create mode 100644 gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
create mode 100644 gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
create mode 100644 gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
create mode 100644 gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
create mode 100644 gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
create mode 100644 gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
create mode 100644 gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
create mode 100644 gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
create mode 100644 gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
create mode 100644 gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
create mode 100644 gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
create mode 100644 gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
create mode 100644 gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
create mode 100644 gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
create mode 100644 gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
create mode 100644 gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
create mode 100644 gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
create mode 100644 gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
create mode 100644 gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
create mode 100644 gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
create mode 100644 gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
create mode 100644 gcc7-pr55917.patch
create mode 100644 gcc7-pr72764.patch
create mode 100644 gcc7-pr78263.patch
create mode 100644 gcc7-pr81942.patch
create mode 100644 gcc7-pr82248.diff
create mode 100644 gcc7-pr85887.patch
create mode 100644 gcc7-pr87723.patch
create mode 100644 gcc7-pr88345-min-func-alignment.diff
create mode 100644 gcc7-pr88522.patch
create mode 100644 gcc7-pr89124.patch
create mode 100644 gcc7-pr92154.patch
create mode 100644 gcc7-pr92692.patch
create mode 100644 gcc7-pr93246.patch
create mode 100644 gcc7-pr93888.patch
create mode 100644 gcc7-pr93965.patch
create mode 100644 gcc7-pr94148.patch
create mode 100644 gcc7-pr97535.patch
create mode 100644 gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
create mode 100644 gcc7-rpmlintrc
create mode 100644 gcc7-sanitizer-cyclades.patch
create mode 100644 gcc7-stack-probe.diff
create mode 100644 gcc7-testresults.spec
create mode 100644 gcc7-testsuite-fixes.patch
create mode 100644 gcc7.changes
create mode 100644 gcc7.spec
create mode 100644 libgcc-riscv-div.patch
create mode 100644 nvptx-newlib.tar.xz
create mode 100644 pre_checkin.sh
create mode 100644 tls-no-direct.diff
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..9b03811
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,23 @@
+## Default LFS
+*.7z filter=lfs diff=lfs merge=lfs -text
+*.bsp filter=lfs diff=lfs merge=lfs -text
+*.bz2 filter=lfs diff=lfs merge=lfs -text
+*.gem filter=lfs diff=lfs merge=lfs -text
+*.gz filter=lfs diff=lfs merge=lfs -text
+*.jar filter=lfs diff=lfs merge=lfs -text
+*.lz filter=lfs diff=lfs merge=lfs -text
+*.lzma filter=lfs diff=lfs merge=lfs -text
+*.obscpio filter=lfs diff=lfs merge=lfs -text
+*.oxt filter=lfs diff=lfs merge=lfs -text
+*.pdf filter=lfs diff=lfs merge=lfs -text
+*.png filter=lfs diff=lfs merge=lfs -text
+*.rpm filter=lfs diff=lfs merge=lfs -text
+*.tbz filter=lfs diff=lfs merge=lfs -text
+*.tbz2 filter=lfs diff=lfs merge=lfs -text
+*.tgz filter=lfs diff=lfs merge=lfs -text
+*.ttf filter=lfs diff=lfs merge=lfs -text
+*.txz filter=lfs diff=lfs merge=lfs -text
+*.whl filter=lfs diff=lfs merge=lfs -text
+*.xz filter=lfs diff=lfs merge=lfs -text
+*.zip filter=lfs diff=lfs merge=lfs -text
+*.zst filter=lfs diff=lfs merge=lfs -text
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..57affb6
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.osc
diff --git a/README.First-for.SuSE.packagers b/README.First-for.SuSE.packagers
new file mode 100644
index 0000000..6702c30
--- /dev/null
+++ b/README.First-for.SuSE.packagers
@@ -0,0 +1,37 @@
+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.
diff --git a/_constraints b/_constraints
new file mode 100644
index 0000000..4a09b4d
--- /dev/null
+++ b/_constraints
@@ -0,0 +1,11 @@
+
+
+
+ 16
+
+
+ 4
+
+ 4
+
+
diff --git a/_multibuild b/_multibuild
new file mode 100644
index 0000000..ac505db
--- /dev/null
+++ b/_multibuild
@@ -0,0 +1,22 @@
+
+gcc7-testresults
+cross-aarch64-gcc7
+cross-arm-gcc7
+cross-avr-gcc7-bootstrap
+cross-avr-gcc7
+cross-i386-gcc7
+cross-x86_64-gcc7
+cross-s390x-gcc7
+cross-sparc-gcc7
+cross-sparc64-gcc7
+cross-ppc64-gcc7
+cross-ppc64le-gcc7
+cross-m68k-gcc7
+cross-mips-gcc7
+cross-hppa-gcc7
+cross-arm-none-gcc7-bootstrap
+cross-arm-none-gcc7
+cross-rx-gcc7-bootstrap
+cross-rx-gcc7
+cross-nvptx-gcc7
+
diff --git a/change_spec b/change_spec
new file mode 100644
index 0000000..c226f53
--- /dev/null
+++ b/change_spec
@@ -0,0 +1,125 @@
+#!/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
+
+echo '' > _multibuild
+echo ''gcc$base_ver-testresults'' >> _multibuild
+
+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
+
+ echo ''$pkgname'' >> _multibuild
+}
+
+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
+
+echo '' >> _multibuild
+
+osc service localrun format_spec_file
diff --git a/check-build.sh b/check-build.sh
new file mode 100644
index 0000000..d08e7ec
--- /dev/null
+++ b/check-build.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+# Copyright (c) 2003,2005 SUSE Linux Products GmbH, Germany. All rights reserved.
+#
+# Authors: Thorsten Kukuk
+#
+# 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
+
diff --git a/cross-aarch64-gcc7.spec b/cross-aarch64-gcc7.spec
new file mode 100644
index 0000000..71da18f
--- /dev/null
+++ b/cross-aarch64-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-aarch64-gcc7
+%define cross_arch aarch64
+%define gcc_target_arch aarch64-suse-linux
+%define gcc_icecream 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+ExclusiveArch: x86_64
+%define nvptx_newlib 1
+%endif
+%endif
+%if 0%{?gcc_icecream:1}
+ExclusiveArch: ppc64le ppc64 x86_64 s390x
+%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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-arm-gcc7.spec b/cross-arm-gcc7.spec
new file mode 100644
index 0000000..2f124d2
--- /dev/null
+++ b/cross-arm-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-arm-gcc7
+%define cross_arch arm
+%define gcc_target_arch arm-suse-linux-gnueabi
+%define gcc_icecream 0
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-arm-none-gcc7-bootstrap.spec b/cross-arm-none-gcc7-bootstrap.spec
new file mode 100644
index 0000000..83ec0ff
--- /dev/null
+++ b/cross-arm-none-gcc7-bootstrap.spec
@@ -0,0 +1,929 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-arm-none-gcc7-bootstrap
+%define cross_arch arm-none
+%define gcc_target_arch arm-none-eabi
+%define gcc_target_newlib 1
+%define gcc_libc_bootstrap 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-arm-none-gcc7.spec b/cross-arm-none-gcc7.spec
new file mode 100644
index 0000000..e34b1b6
--- /dev/null
+++ b/cross-arm-none-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-arm-none-gcc7
+%define cross_arch arm-none
+%define gcc_target_arch arm-none-eabi
+%define gcc_target_newlib 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-avr-gcc7-bootstrap.spec b/cross-avr-gcc7-bootstrap.spec
new file mode 100644
index 0000000..97cfbdc
--- /dev/null
+++ b/cross-avr-gcc7-bootstrap.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-avr-gcc7-bootstrap
+%define cross_arch avr
+%define gcc_target_arch avr
+%define gcc_libc_bootstrap 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-avr-gcc7.spec b/cross-avr-gcc7.spec
new file mode 100644
index 0000000..f63754e
--- /dev/null
+++ b/cross-avr-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-avr-gcc7
+%define cross_arch avr
+%define gcc_target_arch avr
+
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-epiphany-gcc7-bootstrap.spec b/cross-epiphany-gcc7-bootstrap.spec
new file mode 100644
index 0000000..69bcae0
--- /dev/null
+++ b/cross-epiphany-gcc7-bootstrap.spec
@@ -0,0 +1,929 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-epiphany-gcc7-bootstrap
+%define cross_arch epiphany
+%define gcc_target_arch epiphany-elf
+%define gcc_target_newlib 1
+%define gcc_libc_bootstrap 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-epiphany-gcc7.spec b/cross-epiphany-gcc7.spec
new file mode 100644
index 0000000..c7d2310
--- /dev/null
+++ b/cross-epiphany-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-epiphany-gcc7
+%define cross_arch epiphany
+%define gcc_target_arch epiphany-elf
+%define gcc_target_newlib 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-hppa-gcc7.spec b/cross-hppa-gcc7.spec
new file mode 100644
index 0000000..cdb7f98
--- /dev/null
+++ b/cross-hppa-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-hppa-gcc7
+%define cross_arch hppa
+%define gcc_target_arch hppa-suse-linux
+%define gcc_icecream 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-i386-gcc7.spec b/cross-i386-gcc7.spec
new file mode 100644
index 0000000..ab5e10d
--- /dev/null
+++ b/cross-i386-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-i386-gcc7
+%define cross_arch i386
+%define gcc_target_arch i586-suse-linux
+%define gcc_icecream 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-m68k-gcc7.spec b/cross-m68k-gcc7.spec
new file mode 100644
index 0000000..b09b167
--- /dev/null
+++ b/cross-m68k-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-m68k-gcc7
+%define cross_arch m68k
+%define gcc_target_arch m68k-suse-linux
+%define gcc_icecream 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-mips-gcc7.spec b/cross-mips-gcc7.spec
new file mode 100644
index 0000000..eb48b54
--- /dev/null
+++ b/cross-mips-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-mips-gcc7
+%define cross_arch mips
+%define gcc_target_arch mips-suse-linux
+%define gcc_icecream 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-nvptx-gcc7.spec b/cross-nvptx-gcc7.spec
new file mode 100644
index 0000000..dd6d154
--- /dev/null
+++ b/cross-nvptx-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-nvptx-gcc7
+%define cross_arch nvptx
+%define gcc_target_arch nvptx-none
+%define gcc_accel 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-ppc64-gcc7.spec b/cross-ppc64-gcc7.spec
new file mode 100644
index 0000000..2406697
--- /dev/null
+++ b/cross-ppc64-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-ppc64-gcc7
+%define cross_arch ppc64
+%define gcc_target_arch powerpc64-suse-linux
+%define gcc_icecream 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+ExclusiveArch: x86_64
+%define nvptx_newlib 1
+%endif
+%endif
+%if 0%{?gcc_icecream:1}
+ExclusiveArch: ppc64le 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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-ppc64le-gcc7.spec b/cross-ppc64le-gcc7.spec
new file mode 100644
index 0000000..e55fd46
--- /dev/null
+++ b/cross-ppc64le-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-ppc64le-gcc7
+%define cross_arch ppc64le
+%define gcc_target_arch powerpc64le-suse-linux
+%define gcc_icecream 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+ExclusiveArch: x86_64
+%define nvptx_newlib 1
+%endif
+%endif
+%if 0%{?gcc_icecream:1}
+ExclusiveArch: 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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-rx-gcc7-bootstrap.spec b/cross-rx-gcc7-bootstrap.spec
new file mode 100644
index 0000000..4f04e27
--- /dev/null
+++ b/cross-rx-gcc7-bootstrap.spec
@@ -0,0 +1,929 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-rx-gcc7-bootstrap
+%define cross_arch rx
+%define gcc_target_arch rx-elf
+%define gcc_target_newlib 1
+%define gcc_libc_bootstrap 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-rx-gcc7.spec b/cross-rx-gcc7.spec
new file mode 100644
index 0000000..d3da371
--- /dev/null
+++ b/cross-rx-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-rx-gcc7
+%define cross_arch rx
+%define gcc_target_arch rx-elf
+%define gcc_target_newlib 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-s390x-gcc7.spec b/cross-s390x-gcc7.spec
new file mode 100644
index 0000000..18f7d37
--- /dev/null
+++ b/cross-s390x-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-s390x-gcc7
+%define cross_arch s390x
+%define gcc_target_arch s390x-suse-linux
+%define gcc_icecream 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+ExclusiveArch: x86_64
+%define nvptx_newlib 1
+%endif
+%endif
+%if 0%{?gcc_icecream:1}
+ExclusiveArch: ppc64le ppc64 x86_64 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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-sparc-gcc7.spec b/cross-sparc-gcc7.spec
new file mode 100644
index 0000000..557aa37
--- /dev/null
+++ b/cross-sparc-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-sparc-gcc7
+%define cross_arch sparcv9
+%define gcc_target_arch sparc-suse-linux
+%define gcc_icecream 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-sparc64-gcc7.spec b/cross-sparc64-gcc7.spec
new file mode 100644
index 0000000..bbb78bd
--- /dev/null
+++ b/cross-sparc64-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-sparc64-gcc7
+%define cross_arch sparc64
+%define gcc_target_arch sparc64-suse-linux
+%define gcc_icecream 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross-x86_64-gcc7.spec b/cross-x86_64-gcc7.spec
new file mode 100644
index 0000000..8aaecfd
--- /dev/null
+++ b/cross-x86_64-gcc7.spec
@@ -0,0 +1,928 @@
+#
+# spec file
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+%define pkgname cross-x86_64-gcc7
+%define cross_arch x86_64
+%define gcc_target_arch x86_64-suse-linux
+%define gcc_icecream 1
+#
+# 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}
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 0
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -7
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+%if "%{cross_arch}" != "nvptx"
+BuildRequires: cross-%{binutils_target}-binutils
+Requires: cross-%{binutils_target}-binutils
+%endif
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gcc-c++
+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: cross-nvptx-newlib-devel >= %{version}-%{release}
+Requires: nvptx-tools
+ExclusiveArch:
+%define nvptx_newlib 1
+%endif
+%endif
+%if 0%{?gcc_icecream:1}
+ExclusiveArch: ppc64le ppc64 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}-gcc7
+%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
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+%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-gcc7-icecream-backend
+Summary: Icecream backend for the GNU C Compiler
+Group: Development/Languages/C and C++
+
+%description -n cross-%cross_arch-gcc7-icecream-backend
+This package contains the icecream environment for the GNU C Compiler
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%package -n cross-nvptx-newlib7-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-newlib7-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} 7 \
+ --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-gcc7-icecream-backend
+%defattr(-,root,root)
+/usr/share/icecream-envs
+%endif
+
+%if 0%{?nvptx_newlib:1}
+%files -n cross-nvptx-newlib7-devel
+%defattr(-,root,root)
+%{_prefix}/%{gcc_target_arch}
+%endif
+
+%changelog
diff --git a/cross.spec.in b/cross.spec.in
new file mode 100644
index 0000000..8a4d6b3
--- /dev/null
+++ b/cross.spec.in
@@ -0,0 +1,405 @@
+#
+# 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@
diff --git a/gcc-7.5.0+r278197.tar.xz b/gcc-7.5.0+r278197.tar.xz
new file mode 100644
index 0000000..1eb52fa
--- /dev/null
+++ b/gcc-7.5.0+r278197.tar.xz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8f2be0008f0069d4d285ff82e5a73982ecdb1121e25be1bf9ff53207b4b498bd
+size 61466948
diff --git a/gcc-add-defaultsspec.diff b/gcc-add-defaultsspec.diff
new file mode 100644
index 0000000..8719c39
--- /dev/null
+++ b/gcc-add-defaultsspec.diff
@@ -0,0 +1,51 @@
+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. */
diff --git a/gcc.spec.in b/gcc.spec.in
new file mode 100644
index 0000000..a66f9c3
--- /dev/null
+++ b/gcc.spec.in
@@ -0,0 +1,2619 @@
+#
+# spec file for package gcc7
+#
+# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+# nospeccleaner
+
+
+# Ada currently fails to build on a few platforms, enable it only
+# on those that work
+%if %{suse_version} >= 1310
+%if %{suse_version} >= 1330
+%define ada_arch %ix86 x86_64 ppc ppc64 ppc64le s390 s390x ia64 aarch64
+%else
+%define ada_arch %ix86 x86_64 ppc ppc64 s390 ia64
+%endif
+%else
+%define ada_arch %ix86 x86_64 ppc s390 ia64
+%endif
+
+%ifarch %ada_arch
+%define build_ada 1
+%else
+%define build_ada 0
+%endif
+
+%define quadmath_arch %ix86 x86_64 ia64
+%define tsan_arch x86_64 aarch64 ppc ppc64 ppc64le
+%define asan_arch x86_64 %ix86 ppc ppc64 ppc64le s390 s390x %sparc %arm aarch64
+%define itm_arch x86_64 %ix86 %arm aarch64 ppc ppc64 ppc64le s390 s390x %sparc
+%define atomic_arch x86_64 %ix86 %arm aarch64 ppc ppc64 ppc64le s390 s390x %sparc m68k ia64 riscv64
+%define lsan_arch x86_64 aarch64 ppc ppc64 ppc64le
+%define ubsan_arch x86_64 %ix86 ppc ppc64 ppc64le s390 s390x %arm aarch64
+%if 0%{?build_libvtv:1}
+%define vtv_arch x86_64 %ix86
+%endif
+%define cilkrts_arch x86_64 %ix86
+%if %{suse_version} >= 1310
+%define mpx_arch x86_64 %ix86
+%endif
+
+%define build_cp 1
+%define build_fortran 1
+%define build_objc 1
+%define build_objcp 1
+%ifarch riscv64
+%define build_go 0
+%else
+%define build_go 1
+%endif
+
+%if %{build_objcp}
+%define build_cp 1
+%define build_objc 1
+%endif
+
+# For optional compilers only build C, C++, Fortran, Ada and Go
+%if 0%{?build_optional_compiler_languages:1}
+%define build_objc 0
+%define build_objcp 0
+%endif
+
+%ifarch x86_64
+%define build_hsa 1
+%define build_nvptx 1
+%else
+%define build_hsa 0
+%define build_nvptx 0
+%endif
+
+# Enable plugins just for Tumbleweed, not for SLES
+%if 0%{!?sle_version:1}
+%define enable_plugins 1
+%else
+%define enable_plugins 0
+%endif
+
+# Shared library SONAME versions
+%ifarch hppa
+%define libgcc_s 4
+%else
+%ifarch m68k
+%define libgcc_s 2
+%else
+%define libgcc_s 1
+%endif
+%endif
+%define libgomp_sover 1
+%define libstdcxx_sover 6
+%define libobjc_sover 4
+%define libgfortran_sover 4
+%define libquadmath_sover 0
+%define libasan_sover 4
+%define libtsan_sover 0
+%define libatomic_sover 1
+%define libitm_sover 1
+%define libubsan_sover 0
+%define liblsan_sover 0
+%define libvtv_sover 0
+%define libcilkrts_sover 5
+%define libgo_sover 11
+%define libmpx_sover 2
+%define libmpxwrappers_sover 2
+
+# Shared library package suffix
+# This is used for the "non-standard" set of libraries, the standard
+# being defined by %%product_libs_gcc_ver, the GCC version that should
+# provide un-suffixed shared library packages following the shared-library
+# policy. Even suffixed variants should provide the shared-library policy
+# mandated names and ensure they conflict with each other.
+# Individual shared libraries can be directed to be built from individual
+# gcc versions by defining %%product_libs_gcc_ver_libgcc_s1 for example,
+# generally %%product_libs_gcc_ver_%%name%%sover, similarly.
+
+%define itsme@base_ver@ 1
+%define plv_ %{!?product_libs_gcc_ver:@base_ver@}%{?product_libs_gcc_ver}
+%define plv() %{expand:%%{!?itsme%{expand:%%{!?product_libs_gcc_ver_%{1}%{2}:%%{plv_}}%%{?product_libs_gcc_ver_%{1}%{2}}}:-gcc@base_ver@}}
+
+%define libgcc_s_suffix %{plv libgcc_s %{libgcc_s}}
+%define libgomp_suffix %{plv libgomp %{libgomp_sover}}
+%define libstdcxx_suffix %{plv libstdcxx %{libstdcxx_sover}}
+%define libobjc_suffix %{plv libobjc %{libobjc_sover}}
+%define libgfortran_suffix %{plv libgfortran %{libgfortran_sover}}
+%define libquadmath_suffix %{plv libquadmath %{libquadmath_sover}}
+%define libasan_suffix %{plv libasan %{libasan_sover}}
+%define libtsan_suffix %{plv libtsan %{libtsan_sover}}
+%define libatomic_suffix %{plv libatomic %{libatomic_sover}}
+%define libitm_suffix %{plv libitm %{libitm_sover}}
+%define libubsan_suffix %{plv libubsan %{libubsan_sover}}
+%define liblsan_suffix %{plv liblsan %{liblsan_sover}}
+%define libvtv_suffix %{plv libvtv %{libvtv_sover}}
+%define libcilkrts_suffix %{plv libcilkrts %{libcilkrts_sover}}
+%define libgo_suffix %{plv libgo %{libgo_sover}}
+%define libmpx_suffix %{plv libmpx %{libmpx_sover}}
+%define libmpxwrappers_suffix %{plv libmpxwrappers %{libmpx_sover}}
+
+
+# libFOO-devel package suffix
+%define libdevel_suffix -gcc@base_ver@
+
+
+%if %{suse_version} >= 1220
+%define selfconflict() %1
+%else
+%define selfconflict() otherproviders(%1)
+%endif
+
+
+Name: gcc@base_ver@
+BuildRequires: xz
+# With generated files in src we could drop the following
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: gettext-devel
+%if %{suse_version} > 1220
+BuildRequires: makeinfo
+%else
+BuildRequires: texinfo
+%endif
+# until here, but at least renaming and patching info files breaks this
+BuildRequires: gcc-c++
+BuildRequires: glibc-devel-32bit
+BuildRequires: mpc-devel
+BuildRequires: mpfr-devel
+BuildRequires: perl
+BuildRequires: zlib-devel
+%if %{suse_version} >= 1230
+BuildRequires: isl-devel
+%endif
+%if %{build_ada}
+%if 0%{?gcc_version:%{gcc_version}} > 7
+%define hostsuffix %{binsuffix}
+BuildRequires: gcc@base_ver@-ada
+BuildRequires: gcc@base_ver@-c++
+%else
+%if %{suse_version} < 1310
+%define hostsuffix -4.8
+BuildRequires: gcc48-ada
+BuildRequires: gcc48-c++
+%else
+%define hostsuffix %{nil}
+BuildRequires: gcc-ada
+%endif
+%endif
+%endif
+%if 0%{?building_testsuite:1}
+# For building the libstdc++ API reference
+BuildRequires: doxygen
+BuildRequires: graphviz
+%endif
+%ifarch ia64
+BuildRequires: libunwind-devel
+%endif
+%if 0%{?run_tests:1}
+BuildRequires: dejagnu
+BuildRequires: expect
+BuildRequires: gdb
+%if %{build_nvptx}
+BuildRequires: cross-nvptx-gcc@base_ver@
+BuildRequires: cross-nvptx-newlib@base_ver@-devel
+%endif
+%endif
+#!BuildIgnore: gcc-PIE
+
+%define separate_bi32 0
+%define separate_bi64 0
+%if 0%{!?disable_32bit:1}
+%ifarch ppc sparcv9
+%define separate_bi64 1
+%endif
+%ifarch x86_64 s390x ppc64 sparc64
+%define separate_bi32 1
+%endif
+%endif
+
+# Define two macros to trigger -32bit or -64bit package variants
+%define separate_biarch 0
+%if %{separate_bi32}
+%define separate_biarch 1
+%define separate_biarch_suffix -32bit
+%endif
+%if %{separate_bi64}
+%define separate_biarch 1
+%define separate_biarch_suffix -64bit
+%endif
+
+%ifarch aarch64 x86_64 ia64 s390x alpha ppc64 ppc64le sparc64
+# 64-bit is primary build target
+%define build_primary_64bit 1
+%else
+%define build_primary_64bit 0
+%endif
+
+# SRC-COMMON-BEGIN
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
+
+URL: https://gcc.gnu.org/
+Version: 7.5.0+r278197
+Release: 1
+%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
+%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
+%define binsuffix -@base_ver@
+# SRC-COMMON-END
+
+%if !0%{?building_testsuite:1}
+Requires: binutils glibc-devel
+Requires: cpp@base_ver@ = %{version}-%{release}
+Requires: libgcc_s%{libgcc_s} >= %{version}-%{release}
+Requires: libgomp%{libgomp_sover} >= %{version}-%{release}
+%ifarch %asan_arch
+Requires: libasan%{libasan_sover} >= %{version}-%{release}
+%endif
+%ifarch %tsan_arch
+%if %{build_primary_64bit}
+Requires: libtsan%{libtsan_sover} >= %{version}-%{release}
+%endif
+%endif
+%ifarch %atomic_arch
+Requires: libatomic%{libatomic_sover} >= %{version}-%{release}
+%endif
+%ifarch %itm_arch
+Requires: libitm%{libitm_sover} >= %{version}-%{release}
+%endif
+%ifarch %cilkrts_arch
+Requires: libcilkrts%{libcilkrts_sover} >= %{version}-%{release}
+%endif
+%ifarch %lsan_arch
+%if %{build_primary_64bit}
+Requires: liblsan%{liblsan_sover} >= %{version}-%{release}
+%endif
+%endif
+%ifarch %ubsan_arch
+Requires: libubsan%{libubsan_sover} >= %{version}-%{release}
+%endif
+%ifarch %vtv_arch
+Requires: libvtv%{libvtv_sover} >= %{version}-%{release}
+%endif
+%ifarch %mpx_arch
+Requires: libmpx%{libmpx_sover} >= %{version}-%{release}
+Requires: libmpxwrappers%{libmpxwrappers_sover} >= %{version}-%{release}
+%endif
+Suggests: gcc@base_ver@-info gcc@base_ver@-locale
+%endif
+
+# SRC-COMMON-BEGIN
+Group: Development/Languages/C and C++
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source: gcc-%{version}.tar.xz
+Source1: change_spec
+Source3: gcc7-rpmlintrc
+Source4: README.First-for.SuSE.packagers
+Source5: nvptx-newlib.tar.xz
+Patch2: gcc-add-defaultsspec.diff
+Patch5: tls-no-direct.diff
+Patch6: gcc43-no-unwind-tables.diff
+Patch7: gcc48-libstdc++-api-reference.patch
+Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
+Patch10: gcc5-no-return-gcc43-workaround.patch
+Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
+Patch12: gcc7-stack-probe.diff
+Patch14: gcc7-pr82248.diff
+Patch15: gcc7-avoid-fixinc-error.diff
+Patch17: gcc7-flive-patching.patch
+Patch18: gcc7-bsc1146475.patch
+Patch19: gcc7-pr85887.patch
+Patch20: gcc7-bsc1160086.patch
+Patch21: gcc7-pr92154.patch
+Patch22: gcc7-pr93246.patch
+Patch23: gcc7-pr92692.patch
+Patch24: gcc48-bsc1161913.patch
+Patch25: gcc7-pr93965.patch
+Patch26: gcc7-pr93888.patch
+Patch27: gcc7-pr94148.patch
+Patch29: gcc7-pr97535.patch
+Patch30: gcc7-pr88522.patch
+Patch31: gcc7-testsuite-fixes.patch
+Patch32: gcc7-pr81942.patch
+Patch33: gcc7-sanitizer-cyclades.patch
+Patch34: gcc7-ada-MINSTKSZ.patch
+Patch35: gcc7-pr55917.patch
+Patch36: gcc7-ada-Target_Name.patch
+Patch37: gcc7-pr78263.patch
+Patch38: gcc7-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch
+Patch39: gcc7-libgo-don-t-include-linux-fs.h-when-building-gen-sys.patch
+Patch40: gcc7-pr72764.patch
+Patch41: gcc7-pr89124.patch
+Patch42: libgcc-riscv-div.patch
+Patch43: gcc7-aarch64-bsc1214052.patch
+Patch44: gcc7-aarch64-untyped_call.patch
+Patch45: gcc7-lra-elim.patch
+Patch46: gcc7-bsc1216488.patch
+Patch47: gcc7-pr87723.patch
+# A set of patches from the RH srpm
+Patch51: gcc41-ppc32-retaddr.patch
+# Some patches taken from Debian
+Patch60: gcc44-textdomain.patch
+Patch61: gcc44-rename-info-files.patch
+# Feature backports
+Patch100: gcc7-aarch64-moutline-atomics.patch
+Patch101: gcc7-fix-retrieval-of-testnames.patch
+Patch102: gcc7-aarch64-sls-miti-1.patch
+Patch103: gcc7-aarch64-sls-miti-2.patch
+Patch104: gcc7-aarch64-sls-miti-3.patch
+Patch105: gcc7-pfe-0001-Backport-Add-entry-for-patchable_function_entry.patch
+Patch106: gcc7-pfe-0002-Backport-Skip-fpatchable-function-entry-tests-for-nv.patch
+Patch107: gcc7-pfe-0003-Backport-Error-out-on-nvptx-for-fpatchable-function-.patch
+Patch108: gcc7-pfe-0004-Backport-Adapt-scan-assembler-times-for-alpha.patch
+Patch109: gcc7-pfe-0005-Backport-patchable_function_entry-decl.c-Use-3-NOPs-.patch
+Patch110: gcc7-pfe-0006-Backport-IBM-Z-Use-the-dedicated-NOP-instructions-fo.patch
+Patch111: gcc7-pfe-0007-Backport-Add-regex-to-search-for-uppercase-NOP-instr.patch
+Patch112: gcc7-pfe-0008-Backport-ICE-segmentation-fault-with-patchable_funct.patch
+Patch113: gcc7-pfe-0009-Backport-patchable_function_entry-decl.c-Pass-mcpu-g.patch
+Patch114: gcc7-pfe-0010-Backport-patchable_function_entry-decl.c-Do-not-run-.patch
+Patch115: gcc7-pfe-0011-Backport-patchable_function_entry-decl.c-Add-fno-pie.patch
+Patch116: gcc7-pfe-0012-Backport-PR-c-89946-ICE-in-assemble_start_function-a.patch
+Patch117: gcc7-pfe-0013-Backport-targhooks.c-default_print_patchable_functio.patch
+Patch118: gcc7-pfe-0014-Backport-Align-__patchable_function_entries-to-POINT.patch
+Patch119: gcc7-pfe-0015-Backport-Fix-PR-93242-patchable-function-entry-broke.patch
+Patch120: gcc7-pfe-0016-Backport-Fix-patchable-function-entry-on-arc.patch
+Patch121: gcc7-pfe-0017-Backport-Add-patch_area_size-and-patch_area_entry-to.patch
+Patch122: gcc7-pfe-0018-Backport-testsuite-Adjust-patchable_function-tests-f.patch
+Patch123: gcc7-pfe-0019-Backport-Use-the-section-flag-o-for-__patchable_func.patch
+Patch124: gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch
+Patch125: gcc7-pfe-0021-Backport-rs6000-Avoid-fpatchable-function-entry-regr.patch
+Patch126: gcc7-pfe-0022-Fix-unwinding-issues-when-pfe-is-enabled.patch
+Patch127: gcc7-pr88345-min-func-alignment.diff
+
+# GCC-TESTSUITE-DELETE-BEGIN
+# SRC-COMMON-END
+License: GPL-3.0-or-later
+Summary: The GNU C Compiler and Support Files
+
+%description
+Core package for the GNU Compiler Collection, including the C language
+frontend.
+
+Language frontends other than C are split to different sub-packages,
+namely gcc-ada, gcc-c++, gcc-fortran, gcc-obj, gcc-obj-c++ and gcc-go.
+
+
+
+%package -n gcc@base_ver@-32bit
+Summary: The GNU C Compiler 32bit support
+Group: Development/Languages/C and C++
+Requires: gcc@base_ver@ = %{version}-%{release}
+Requires: libgcc_s%{libgcc_s}-32bit >= %{version}-%{release}
+Requires: libgomp%{libgomp_sover}-32bit >= %{version}-%{release}
+%ifarch %asan_arch
+Requires: libasan%{libasan_sover}-32bit >= %{version}-%{release}
+%endif
+%ifarch %atomic_arch
+Requires: libatomic%{libatomic_sover}-32bit >= %{version}-%{release}
+%endif
+%ifarch %itm_arch
+Requires: libitm%{libitm_sover}-32bit >= %{version}-%{release}
+%endif
+%ifarch %cilkrts_arch
+Requires: libcilkrts%{libcilkrts_sover}-32bit >= %{version}-%{release}
+%endif
+%ifarch %ubsan_arch
+Requires: libubsan%{libubsan_sover}-32bit >= %{version}-%{release}
+%endif
+%ifarch %vtv_arch
+Requires: libvtv%{libvtv_sover}-32bit >= %{version}-%{release}
+%endif
+%ifarch %mpx_arch
+Requires: libmpx%{libmpx_sover}-32bit >= %{version}-%{release}
+Requires: libmpxwrappers%{libmpxwrappers_sover}-32bit >= %{version}-%{release}
+%endif
+Requires: glibc-devel-32bit
+
+%description -n gcc@base_ver@-32bit
+This package contains 32bit support for the GNU Compiler Collection.
+
+%package -n gcc@base_ver@-64bit
+Summary: The GNU C Compiler 64bit support
+Group: Development/Languages/C and C++
+Requires: gcc@base_ver@ = %{version}-%{release}
+Requires: libgcc_s%{libgcc_s}-64bit >= %{version}-%{release}
+Requires: libgomp%{libgomp_sover}-64bit >= %{version}-%{release}
+%ifarch %asan_arch
+Requires: libasan%{libasan_sover}-64bit >= %{version}-%{release}
+%endif
+%ifarch %tsan_arch
+Requires: libtsan%{libtsan_sover}-64bit >= %{version}-%{release}
+%endif
+%ifarch %atomic_arch
+Requires: libatomic%{libatomic_sover}-64bit >= %{version}-%{release}
+%endif
+%ifarch %itm_arch
+Requires: libitm%{libitm_sover}-64bit >= %{version}-%{release}
+%endif
+%ifarch %cilkrts_arch
+Requires: libcilkrts%{libcilkrts_sover}-64bit >= %{version}-%{release}
+%endif
+%ifarch %lsan_arch
+Requires: liblsan%{liblsan_sover}-64bit >= %{version}-%{release}
+%endif
+%ifarch %ubsan_arch
+Requires: libubsan%{libubsan_sover}-64bit >= %{version}-%{release}
+%endif
+%ifarch %vtv_arch
+Requires: libvtv%{libvtv_sover}-64bit >= %{version}-%{release}
+%endif
+%ifarch %mpx_arch
+Requires: libmpx%{libmpx_sover}-64bit >= %{version}-%{release}
+Requires: libmpxwrappers%{libmpxwrappers_sover}-64bit >= %{version}-%{release}
+%endif
+Requires: glibc-devel-64bit
+
+%description -n gcc@base_ver@-64bit
+This package contains 64bit support for the GNU Compiler Collection.
+
+
+%package devel
+Summary: GCC plugins development enviroment
+License: GPL-3.0-or-later
+Group: Development/Languages/C and C++
+Requires: gcc@base_ver@ = %{version}-%{release}
+Requires: gmp-devel
+Requires: mpc-devel
+
+%description devel
+Files required for developing and compiling GCC plugins.
+
+
+%package locale
+Summary: Locale Data for the GNU Compiler Collection
+License: GPL-3.0-or-later
+Group: Development/Languages/C and C++
+Requires: gcc@base_ver@ = %{version}-%{release}
+
+%description locale
+Locale data for the GNU Compiler Collection (GCC) to give error message
+in the current locale.
+
+
+# PACKAGE-BEGIN
+%package c++@variant@
+Summary: The GNU C++ Compiler
+License: GPL-3.0-or-later
+Group: Development/Languages/C and C++
+Requires: gcc@base_ver@@variant@ = %{version}-%{release}
+Requires: gcc@base_ver@-c++ = %{version}-%{release}
+Requires: libstdc++%{libstdcxx_sover}-devel%{libdevel_suffix}@variant@ = %{version}-%{release}
+
+%description c++@variant@
+This package contains the GNU compiler for C++.
+# PACKAGE-END
+
+
+# PACKAGE-BEGIN
+%package -n libstdc++%{libstdcxx_sover}-devel%{libdevel_suffix}@variant@
+Summary: Include Files and Libraries mandatory for Development
+License: GPL-3.0-or-later WITH GCC-exception-3.1
+Group: Development/Languages/C and C++
+Requires: libstdc++%{libstdcxx_sover}@variant@ >= %{version}-%{release}
+Requires: glibc-devel@variant@
+%ifarch ia64
+Requires: libunwind-devel
+%endif
+
+%description -n libstdc++%{libstdcxx_sover}-devel%{libdevel_suffix}@variant@
+This package contains all the headers and libraries of the standard C++
+library. It is needed for compiling C++ code.
+# PACKAGE-END
+
+
+# PACKAGE-BEGIN
+%package -n libgcc_s%{libgcc_s}%{libgcc_s_suffix}@variant@
+Summary: C compiler runtime library
+License: GPL-3.0-or-later WITH GCC-exception-3.1
+Group: System/Base
+Provides: libgcc_s%{libgcc_s}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libgcc_s%{libgcc_s}@variant@
+
+%description -n libgcc_s%{libgcc_s}%{libgcc_s_suffix}@variant@
+Libgcc is needed for dynamically linked C programs.
+
+%post -n libgcc_s%{libgcc_s}%{libgcc_s_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libgcc_s%{libgcc_s}%{libgcc_s_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libgomp%{libgomp_sover}%{libgomp_suffix}@variant@
+Summary: The GNU compiler collection OpenMP runtime library
+License: GPL-3.0-or-later WITH GCC-exception-3.1
+Group: System/Base
+Provides: libgomp%{libgomp_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libgomp%{libgomp_sover}@variant@
+
+%description -n libgomp%{libgomp_sover}%{libgomp_suffix}@variant@
+This is the OpenMP runtime library needed by OpenMP enabled programs
+that were built with the -fopenmp compiler option and by programs that
+were auto-parallelized via the -ftree-parallelize-loops compiler
+option.
+
+
+%post -n libgomp%{libgomp_sover}%{libgomp_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libgomp%{libgomp_sover}%{libgomp_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libstdc++%{libstdcxx_sover}%{libstdcxx_suffix}@variant@
+Summary: The standard C++ shared library
+License: GPL-3.0-or-later WITH GCC-exception-3.1
+Group: System/Libraries
+Suggests: libstdc++%{libstdcxx_sover}-locale
+Provides: libstdc++%{libstdcxx_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libstdc++%{libstdcxx_sover}@variant@
+
+%description -n libstdc++%{libstdcxx_sover}%{libstdcxx_suffix}@variant@
+The standard C++ library, needed for dynamically linked C++ programs.
+
+
+%post -n libstdc++%{libstdcxx_sover}%{libstdcxx_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libstdc++%{libstdcxx_sover}%{libstdcxx_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+%package -n libstdc++%{libstdcxx_sover}%{libstdcxx_suffix}-locale
+Summary: Standard C++ Library Locales
+License: GPL-3.0-or-later WITH GCC-exception-3.1
+Group: System/Libraries
+Provides: libstdc++%{libstdcxx_sover}-locale = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libstdc++%{libstdcxx_sover}-locale
+
+%description -n libstdc++%{libstdcxx_sover}%{libstdcxx_suffix}-locale
+The standard C++ library locale data.
+
+
+%package info
+Summary: Documentation for the GNU compiler collection
+License: GFDL-1.2
+Group: Documentation/Other
+PreReq: %{install_info_prereq}
+%if 0%{?suse_version} >= 1120
+BuildArch: noarch
+%endif
+
+%description info
+GNU info-pages for the GNU compiler collection covering both user-level
+and internals documentation.
+
+
+# PACKAGE-BEGIN
+%package objc@variant@
+Summary: GNU Objective C Compiler
+License: GPL-3.0-or-later
+Group: Development/Languages/Other
+Requires: gcc@base_ver@@variant@ = %{version}-%{release}
+Requires: gcc@base_ver@-objc = %{version}-%{release}
+Requires: libobjc%{libobjc_sover}@variant@ >= %{version}-%{release}
+
+%description objc@variant@
+This package contains the GNU Objective C compiler. Objective C is an
+object oriented language, created by Next Inc. and used in their
+Nextstep OS. The source code is available in the gcc package.
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libobjc%{libobjc_sover}%{libobjc_suffix}@variant@
+Summary: Library for the GNU Objective C Compiler
+License: GPL-3.0-or-later WITH GCC-exception-3.1
+Group: Development/Libraries/Other
+Provides: libobjc%{libobjc_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libobjc%{libobjc_sover}@variant@
+
+%description -n libobjc%{libobjc_sover}%{libobjc_suffix}@variant@
+The library for the GNU Objective C compiler.
+
+%post -n libobjc%{libobjc_sover}%{libobjc_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libobjc%{libobjc_sover}%{libobjc_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package obj-c++@variant@
+Summary: GNU Objective C++ Compiler
+License: GPL-3.0-or-later
+Group: Development/Languages/Other
+Requires: gcc@base_ver@-objc@variant@ = %{version}-%{release}
+Requires: gcc@base_ver@-c++@variant@ = %{version}-%{release}
+Requires: gcc@base_ver@-obj-c++ = %{version}-%{release}
+
+%description obj-c++@variant@
+This package contains the GNU Objective C++ compiler. Objective C++ is an
+object oriented language, created by Next Inc. and used in their
+Nextstep OS. The source code is available in the gcc package.
+# PACKAGE-END
+
+
+%package -n cpp@base_ver@
+Summary: The GCC Preprocessor
+License: GPL-3.0-or-later
+Group: Development/Languages/C and C++
+
+%description -n cpp@base_ver@
+This Package contains just the preprocessor that is used by the X11
+packages.
+
+
+# PACKAGE-BEGIN
+%package ada@variant@
+Summary: GNU Ada Compiler Based on GCC (GNAT)
+License: GPL-3.0-or-later
+Group: Development/Languages/Other
+Requires: gcc@base_ver@@variant@ = %{version}-%{release}
+Requires: gcc@base_ver@-ada = %{version}-%{release}
+Requires: libada@base_ver@@variant@ = %{version}-%{release}
+
+%description ada@variant@
+This package contains an Ada compiler and associated development
+tools based on the GNU GCC technology.
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libada@base_ver@@variant@
+Summary: GNU Ada Runtime Libraries
+License: GPL-3.0-or-later WITH GCC-exception-3.1
+Group: System/Libraries
+Provides: libgnarl-@base_ver@@variant@ = %{version}-%{release}
+Conflicts: %selfconflict libgnarl-@base_ver@@variant@
+Provides: libgnat-@base_ver@@variant@ = %{version}-%{release}
+Conflicts: %selfconflict libgnat-@base_ver@@variant@
+
+%description -n libada@base_ver@@variant@
+This package contains the shared libraries required to run programs
+compiled with the GNU Ada compiler (GNAT) if they are compiled to use
+shared libraries. It also contains the shared libraries for the
+Implementation of the Ada Semantic Interface Specification (ASIS), the
+implementation of Distributed Systems Programming (GLADE) and the Posix
+1003.5 Binding (Florist).
+
+%post -n libada@base_ver@@variant@ -p /sbin/ldconfig
+
+%postun -n libada@base_ver@@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package fortran@variant@
+Summary: The GNU Fortran Compiler and Support Files
+License: GPL-3.0-or-later
+Group: Development/Languages/Fortran
+Requires: gcc@base_ver@@variant@ = %{version}-%{release}
+Requires: gcc@base_ver@-fortran = %{version}-%{release}
+Requires: libgfortran%{libgfortran_sover}@variant@ >= %{version}-%{release}
+%ifarch %quadmath_arch
+Requires: libquadmath%{libquadmath_sover}@variant@ >= %{version}-%{release}
+%endif
+
+%description fortran@variant@
+This is the Fortran compiler of the GNU Compiler Collection (GCC).
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libgfortran%{libgfortran_sover}%{libgfortran_suffix}@variant@
+Summary: The GNU Fortran Compiler Runtime Library
+License: GPL-3.0-or-later WITH GCC-exception-3.1
+Group: Development/Languages/Fortran
+%ifarch %quadmath_arch
+Requires: libquadmath%{libquadmath_sover}@variant@ >= %{version}-%{release}
+%endif
+Provides: libgfortran%{libgfortran_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libgfortran%{libgfortran_sover}@variant@
+
+%description -n libgfortran%{libgfortran_sover}%{libgfortran_suffix}@variant@
+The runtime library needed to run programs compiled with the Fortran compiler
+of the GNU Compiler Collection (GCC).
+
+%post -n libgfortran%{libgfortran_sover}%{libgfortran_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libgfortran%{libgfortran_sover}%{libgfortran_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libquadmath%{libquadmath_sover}%{libquadmath_suffix}@variant@
+Summary: The GNU Fortran Compiler Quadmath Runtime Library
+License: LGPL-2.1
+Group: Development/Languages/Fortran
+Provides: libquadmath%{libquadmath_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libquadmath%{libquadmath_sover}@variant@
+
+%description -n libquadmath%{libquadmath_sover}%{libquadmath_suffix}@variant@
+The runtime library needed to run programs compiled with the Fortran compiler
+of the GNU Compiler Collection (GCC) and quadruple precision floating point
+operations.
+
+%post -n libquadmath%{libquadmath_sover}%{libquadmath_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libquadmath%{libquadmath_sover}%{libquadmath_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libitm%{libitm_sover}%{libitm_suffix}@variant@
+Summary: The GNU Compiler Transactional Memory Runtime Library
+License: MIT
+Group: Development/Languages/C and C++
+Provides: libitm%{libitm_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libitm%{libitm_sover}@variant@
+
+%description -n libitm%{libitm_sover}%{libitm_suffix}@variant@
+The runtime library needed to run programs compiled with the
+-fgnu-tm option of the GNU Compiler Collection (GCC).
+
+%post -n libitm%{libitm_sover}%{libitm_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libitm%{libitm_sover}%{libitm_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libasan%{libasan_sover}%{libasan_suffix}@variant@
+Summary: The GNU Compiler Address Sanitizer Runtime Library
+License: MIT
+Group: Development/Languages/C and C++
+Provides: libasan%{libasan_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libasan%{libasan_sover}@variant@
+
+%description -n libasan%{libasan_sover}%{libasan_suffix}@variant@
+The runtime library needed to run programs compiled with the
+-fsanitize=address option of the GNU Compiler Collection (GCC).
+
+%post -n libasan%{libasan_sover}%{libasan_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libasan%{libasan_sover}%{libasan_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libtsan%{libtsan_sover}%{libtsan_suffix}@variant@
+Summary: The GNU Compiler Thread Sanitizer Runtime Library
+License: MIT
+Group: Development/Languages/C and C++
+Provides: libtsan%{libtsan_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libtsan%{libtsan_sover}@variant@
+
+%description -n libtsan%{libtsan_sover}%{libtsan_suffix}@variant@
+The runtime library needed to run programs compiled with the
+-fsanitize=thread option of the GNU Compiler Collection (GCC).
+
+%post -n libtsan%{libtsan_sover}%{libtsan_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libtsan%{libtsan_sover}%{libtsan_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libatomic%{libatomic_sover}%{libatomic_suffix}@variant@
+Summary: The GNU Compiler Atomic Operations Runtime Library
+License: GPL-3.0-or-later WITH GCC-exception-3.1
+Group: Development/Languages/C and C++
+Provides: libatomic%{libatomic_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libatomic%{libatomic_sover}@variant@
+
+%description -n libatomic%{libatomic_sover}%{libatomic_suffix}@variant@
+The runtime library for atomic operations of the GNU Compiler Collection (GCC).
+
+%post -n libatomic%{libatomic_sover}%{libatomic_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libatomic%{libatomic_sover}%{libatomic_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libcilkrts%{libcilkrts_sover}%{libcilkrts_suffix}@variant@
+Summary: The GNU Compiler Cilk+ Runtime Library
+License: MIT
+Group: Development/Languages/C and C++
+Provides: libcilkrts%{libcilkrts_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libcilkrts%{libcilkrts_sover}@variant@
+
+%description -n libcilkrts%{libcilkrts_sover}%{libcilkrts_suffix}@variant@
+The runtime library needed to run programs compiled with the
+-fcilkplus option of the GNU Compiler Collection (GCC).
+
+%post -n libcilkrts%{libcilkrts_sover}%{libcilkrts_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libcilkrts%{libcilkrts_sover}%{libcilkrts_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n liblsan%{liblsan_sover}%{liblsan_suffix}@variant@
+Summary: The GNU Compiler Leak Sanitizer Runtime Library
+License: MIT
+Group: Development/Languages/C and C++
+Provides: liblsan%{liblsan_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict liblsan%{liblsan_sover}@variant@
+
+%description -n liblsan%{liblsan_sover}%{liblsan_suffix}@variant@
+The runtime library needed to run programs compiled with the
+-fsanitize=leak option of the GNU Compiler Collection (GCC).
+
+%post -n liblsan%{liblsan_sover}%{liblsan_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n liblsan%{liblsan_sover}%{liblsan_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libubsan%{libubsan_sover}%{libubsan_suffix}@variant@
+Summary: The GNU Compiler Undefined Sanitizer Runtime Library
+License: MIT
+Group: Development/Languages/C and C++
+Provides: libubsan%{libubsan_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libubsan%{libubsan_sover}@variant@
+
+%description -n libubsan%{libubsan_sover}%{libubsan_suffix}@variant@
+The runtime library needed to run programs compiled with the
+-fsanitize=undefined option of the GNU Compiler Collection (GCC).
+
+%post -n libubsan%{libubsan_sover}%{libubsan_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libubsan%{libubsan_sover}%{libubsan_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libvtv%{libvtv_sover}%{libvtv_suffix}@variant@
+Summary: The GNU Compiler Vtable Verifier Runtime Library
+License: MIT
+Group: Development/Languages/C and C++
+Provides: libvtv%{libvtv_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libvtv%{libvtv_sover}@variant@
+
+%description -n libvtv%{libvtv_sover}%{libvtv_suffix}@variant@
+The runtime library needed to run programs compiled with the
+-fvtable-verify option of the GNU Compiler Collection (GCC).
+
+%post -n libvtv%{libvtv_sover}%{libvtv_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libvtv%{libvtv_sover}%{libvtv_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libmpx%{libmpx_sover}%{libmpx_suffix}@variant@
+Summary: The GNU Compiler MPX Runtime Library
+License: BSD-3-Clause
+Group: Development/Languages/C and C++
+Provides: libmpx%{libmpx_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libmpx%{libmpx_sover}@variant@
+
+%description -n libmpx%{libmpx_sover}%{libmpx_suffix}@variant@
+The runtime library needed to run programs compiled with the
+-fcheck-pointer-bounds option of the GNU Compiler Collection (GCC).
+
+%post -n libmpx%{libmpx_sover}%{libmpx_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libmpx%{libmpx_sover}%{libmpx_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libmpxwrappers%{libmpxwrappers_sover}%{libmpxwrappers_suffix}@variant@
+Summary: The GNU Compiler MPX Runtime Library
+License: BSD-3-Clause
+Group: Development/Languages/C and C++
+Provides: libmpxwrappers%{libmpxwrappers_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libmpxwrappers%{libmpxwrappers_sover}@variant@
+
+%description -n libmpxwrappers%{libmpxwrappers_sover}%{libmpxwrappers_suffix}@variant@
+The runtime library needed to run programs compiled with the
+-fcheck-pointer-bounds option of the GNU Compiler Collection (GCC).
+
+%post -n libmpxwrappers%{libmpxwrappers_sover}%{libmpxwrappers_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libmpxwrappers%{libmpxwrappers_sover}%{libmpxwrappers_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+
+%package -n libstdc++%{libstdcxx_sover}%{libdevel_suffix}-doc
+Summary: Documentation for the GNU C++ standard library
+License: GPL-3.0-or-later
+Group: Documentation/HTML
+%if 0%{?suse_version} >= 1120
+BuildArch: noarch
+%endif
+
+%description -n libstdc++%{libstdcxx_sover}%{libdevel_suffix}-doc
+Extensive HTML documentation for the GNU C++ standard library.
+
+# PACKAGE-BEGIN
+%package go@variant@
+Summary: GNU Go Compiler
+License: GPL-3.0-or-later
+Group: Development/Languages/Other
+Requires: gcc@base_ver@@variant@ = %{version}-%{release}
+Requires: gcc@base_ver@-go = %{version}-%{release}
+Requires: libgo%{libgo_sover}@variant@ >= %{version}-%{release}
+
+%description go@variant@
+This package contains a Go compiler and associated development
+files based on the GNU GCC technology.
+# PACKAGE-END
+
+# PACKAGE-BEGIN
+%package -n libgo%{libgo_sover}%{libgo_suffix}@variant@
+Summary: GNU Go compiler runtime library
+License: BSD-3-Clause
+Group: Development/Languages/Other
+Provides: libgo%{libgo_sover}@variant@ = %{version}-%{release}
+# Only one package may provide this - allows multiple gcc versions
+# to co-exist without an overly large list of provides/obsoletes
+Conflicts: %selfconflict libgo%{libgo_sover}@variant@
+
+%description -n libgo%{libgo_sover}%{libgo_suffix}@variant@
+Runtime library for the GNU Go language.
+
+%post -n libgo%{libgo_sover}%{libgo_suffix}@variant@ -p /sbin/ldconfig
+
+%postun -n libgo%{libgo_sover}%{libgo_suffix}@variant@ -p /sbin/ldconfig
+# PACKAGE-END
+
+
+%package -n gcc@base_ver@-testresults
+# GCC-TESTSUITE-DELETE-END
+Summary: Testsuite results
+License: SUSE-Public-Domain
+Group: Development/Languages/C and C++
+
+%description -n gcc@base_ver@-testresults
+Results from running the gcc and target library testsuites.
+
+
+
+# SRC-COMMON-BEGIN
+
+# Define the canonical target and host architecture
+# %%gcc_target_arch is supposed to be the full target triple
+# %%cross_arch is supposed to be the rpm target variant arch
+# %%TARGET_ARCH will be the canonicalized target CPU part
+# %%HOST_ARCH will be the canonicalized host CPU part
+%if 0%{?gcc_target_arch:1}
+%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%else
+%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%endif
+%if 0%{?disable_32bit:1}
+%define biarch 0
+%else
+%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%endif
+
+%define HOST_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%ifarch ppc
+%define GCCDIST powerpc64-suse-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-suse-linux
+%else
+%ifarch %arm
+%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
+%else
+%define GCCDIST %{HOST_ARCH}-suse-linux
+%endif
+%endif
+%endif
+
+%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
+%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
+
+# SRC-COMMON-END
+
+# Versionspecific directories
+%define versmainlibdir %{libsubdir}
+%define versmainlibdirbi32 %{libsubdir}/32
+%define versmainlibdirbi64 %{libsubdir}/64
+%ifarch ppc
+%define versmainlibdirbi32 %{libsubdir}
+%define versmainlibdirbi64 %{libsubdir}/64
+%endif
+%if %{build_primary_64bit}
+%define versmainlibdirbi %{versmainlibdirbi32}
+%else
+%define versmainlibdirbi %{versmainlibdirbi64}
+%endif
+
+%define mainlibdir %{_libdir}
+%define mainlibdirbi32 %{_prefix}/lib
+%define mainlibdirbi64 %{_prefix}/lib64
+%if %{build_primary_64bit}
+%define mainlibdirbi %{mainlibdirbi32}
+%else
+%define mainlibdirbi %{mainlibdirbi64}
+%endif
+
+
+# Now define a few macros that make it easy to package libs and
+# related files just to the right package, without caring for the
+# exact path the files are in.
+# %%mainlib package X from all dirs that belong to the main package
+# %%biarchlib package X from all dirs that belong to the -32/64bit package
+%define mainlib() %{mainlibdir}/%1\
+%{nil}
+%define biarchlib() %{nil}
+%if %{biarch}
+%if !%{separate_biarch}
+%define mainlib() %{mainlibdir}/%1\
+%{mainlibdirbi}/%1\
+%{nil}
+%else
+%define biarchlib() %{mainlibdirbi}/%1\
+%{nil}
+%endif
+%endif
+
+%define versmainlib() %{versmainlibdir}/%1\
+%{nil}
+%define versbiarchlib() %{nil}
+%if %{biarch}
+%if !%{separate_biarch}
+%define versmainlib() %{versmainlibdir}/%1\
+%{versmainlibdirbi}/%1\
+%{nil}
+%else
+%define versbiarchlib() %{versmainlibdirbi}/%1\
+%{nil}
+%endif
+%endif
+
+
+# BUILD-COMMON-BEGIN
+
+%prep
+%if 0%{?nvptx_newlib:1}
+%setup -q -n gcc-%{version} -a 5
+ln -s nvptx-newlib/newlib .
+%else
+%setup -q -n gcc-%{version}
+%endif
+
+#test patching start
+
+%patch -P 2
+%patch -P 5
+%patch -P 6
+%patch -P 7
+%if %{suse_version} < 1310
+%patch -P 9
+%endif
+%patch -P 10
+%patch -P 11
+%patch -P 12
+%patch -P 14
+%patch -P 15
+%patch -P 17 -p1
+%patch -P 18
+%patch -P 19
+%patch -P 20
+%patch -P 21 -p1
+%patch -P 22 -p1
+%patch -P 24 -p1
+%patch -P 25 -p1
+%patch -P 26 -p1
+%patch -P 27 -p1
+%patch -P 29
+%patch -P 30 -p1
+%patch -P 31 -p1
+%patch -P 32 -p1
+%patch -P 33 -p1
+%patch -P 34 -p1
+%patch -P 35 -p1
+%patch -P 36 -p1
+%patch -P 37 -p1
+%patch -P 38 -p1
+%patch -P 39 -p1
+%patch -P 40 -p1
+%patch -P 41 -p1
+%patch -P 42 -p1
+%patch -P 43 -p1
+%patch -P 44 -p1
+%patch -P 45 -p1
+%patch -P 46 -p1
+%patch -P 47 -p1
+%patch -P 51
+%patch -P 60
+%patch -P 61
+%patch -P 100 -p1
+%patch -P 23 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
+%patch -P 111 -p1
+%patch -P 112 -p1
+%patch -P 113 -p1
+%patch -P 114 -p1
+%patch -P 115 -p1
+%patch -P 116 -p1
+%patch -P 117 -p1
+%patch -P 118 -p1
+%patch -P 119 -p1
+%patch -P 120 -p1
+%patch -P 121 -p1
+%patch -P 122 -p1
+%patch -P 123 -p1
+%patch -P 124 -p1
+%patch -P 125 -p1
+%patch -P 126 -p1
+%patch -P 127 -p1
+
+#test patching end
+
+%build
+%define _lto_cflags %{nil}
+# Avoid rebuilding of generated files
+contrib/gcc_update --touch
+
+# SLE11 does not allow empty rpms
+%if %{suse_version} < 1310
+echo "This is a dummy package to provide a dependency." > README
+%endif
+
+rm -rf obj-%{GCCDIST}
+mkdir obj-%{GCCDIST}
+cd obj-%{GCCDIST}
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
+%ifarch %ix86
+# -mcpu is superceded by -mtune but -mtune is not supported by
+# our bootstrap compiler. -mcpu gives a warning that stops
+# the build process, so remove it for now. Also remove all other
+# -march and -mtune flags. They are superseeded by proper
+# default compiler settings now.
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
+%endif
+%ifarch s390 s390x
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
+%endif
+%ifarch aarch64
+%if %{build_ada}
+# -mbranch-protection=standard flag is unsupported in gcc7 and we use GCC7 to build GCC7
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mbranch-protection=standard//g'`
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+# Kill all -march/tune/cpu because that screws building the target libs
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
+%endif
+# Replace 2 spaces by one finally
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
+
+languages=c
+%if %{build_cp}
+languages=$languages,c++
+%endif
+%if %{build_objc}
+languages=$languages,objc
+%endif
+%if %{build_fortran}
+languages=$languages,fortran
+%endif
+%if %{build_objcp}
+languages=$languages,obj-c++
+%endif
+%if %{build_ada}
+languages=$languages,ada
+%endif
+%if %{build_go}
+languages=$languages,go
+%endif
+
+# In general we want to ship release checking enabled compilers
+# which is the default for released compilers
+#ENABLE_CHECKING="--enable-checking=yes"
+ENABLE_CHECKING="--enable-checking=release"
+#ENABLE_CHECKING=""
+
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+
+%if %{build_ada}
+# Using the host gnatmake like
+# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
+# GNATMAKE="gnatmake%%{hostsuffix}"
+# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
+# available
+mkdir -p host-tools/bin
+cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
+cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
+cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
+cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
+cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
+ln -sf /usr/%{_lib} host-tools/%{_lib}
+export PATH="`pwd`/host-tools/bin:$PATH"
+%endif
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" \
+../configure \
+ --prefix=%{_prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libdir} \
+ --enable-languages=$languages \
+%if %{build_hsa} || %{build_nvptx}
+ --enable-offload-targets=\
+%if %{build_hsa}
+hsa,\
+%endif
+%if %{build_nvptx}
+nvptx-none, \
+%endif
+%endif
+%if %{build_nvptx}
+ --without-cuda-driver \
+%endif
+ $ENABLE_CHECKING \
+ --disable-werror \
+ --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
+ --enable-ssp \
+ --disable-libssp \
+%if 0%{!?build_libvtv:1}
+ --disable-libvtv \
+%endif
+%ifnarch %mpx_arch
+ --disable-libmpx \
+%endif
+ --disable-libcc1 \
+%if %{enable_plugins}
+ --enable-plugin \
+%else
+ --disable-plugin \
+%endif
+ --with-bugurl="https://bugs.opensuse.org/" \
+ --with-pkgversion="SUSE Linux" \
+ --with-slibdir=/%{_lib} \
+ --with-system-zlib \
+ --enable-libstdcxx-allocator=new \
+ --disable-libstdcxx-pch \
+%if 0%{suse_version} <= 1320
+ --with-default-libstdcxx-abi=gcc4-compatible \
+%endif
+ --enable-version-specific-runtime-libs \
+ --with-gcc-major-version-only \
+ --enable-linker-build-id \
+ --enable-linux-futex \
+%if %{suse_version} >= 1315
+%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
+ --enable-gnu-indirect-function \
+%endif
+%endif
+ --program-suffix=%{binsuffix} \
+%if 0%{?disable_32bit:1}
+ --disable-multilib \
+%endif
+%if 0%{!?gcc_target_arch:1}
+%ifarch ia64
+ --with-system-libunwind \
+%else
+ --without-system-libunwind \
+%endif
+%endif
+%if 0%{?gcc_target_arch:1}
+ --program-prefix=%{gcc_target_arch}- \
+ --target=%{gcc_target_arch} \
+ --disable-nls \
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
+%if 0%{?build_sysroot:1}
+ --with-build-sysroot=%{build_sysroot} \
+%else
+%if 0%{?sysroot:1}
+ --with-build-sysroot=%{sysroot} \
+%endif
+%endif
+%if 0%{?binutils_os:1}
+ --with-build-time-tools=/usr/%{binutils_os}/bin \
+%endif
+%if 0%{?gcc_target_newlib}
+ --with-newlib \
+%if 0%{?gcc_libc_bootstrap:1}
+ --without-headers \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "spu"
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
+ --with-newlib \
+%endif
+%if "%{TARGET_ARCH}" == "nvptx"
+ --enable-as-accelerator-for=%{GCCDIST} \
+ --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long \
+%endif
+%if "%{TARGET_ARCH}" == "avr"
+ --enable-lto \
+ --without-gxx-include-dir \
+ --with-native-system-header-dir=/include \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "arm"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv5tel"
+ --with-arch=armv5te \
+ --with-float=soft \
+ --with-mode=arm \
+ --with-abi=aapcs-linux \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv6hl"
+ --with-arch=armv6zk \
+ --with-tune=arm1176jzf-s \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfp \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "armv7hl"
+ --with-arch=armv7-a \
+ --with-tune=cortex-a15 \
+ --with-float=hard \
+ --with-abi=aapcs-linux \
+ --with-fpu=vfpv3-d16 \
+ --disable-sjlj-exceptions \
+%endif
+%if "%{TARGET_ARCH}" == "aarch64"
+ --enable-fix-cortex-a53-835769 \
+ --enable-fix-cortex-a53-843419 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64" || "%{TARGET_ARCH}" == "powerpc64le"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+%if "%{TARGET_ARCH}" == "powerpc64le"
+%if %{suse_version} >= 1350
+ --with-cpu=power8 \
+ --with-tune=power9 \
+%else
+%if %{suse_version} >= 1315 && %{suse_version} != 1320
+ --with-cpu=power8 \
+ --with-tune=power8 \
+%else
+ --with-cpu=power7 \
+ --with-tune=power7 \
+%endif
+%endif
+%else
+ --with-cpu-64=power4 \
+%endif
+ --enable-secureplt \
+ --with-long-double-128 \
+%if "%{TARGET_ARCH}" == "powerpc64le"
+ --enable-targets=powerpcle-linux \
+ --disable-multilib \
+%endif
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "i586"
+%if 0%{?sle_version:%sle_version} >= 150000
+ --with-arch-32=x86-64 \
+%else
+ --with-arch-32=i586 \
+%endif
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "x86_64"
+ --enable-multilib \
+ --with-arch-32=x86-64 \
+ --with-tune=generic \
+%endif
+%if "%{TARGET_ARCH}" == "s390"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+%if %{suse_version} >= 1310
+ --with-tune=zEC12 --with-arch=z196 \
+%else
+ --with-tune=z9-109 --with-arch=z900 \
+%endif
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "m68k"
+ --disable-multilib \
+%endif
+%if "%{TARGET_ARCH}" == "riscv64"
+ --disable-multilib \
+%endif
+ --build=%{GCCDIST} \
+ --host=%{GCCDIST}
+
+# BUILD-COMMON-END
+
+STAGE1_FLAGS="-g -O2"
+%if 0%{?do_profiling}
+%define profiledbootstraprule profiledbootstrap
+%endif
+# Only run profiled bootstrap on archs where it works and matters
+%ifarch x86_64 %ix86 ppc64le s390x aarch64
+setarch `arch` -R make %{?profiledbootstraprule} STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
+%else
+make STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
+%endif
+make info
+%if 0%{?run_tests:1}
+echo "Run testsuite"
+(make -C %{GCCDIST}/libstdc++-v3 check-abi || true)
+mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.log %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.log
+mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.sum %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.sum
+# asan needs a whole shadow address space
+ulimit -v unlimited || true
+make -k check %{?_smp_mflags} || true
+mkdir ../testresults
+../contrib/test_summary | tee ../testresults/test_summary.txt
+%endif
+
+%install
+# Make sure libtool re-linking libasan at install time doesn't drop the
+# libstdc++ reference to make asan of C++ modules in python work
+export SUSE_ASNEEDED=0
+export NO_BRP_CHECK_BYTECODE_VERSION=true
+cd obj-%{GCCDIST}
+# GCC-TESTSUITE-DELETE-BEGIN
+# Work around tail/head -1 changes
+export _POSIX2_VERSION=199209
+export LIBRARY_PATH=$RPM_BUILD_ROOT%{libsubdir}:$RPM_BUILD_ROOT%{mainlibdirbi}
+make install DESTDIR=$RPM_BUILD_ROOT
+
+# verify libasan really ended up with libstdc++ as NEEDED.
+%ifarch %asan_arch
+ readelf -d $RPM_BUILD_ROOT%{versmainlibdir}/libasan.so.%{libasan_sover}* | grep 'NEEDED.*libstdc++' || exit 1
+%if %{biarch}
+ readelf -d $RPM_BUILD_ROOT%{versmainlibdirbi}/libasan.so.%{libasan_sover}* | grep 'NEEDED.*libstdc++' || exit 1
+%endif
+%endif
+
+# Remove some useless .la files
+for lib in libobjc libgfortran libquadmath libcaf_single \
+ libgomp libgomp-plugin-hsa libstdc++ libsupc++ libgo \
+ libasan libatomic libitm libtsan libcilkrts liblsan libubsan libvtv \
+ libmpx libmpxwrappers libstdc++fs libgomp-plugin-nvptx; do
+ rm -f $RPM_BUILD_ROOT%{versmainlibdir}/$lib.la
+%if %{biarch}
+ rm -f $RPM_BUILD_ROOT%{versmainlibdirbi}/$lib.la
+%endif
+done
+
+mkdir -p $RPM_BUILD_ROOT%{_libdir}
+%if %{biarch}
+%if %{build_primary_64bit}
+mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib
+%else
+mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib64
+%endif
+%endif
+
+%if %{build_cp}
+# Merge multilib c++config.h to allow omitting the duplicate and
+# identical other arch specific headers
+dir_ml=
+cxxconfig="`find %{GCCDIST}/libstdc++-v3/include -name c++config.h`"
+for i in `find %{GCCDIST}/[36]*/libstdc++-v3/include -name c++config.h 2>/dev/null`; do
+ if ! diff -up $cxxconfig $i; then
+ file_32=x
+ file_64=x
+ case $i in
+ %{GCCDIST}/32/*)
+ file_32=$i
+ file_64=$cxxconfig
+ dir_ml=32
+ ;;
+ %{GCCDIST}/64/*)
+ file_32=$cxxconfig
+ file_64=$i
+ dir_ml=64
+ ;;
+ esac
+ if ! ( test -f "$file_32" && test -f "$file_64" ); then
+ echo "Urgs?"
+ exit 1
+ fi
+
+ cat > $RPM_BUILD_ROOT%{_prefix}/include/c++/%{gcc_dir_version}/%{GCCDIST}/bits/c++config.h <
+#if __WORDSIZE == 32
+`cat $file_32`
+#else
+`cat $file_64`
+#endif
+#endif
+EOF
+ break
+ fi
+done
+rm -rf $RPM_BUILD_ROOT%{_prefix}/include/c++/%{gcc_dir_version}/%{GCCDIST}/[36]*
+if ! test -z "$dir_ml"; then
+ ln -s . $RPM_BUILD_ROOT%{_prefix}/include/c++/%{gcc_dir_version}/%{GCCDIST}/$dir_ml
+fi
+%endif
+
+# move shared libs from versionspecific dir to main libdir
+for libname in \
+%if %{build_fortran}
+ libgfortran \
+%endif
+%ifarch %quadmath_arch
+ libquadmath \
+%endif
+%if %{build_objc}
+ libobjc \
+%endif
+%if %{build_cp}
+ libstdc++ \
+%endif
+%if %{build_go}
+ libgo \
+%endif
+ libgomp \
+%if %{build_hsa}
+ libgomp-plugin-hsa \
+%endif
+%if %{build_nvptx}
+ libgomp-plugin-nvptx \
+%endif
+%ifarch %atomic_arch
+ libatomic \
+%endif
+%ifarch %itm_arch
+ libitm \
+%endif
+%ifarch %asan_arch
+ libasan \
+%endif
+%ifarch %tsan_arch
+ libtsan \
+%endif
+%ifarch %cilkrts_arch
+ libcilkrts \
+%endif
+%ifarch %lsan_arch
+ liblsan \
+%endif
+%ifarch %ubsan_arch
+ libubsan \
+%endif
+%ifarch %vtv_arch
+ libvtv \
+%endif
+%ifarch %mpx_arch
+ libmpx libmpxwrappers \
+%endif
+ ; do
+ for lib in `find $RPM_BUILD_ROOT%{versmainlibdir} -maxdepth 1 -name $libname.so.*`; do
+ mv $lib $RPM_BUILD_ROOT%{mainlibdir}/
+ done
+ if test -L $RPM_BUILD_ROOT%{versmainlibdir}/$libname.so; then
+ ln -sf %{mainlibdir}/`readlink $RPM_BUILD_ROOT%{versmainlibdir}/$libname.so | sed -e 's/\(.*\.so\.[^\.]*\).*/\1/'` \
+ $RPM_BUILD_ROOT%{versmainlibdir}/$libname.so
+ fi
+%if %{biarch}
+ if test -d $RPM_BUILD_ROOT%{versmainlibdirbi}; then
+ for lib in `find $RPM_BUILD_ROOT%{versmainlibdirbi} -maxdepth 1 -name "$libname.so.*"`; do
+ mv $lib $RPM_BUILD_ROOT%{mainlibdirbi}/
+ done
+ if test -L $RPM_BUILD_ROOT%{versmainlibdirbi}/$libname.so; then
+ ln -sf %{mainlibdirbi}/`readlink $RPM_BUILD_ROOT%{versmainlibdirbi}/$libname.so | sed -e 's/\(.*\.so\.[^\.]*\).*/\1/'` \
+ $RPM_BUILD_ROOT%{versmainlibdirbi}/$libname.so
+ fi
+ fi
+%endif
+done
+%if %{build_cp}
+# And we want to move the shlib gdb pretty printers to a more sane
+# place so ldconfig does not complain
+mkdir -p $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{mainlibdir}
+mv $RPM_BUILD_ROOT%{mainlibdir}/libstdc++.so.*-gdb.py $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{mainlibdir}/
+sed -i -e '/^libdir/s/\/gcc\/%{GCCDIST}\/%{gcc_dir_version}//g' $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{mainlibdir}/libstdc++.so.*-gdb.py
+%if %{biarch}
+ if test -d $RPM_BUILD_ROOT%{versmainlibdirbi}; then
+ mkdir -p $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{mainlibdirbi}
+ mv $RPM_BUILD_ROOT%{mainlibdirbi}/libstdc++.so.*-gdb.py $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{mainlibdirbi}/
+ sed -i -e '/^libdir/s/\/gcc\/%{GCCDIST}\/%{gcc_dir_version}//g' $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{mainlibdirbi}/libstdc++.so.*-gdb.py
+ fi
+%endif
+%endif
+
+# Move libgcc_s around
+if test -L $RPM_BUILD_ROOT/%{_lib}/libgcc_s.so; then
+ rm -f $RPM_BUILD_ROOT/%{_lib}/libgcc_s.so
+ ln -sf /%{_lib}/libgcc_s.so.%{libgcc_s} $RPM_BUILD_ROOT%{versmainlibdir}/libgcc_s.so
+else
+ mv $RPM_BUILD_ROOT/%{_lib}/libgcc_s.so $RPM_BUILD_ROOT%{versmainlibdir}/
+fi
+chmod a+x $RPM_BUILD_ROOT/%{_lib}/libgcc_s.so.%{libgcc_s}
+%if %{biarch}
+%if %{build_primary_64bit}
+if test -L $RPM_BUILD_ROOT/lib/libgcc_s.so; then
+ rm -f $RPM_BUILD_ROOT/lib/libgcc_s.so
+ ln -sf /lib/libgcc_s.so.%{libgcc_s} $RPM_BUILD_ROOT%{versmainlibdirbi32}/libgcc_s.so
+else
+ mv $RPM_BUILD_ROOT/lib/libgcc_s.so $RPM_BUILD_ROOT%{versmainlibdirbi32}/
+fi
+ln -sf %{versmainlibdirbi32}/libgcc_s.so $RPM_BUILD_ROOT%{versmainlibdirbi32}/libgcc_s_32.so
+chmod a+x $RPM_BUILD_ROOT/lib/libgcc_s.so.%{libgcc_s}
+%else
+# 32-bit biarch systems
+if test -L $RPM_BUILD_ROOT/lib64/libgcc_s.so; then
+ rm -f $RPM_BUILD_ROOT/lib64/libgcc_s.so
+ ln -sf /lib64/libgcc_s.so.%{libgcc_s} $RPM_BUILD_ROOT%{versmainlibdirbi64}/libgcc_s.so
+else
+ mv $RPM_BUILD_ROOT/lib64/libgcc_s.so $RPM_BUILD_ROOT%{versmainlibdirbi64}/
+fi
+ln -sf %{versmainlibdirbi64}/libgcc_s.so $RPM_BUILD_ROOT%{versmainlibdirbi64}/libgcc_s_64.so
+chmod a+x $RPM_BUILD_ROOT/lib64/libgcc_s.so.%{libgcc_s}
+%endif
+%endif
+
+%if %{build_ada}
+mv $RPM_BUILD_ROOT%{libsubdir}/adalib/lib*-*.so $RPM_BUILD_ROOT%{_libdir}
+ln -sf %{_libdir}/libgnarl%{binsuffix}.so $RPM_BUILD_ROOT%{libsubdir}/adalib/libgnarl.so
+ln -sf %{_libdir}/libgnat%{binsuffix}.so $RPM_BUILD_ROOT%{libsubdir}/adalib/libgnat.so
+chmod a+x $RPM_BUILD_ROOT%{_libdir}/libgna*-*.so
+%if %{biarch}
+mv $RPM_BUILD_ROOT%{versmainlibdirbi}/adalib/lib*-*.so $RPM_BUILD_ROOT%{mainlibdirbi}/
+ln -sf %{mainlibdirbi}/libgnarl%{binsuffix}.so $RPM_BUILD_ROOT%{versmainlibdirbi}/adalib/libgnarl.so
+ln -sf %{mainlibdirbi}/libgnat%{binsuffix}.so $RPM_BUILD_ROOT%{versmainlibdirbi}/adalib/libgnat.so
+chmod a+x $RPM_BUILD_ROOT%{mainlibdirbi}/libgna*-*.so
+%endif
+%endif
+
+rm -f $RPM_BUILD_ROOT%{_prefix}/bin/c++%{binsuffix}
+
+# Remove some crap from the .la files:
+for l in `find $RPM_BUILD_ROOT -name '*.la'`; do
+ echo "changing $l"
+ sed -e '/^dependency_libs/s| -L%{_builddir}/[^ ]*||g' \
+ -e '/^dependency_libs/s| -L/usr/%{GCCDIST}/bin||g' \
+ -e '/^dependency_libs/s|-lm \(-lm \)*|-lm |' \
+ -e '/^dependency_libs/s|-L[^ ]* ||g' \
+%if %{biarch}
+%if %{build_primary_64bit}
+ -e '/^libdir/s|%{_libdir}/32|%{_prefix}/lib|' \
+ -e '/^libdir/s|lib64/\.\./||' \
+%else
+ -e '/^libdir/s|%{_libdir}/64|%{_prefix}/lib64|' \
+%endif
+%endif
+ < $l > $l.new
+ mv $l.new $l
+done
+
+# GCC-TESTSUITE-DELETE-END
+%if 0%{?run_tests:1}
+cp `find . -name "*.sum"` ../testresults/
+cp `find . -name "*.log" \! -name "config.log" | grep -v 'acats.\?/tests' ` ../testresults/
+chmod 644 ../testresults/*
+%endif
+# GCC-TESTSUITE-DELETE-BEGIN
+# Remove files that we do not need to clean up filelist
+rm -f $RPM_BUILD_ROOT%{_prefix}/bin/%{GCCDIST}-*
+rm -rf $RPM_BUILD_ROOT%{libsubdir}/install-tools
+rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/zutil.h
+rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/linux/a.out.h
+rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/linux/vt.h
+rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/asm-generic/socket.h
+rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/bits/mathdef.h
+rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/sys/ucontext.h
+rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/bits/statx.h
+rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/pthread.h
+rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/bits/unistd_ext.h
+rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/sys/rseq.h
+rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/sys/mount.h
+%if !%{enable_plugins}
+# no plugins
+rm -rf $RPM_BUILD_ROOT%{libsubdir}/plugin
+%endif
+rm -f $RPM_BUILD_ROOT%{_infodir}/dir
+
+
+rm -f $RPM_BUILD_ROOT%{_mandir}/man7/fsf-funding.7
+rm -f $RPM_BUILD_ROOT%{_mandir}/man7/gfdl.7
+rm -f $RPM_BUILD_ROOT%{_mandir}/man7/gpl.7
+rm -f $RPM_BUILD_ROOT%{_libdir}/libiberty.a
+%if %{biarch}
+%if %{build_primary_64bit}
+rm -f $RPM_BUILD_ROOT%{_prefix}/lib/libiberty.a
+%else
+rm -f $RPM_BUILD_ROOT%{_prefix}/lib64/libiberty.a
+%endif
+%endif
+rm -f $RPM_BUILD_ROOT%{libsubdir}/liblto_plugin.a
+rm -f $RPM_BUILD_ROOT%{libsubdir}/liblto_plugin.la
+%if %{build_go}
+# gccgo.info isn't properly versioned
+rm $RPM_BUILD_ROOT%{_infodir}/gccgo.info*
+%endif
+
+# For regular build, some info files do not get renamed properly.
+# Do so here.
+mv $RPM_BUILD_ROOT%{_infodir}/libgomp.info $RPM_BUILD_ROOT%{_infodir}/libgomp%{binsuffix}.info
+%ifarch %itm_arch
+mv $RPM_BUILD_ROOT%{_infodir}/libitm.info $RPM_BUILD_ROOT%{_infodir}/libitm%{binsuffix}.info
+%endif
+%if %{build_fortran}
+%ifarch %quadmath_arch
+mv $RPM_BUILD_ROOT%{_infodir}/libquadmath.info $RPM_BUILD_ROOT%{_infodir}/libquadmath%{binsuffix}.info
+%endif
+%endif
+%if %{build_ada}
+mv $RPM_BUILD_ROOT%{_infodir}/gnat-style.info $RPM_BUILD_ROOT%{_infodir}/gnat-style%{binsuffix}.info
+mv $RPM_BUILD_ROOT%{_infodir}/gnat_rm.info $RPM_BUILD_ROOT%{_infodir}/gnat_rm%{binsuffix}.info
+mv $RPM_BUILD_ROOT%{_infodir}/gnat_ugn.info $RPM_BUILD_ROOT%{_infodir}/gnat_ugn%{binsuffix}.info
+%endif
+
+
+cd ..
+%find_lang cpplib%{binsuffix}
+%find_lang gcc%{binsuffix}
+%find_lang libstdc++
+cat cpplib%{binsuffix}.lang gcc%{binsuffix}.lang > gcc@base_ver@-locale.lang
+
+%post info
+%install_info --info-dir=%{_infodir} %{_infodir}/cpp%{binsuffix}.info.gz
+%install_info --info-dir=%{_infodir} %{_infodir}/cppinternals%{binsuffix}.info.gz
+%install_info --info-dir=%{_infodir} %{_infodir}/gcc%{binsuffix}.info.gz
+%install_info --info-dir=%{_infodir} %{_infodir}/gccint%{binsuffix}.info.gz
+%install_info --info-dir=%{_infodir} %{_infodir}/gccinstall%{binsuffix}.info.gz
+%install_info --info-dir=%{_infodir} %{_infodir}/libgomp%{binsuffix}.info.gz
+%ifarch %itm_arch
+%install_info --info-dir=%{_infodir} %{_infodir}/libitm%{binsuffix}.info.gz
+%endif
+%if %{build_fortran}
+%install_info --info-dir=%{_infodir} %{_infodir}/gfortran%{binsuffix}.info.gz
+%ifarch %quadmath_arch
+%install_info --info-dir=%{_infodir} %{_infodir}/libquadmath%{binsuffix}.info.gz
+%endif
+%endif
+%if %{build_ada}
+%install_info --info-dir=%{_infodir} %{_infodir}/gnat-style%{binsuffix}.info.gz
+%install_info --info-dir=%{_infodir} %{_infodir}/gnat_rm%{binsuffix}.info.gz
+%install_info --info-dir=%{_infodir} %{_infodir}/gnat_ugn%{binsuffix}.info.gz
+%endif
+
+%preun info
+%install_info_delete --info-dir=%{_infodir} %{_infodir}/cpp%{binsuffix}.info.gz
+%install_info_delete --info-dir=%{_infodir} %{_infodir}/cppinternals%{binsuffix}.info.gz
+%install_info_delete --info-dir=%{_infodir} %{_infodir}/gcc%{binsuffix}.info.gz
+%install_info_delete --info-dir=%{_infodir} %{_infodir}/gccint%{binsuffix}.info.gz
+%install_info_delete --info-dir=%{_infodir} %{_infodir}/gccinstall%{binsuffix}.info.gz
+%install_info_delete --info-dir=%{_infodir} %{_infodir}/libgomp%{binsuffix}.info.gz
+%ifarch %itm_arch
+%install_info_delete --info-dir=%{_infodir} %{_infodir}/libitm%{binsuffix}.info.gz
+%endif
+%if %{build_fortran}
+%install_info_delete --info-dir=%{_infodir} %{_infodir}/gfortran%{binsuffix}.info.gz
+%ifarch %quadmath_arch
+%install_info_delete --info-dir=%{_infodir} %{_infodir}/libquadmath%{binsuffix}.info.gz
+%endif
+%endif
+%if %{build_ada}
+%install_info_delete --info-dir=%{_infodir} %{_infodir}/gnat-style%{binsuffix}.info.gz
+%install_info_delete --info-dir=%{_infodir} %{_infodir}/gnat_rm%{binsuffix}.info.gz
+%install_info_delete --info-dir=%{_infodir} %{_infodir}/gnat_ugn%{binsuffix}.info.gz
+%endif
+
+%files
+%defattr(-,root,root)
+%dir %{_libdir}/gcc
+%dir %{_libdir}/gcc/%{GCCDIST}
+%dir %{libsubdir}
+%dir %{libsubdir}/include
+%dir %{libsubdir}/include-fixed
+%if %{biarch}
+%if %{build_primary_64bit}
+%dir %{libsubdir}/32
+%else
+%dir %{libsubdir}/64
+%endif
+%endif
+%{_prefix}/bin/gcc%{binsuffix}
+%{_prefix}/bin/gcov%{binsuffix}
+%{_prefix}/bin/gcov-dump%{binsuffix}
+%{_prefix}/bin/gcov-tool%{binsuffix}
+%{_prefix}/bin/gcc-ar%{binsuffix}
+%{_prefix}/bin/gcc-nm%{binsuffix}
+%{_prefix}/bin/gcc-ranlib%{binsuffix}
+%{libsubdir}/collect2
+%{libsubdir}/lto1
+%{libsubdir}/lto-wrapper
+%{libsubdir}/liblto_plugin.so*
+%{libsubdir}/include-fixed/README
+%{libsubdir}/include-fixed/limits.h
+%{libsubdir}/include-fixed/syslimits.h
+%{libsubdir}/include/omp.h
+%{libsubdir}/include/float.h
+%{libsubdir}/include/iso646.h
+%{libsubdir}/include/stdarg.h
+%{libsubdir}/include/stdbool.h
+%{libsubdir}/include/stdfix.h
+%{libsubdir}/include/stddef.h
+%{libsubdir}/include/unwind.h
+%{libsubdir}/include/varargs.h
+%{libsubdir}/include/stdint.h
+%{libsubdir}/include/stdint-gcc.h
+%{libsubdir}/include/stdnoreturn.h
+%{libsubdir}/include/stdalign.h
+%{libsubdir}/include/stdatomic.h
+%{libsubdir}/include/openacc.h
+%{libsubdir}/include/gcov.h
+%ifarch %sparc
+%{libsubdir}/include/visintrin.h
+%endif
+%ifarch ppc ppc64 ppc64le
+%{libsubdir}/include/altivec.h
+%{libsubdir}/include/ppc-asm.h
+%{libsubdir}/include/paired.h
+%{libsubdir}/include/ppu_intrinsics.h
+%{libsubdir}/include/si2vmx.h
+%{libsubdir}/include/spe.h
+%{libsubdir}/include/spu2vmx.h
+%{libsubdir}/include/vec_types.h
+%{libsubdir}/include/htmintrin.h
+%{libsubdir}/include/htmxlintrin.h
+%endif
+%ifarch s390 s390x
+%{libsubdir}/include/htmintrin.h
+%{libsubdir}/include/htmxlintrin.h
+%{libsubdir}/include/s390intrin.h
+%{libsubdir}/include/vecintrin.h
+%endif
+%ifarch ia64
+%{libsubdir}/include/ia64intrin.h
+%endif
+%ifarch %arm
+%{libsubdir}/include/mmintrin.h
+%{libsubdir}/include/unwind-arm-common.h
+%{libsubdir}/include/arm_cmse.h
+%endif
+%ifarch %arm aarch64
+%{libsubdir}/include/arm_neon.h
+%{libsubdir}/include/arm_acle.h
+%{libsubdir}/include/arm_fp16.h
+%endif
+%ifarch %ix86 x86_64
+%{libsubdir}/include/cross-stdarg.h
+%{libsubdir}/include/cpuid.h
+%{libsubdir}/include/mm3dnow.h
+%{libsubdir}/include/mmintrin.h
+%{libsubdir}/include/ammintrin.h
+%{libsubdir}/include/bmmintrin.h
+%{libsubdir}/include/emmintrin.h
+%{libsubdir}/include/immintrin.h
+%{libsubdir}/include/avxintrin.h
+%{libsubdir}/include/pmmintrin.h
+%{libsubdir}/include/xmmintrin.h
+%{libsubdir}/include/tmmintrin.h
+%{libsubdir}/include/nmmintrin.h
+%{libsubdir}/include/smmintrin.h
+%{libsubdir}/include/wmmintrin.h
+%{libsubdir}/include/x86intrin.h
+%{libsubdir}/include/ia32intrin.h
+%{libsubdir}/include/mm_malloc.h
+%{libsubdir}/include/fma4intrin.h
+%{libsubdir}/include/xopintrin.h
+%{libsubdir}/include/lwpintrin.h
+%{libsubdir}/include/popcntintrin.h
+%{libsubdir}/include/bmiintrin.h
+%{libsubdir}/include/tbmintrin.h
+%{libsubdir}/include/avx2intrin.h
+%{libsubdir}/include/bmi2intrin.h
+%{libsubdir}/include/fmaintrin.h
+%{libsubdir}/include/lzcntintrin.h
+%{libsubdir}/include/f16cintrin.h
+%{libsubdir}/include/adxintrin.h
+%{libsubdir}/include/fxsrintrin.h
+%{libsubdir}/include/prfchwintrin.h
+%{libsubdir}/include/rdseedintrin.h
+%{libsubdir}/include/rtmintrin.h
+%{libsubdir}/include/xsaveintrin.h
+%{libsubdir}/include/xsaveoptintrin.h
+%{libsubdir}/include/xtestintrin.h
+%{libsubdir}/include/avx512cdintrin.h
+%{libsubdir}/include/avx512erintrin.h
+%{libsubdir}/include/avx512fintrin.h
+%{libsubdir}/include/avx512pfintrin.h
+%{libsubdir}/include/shaintrin.h
+%{libsubdir}/include/avx512bwintrin.h
+%{libsubdir}/include/avx512dqintrin.h
+%{libsubdir}/include/avx512vlbwintrin.h
+%{libsubdir}/include/avx512vldqintrin.h
+%{libsubdir}/include/avx512vlintrin.h
+%{libsubdir}/include/avx512ifmaintrin.h
+%{libsubdir}/include/avx512ifmavlintrin.h
+%{libsubdir}/include/avx512vbmiintrin.h
+%{libsubdir}/include/avx512vbmivlintrin.h
+%{libsubdir}/include/avx5124fmapsintrin.h
+%{libsubdir}/include/avx5124vnniwintrin.h
+%{libsubdir}/include/avx512vpopcntdqintrin.h
+%{libsubdir}/include/clwbintrin.h
+%{libsubdir}/include/clflushoptintrin.h
+%{libsubdir}/include/xsavecintrin.h
+%{libsubdir}/include/xsavesintrin.h
+%{libsubdir}/include/mwaitxintrin.h
+%{libsubdir}/include/clzerointrin.h
+%{libsubdir}/include/pkuintrin.h
+%{libsubdir}/include/sgxintrin.h
+%endif
+%ifarch m68k
+%{libsubdir}/include/math-68881.h
+%endif
+%ifarch %cilkrts_arch
+%{libsubdir}/include/cilk
+%endif
+%ifarch %asan_arch
+%{libsubdir}/include/sanitizer
+%endif
+%versmainlib *crt*.o
+%versmainlib libgcc*.a
+%versmainlib libgcov.a
+%versmainlib libgcc_s*.so
+%versmainlib libgomp.so
+%versmainlib libgomp.a
+%versmainlib libgomp.spec
+%if %{build_hsa}
+%versmainlib libgomp-plugin-hsa.so
+%endif
+%if %{build_nvptx}
+%versmainlib libgomp-plugin-nvptx.so
+%endif
+%ifarch %itm_arch
+%versmainlib libitm.so
+%versmainlib libitm.a
+%versmainlib libitm.spec
+%endif
+%ifarch %atomic_arch
+%versmainlib libatomic.so
+%versmainlib libatomic.a
+%endif
+%ifarch %asan_arch
+%versmainlib libasan.so
+%versmainlib libasan.a
+%versmainlib libasan_preinit.o
+%endif
+%ifarch %tsan_arch
+%if %build_primary_64bit
+%versmainlib libtsan.so
+%versmainlib libtsan.a
+%versmainlib libtsan_preinit.o
+%endif
+%endif
+%ifarch %cilkrts_arch
+%versmainlib libcilkrts.so
+%versmainlib libcilkrts.a
+%versmainlib libcilkrts.spec
+%endif
+%ifarch %lsan_arch
+%if %build_primary_64bit
+%versmainlib liblsan.so
+%versmainlib liblsan.a
+%endif
+%endif
+%ifarch %ubsan_arch
+%versmainlib libubsan.so
+%versmainlib libubsan.a
+%endif
+%ifarch %asan_arch %ubsan_arch %tsan_arch %lsan_arch
+%versmainlib libsanitizer.spec
+%endif
+%ifarch %vtv_arch
+%versmainlib libvtv.so
+%versmainlib libvtv.a
+%endif
+%ifarch %mpx_arch
+%versmainlib libmpx.so
+%versmainlib libmpx.a
+%versmainlib libmpxwrappers.so
+%versmainlib libmpxwrappers.a
+%versmainlib libmpx.spec
+%endif
+%doc %{_mandir}/man1/gcc%{binsuffix}.1.gz
+%doc %{_mandir}/man1/gcov%{binsuffix}.1.gz
+%doc %{_mandir}/man1/gcov-dump%{binsuffix}.1.gz
+%doc %{_mandir}/man1/gcov-tool%{binsuffix}.1.gz
+
+%if %{separate_biarch}
+%files -n gcc@base_ver@%{separate_biarch_suffix}
+%defattr(-,root,root)
+%versbiarchlib *crt*.o
+%versbiarchlib libgcc*.a
+%versbiarchlib libgcov.a
+%versbiarchlib libgcc_s*.so
+%versbiarchlib libgomp.so
+%versbiarchlib libgomp.a
+%versbiarchlib libgomp.spec
+%if %{build_nvptx}
+%versbiarchlib libgomp-plugin-nvptx.so
+%endif
+%ifarch %itm_arch
+%versbiarchlib libitm.so
+%versbiarchlib libitm.a
+%versbiarchlib libitm.spec
+%endif
+%ifarch %atomic_arch
+%versbiarchlib libatomic.a
+%versbiarchlib libatomic.so
+%endif
+%ifarch %asan_arch
+%versbiarchlib libasan.a
+%versbiarchlib libasan.so
+%versbiarchlib libasan_preinit.o
+%endif
+%ifarch %ubsan_arch
+%versbiarchlib libubsan.a
+%versbiarchlib libubsan.so
+%endif
+%ifarch %cilkrts_arch
+%versbiarchlib libcilkrts.a
+%versbiarchlib libcilkrts.so
+%versbiarchlib libcilkrts.spec
+%endif
+%ifarch %tsan_arch
+%if %separate_bi64
+%versbiarchlib libtsan.a
+%versbiarchlib libtsan.so
+%versbiarchlib libtsan_preinit.o
+%endif
+%endif
+%ifarch %lsan_arch
+%if %separate_bi64
+%versbiarchlib liblsan.a
+%versbiarchlib liblsan.so
+%endif
+%endif
+%ifarch %asan_arch %ubsan_arch %tsan_arch %lsan_arch
+%versbiarchlib libsanitizer.spec
+%endif
+%ifarch %vtv_arch
+%versbiarchlib libvtv.a
+%versbiarchlib libvtv.so
+%endif
+%ifarch %mpx_arch
+%versbiarchlib libmpx.so
+%versbiarchlib libmpx.a
+%versbiarchlib libmpxwrappers.so
+%versbiarchlib libmpxwrappers.a
+%versbiarchlib libmpx.spec
+%endif
+%endif
+
+%if %{enable_plugins}
+%files devel
+%defattr(-,root,root)
+%dir %{libsubdir}/plugin
+%{libsubdir}/plugin
+%endif
+
+%files locale -f gcc@base_ver@-locale.lang
+
+%files -n libstdc++%{libstdcxx_sover}%{libstdcxx_suffix}-locale -f libstdc++.lang
+
+%if %{build_cp}
+%files c++
+%defattr(-,root,root)
+%dir %{_libdir}/gcc
+%dir %{_libdir}/gcc/%{GCCDIST}
+%dir %{libsubdir}
+%{_prefix}/bin/g++%{binsuffix}
+%doc %{_mandir}/man1/g++%{binsuffix}.1.gz
+%{libsubdir}/cc1plus
+
+%if %{separate_biarch}
+%files c++%{separate_biarch_suffix}
+%defattr(-,root,root)
+# empty - only for the dependency
+%if %{suse_version} < 1310
+%doc README
+%endif
+%endif
+
+%files -n libstdc++%{libstdcxx_sover}%{libstdcxx_suffix}
+%defattr(-,root,root)
+%mainlib libstdc++.so.%{libstdcxx_sover}*
+
+%if %{separate_biarch}
+%files -n libstdc++%{libstdcxx_sover}%{libstdcxx_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libstdc++.so.%{libstdcxx_sover}*
+%endif
+
+%files -n libstdc++%{libstdcxx_sover}-devel%{libdevel_suffix}
+%defattr(-,root,root)
+%versmainlib libstdc++.a
+%versmainlib libstdc++fs.a
+%versmainlib libstdc++.so
+%versmainlib libsupc++.a
+%{_prefix}/include/c++
+%dir %{_datadir}/gdb
+%dir %{_datadir}/gdb/auto-load
+%dir %{_datadir}/gdb/auto-load%{_prefix}
+%dir %{_datadir}/gdb/auto-load/%{mainlibdir}
+%{_datadir}/gdb/auto-load/%{mainlibdir}/libstdc++.so.*-gdb.py
+%{_datadir}/gcc%{binsuffix}
+
+%if %{separate_biarch}
+%files -n libstdc++%{libstdcxx_sover}-devel%{libdevel_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%versbiarchlib libstdc++.a
+%versbiarchlib libstdc++fs.a
+%versbiarchlib libstdc++.so
+%versbiarchlib libsupc++.a
+%dir %{_datadir}/gdb/auto-load/%{mainlibdirbi}
+%{_datadir}/gdb/auto-load/%{mainlibdirbi}/libstdc++.so.*-gdb.py
+%endif
+%endif
+
+%files -n libgcc_s%{libgcc_s}%{libgcc_s_suffix}
+%defattr(-,root,root)
+/%{_lib}/libgcc_s.so.%{libgcc_s}
+%if %{biarch}
+%if %{build_primary_64bit}
+%if !%{separate_bi32}
+/lib/libgcc_s.so.%{libgcc_s}
+%endif
+%else
+%if !%{separate_bi64}
+/lib64/libgcc_s.so.%{libgcc_s}
+%endif
+%endif
+%endif
+
+%if %{separate_bi64}
+%files -n libgcc_s%{libgcc_s}%{libgcc_s_suffix}-64bit
+%defattr(-,root,root)
+/lib64/libgcc_s.so.%{libgcc_s}
+%endif
+
+%if %{separate_bi32}
+%files -n libgcc_s%{libgcc_s}%{libgcc_s_suffix}-32bit
+%defattr(-,root,root)
+/lib/libgcc_s.so.%{libgcc_s}
+%endif
+
+
+%files -n libgomp%{libgomp_sover}%{libgomp_suffix}
+%defattr(-,root,root)
+%mainlib libgomp.so.%{libgomp_sover}*
+%if %{build_hsa}
+%mainlib libgomp-plugin-hsa.so.%{libgomp_sover}*
+%endif
+%if %{build_nvptx}
+%mainlib libgomp-plugin-nvptx.so.%{libgomp_sover}*
+%endif
+
+%if %{separate_biarch}
+%files -n libgomp%{libgomp_sover}%{libgomp_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libgomp.so.%{libgomp_sover}*
+%endif
+%if %{build_nvptx}
+%biarchlib libgomp-plugin-nvptx.so.%{libgomp_sover}*
+%endif
+
+
+
+%ifarch %asan_arch
+%files -n libasan%{libasan_sover}%{libasan_suffix}
+%defattr(-,root,root)
+%mainlib libasan.so.%{libasan_sover}*
+
+%if %{separate_biarch}
+%files -n libasan%{libasan_sover}%{libasan_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libasan.so.%{libasan_sover}*
+%endif
+%endif
+
+
+%ifarch %lsan_arch
+%if %build_primary_64bit
+%files -n liblsan%{liblsan_sover}%{liblsan_suffix}
+%defattr(-,root,root)
+%mainlib liblsan.so.%{liblsan_sover}*
+%endif
+
+%if %{separate_biarch} && %{separate_bi64}
+%files -n liblsan%{liblsan_sover}%{liblsan_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib liblsan.so.%{liblsan_sover}*
+%endif
+%endif
+
+
+%ifarch %tsan_arch
+%if %build_primary_64bit
+%files -n libtsan%{libtsan_sover}%{libtsan_suffix}
+%defattr(-,root,root)
+%mainlib libtsan.so.%{libtsan_sover}*
+%endif
+
+%if %{separate_biarch} && %{separate_bi64}
+%files -n libtsan%{libtsan_sover}%{libtsan_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libtsan.so.%{libtsan_sover}*
+%endif
+%endif
+
+
+%ifarch %atomic_arch
+%files -n libatomic%{libatomic_sover}%{libatomic_suffix}
+%defattr(-,root,root)
+%mainlib libatomic.so.%{libatomic_sover}*
+
+%if %{separate_biarch}
+%files -n libatomic%{libatomic_sover}%{libatomic_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libatomic.so.%{libatomic_sover}*
+%endif
+%endif
+
+
+%ifarch %itm_arch
+%files -n libitm%{libitm_sover}%{libitm_suffix}
+%defattr(-,root,root)
+%mainlib libitm.so.%{libitm_sover}*
+
+%if %{separate_biarch}
+%files -n libitm%{libitm_sover}%{libitm_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libitm.so.%{libitm_sover}*
+%endif
+%endif
+
+
+%ifarch %cilkrts_arch
+%files -n libcilkrts%{libcilkrts_sover}%{libcilkrts_suffix}
+%defattr(-,root,root)
+%mainlib libcilkrts.so.%{libcilkrts_sover}*
+
+%if %{separate_biarch}
+%files -n libcilkrts%{libcilkrts_sover}%{libcilkrts_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libcilkrts.so.%{libcilkrts_sover}*
+%endif
+%endif
+
+
+%ifarch %ubsan_arch
+%files -n libubsan%{libubsan_sover}%{libubsan_suffix}
+%defattr(-,root,root)
+%mainlib libubsan.so.%{libubsan_sover}*
+
+%if %{separate_biarch}
+%files -n libubsan%{libubsan_sover}%{libubsan_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libubsan.so.%{libubsan_sover}*
+%endif
+%endif
+
+
+%ifarch %vtv_arch
+%files -n libvtv%{libvtv_sover}%{libvtv_suffix}
+%defattr(-,root,root)
+%mainlib libvtv.so.%{libvtv_sover}*
+
+%if %{separate_biarch}
+%files -n libvtv%{libvtv_sover}%{libvtv_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libvtv.so.%{libvtv_sover}*
+%endif
+%endif
+
+
+%ifarch %mpx_arch
+%files -n libmpx%{libmpx_sover}%{libmpx_suffix}
+%defattr(-,root,root)
+%mainlib libmpx.so.%{libmpx_sover}*
+
+%if %{separate_biarch}
+%files -n libmpx%{libmpx_sover}%{libmpx_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libmpx.so.%{libmpx_sover}*
+%endif
+
+%files -n libmpxwrappers%{libmpxwrappers_sover}%{libmpxwrappers_suffix}
+%defattr(-,root,root)
+%mainlib libmpxwrappers.so.%{libmpxwrappers_sover}*
+
+%if %{separate_biarch}
+%files -n libmpxwrappers%{libmpxwrappers_sover}%{libmpxwrappers_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libmpxwrappers.so.%{libmpxwrappers_sover}*
+%endif
+%endif
+
+
+%if %{build_fortran}
+%files fortran
+%defattr(-,root,root)
+%dir %{libsubdir}/finclude
+%{_prefix}/bin/gfortran%{binsuffix}
+%{libsubdir}/f951
+%{libsubdir}/finclude/*
+%versmainlib libgfortran.a
+%versmainlib libgfortran.so
+%versmainlib libgfortran.spec
+%versmainlib libcaf_single.a
+%ifarch %quadmath_arch
+%{libsubdir}/include/quadmath.h
+%{libsubdir}/include/quadmath_weak.h
+%versmainlib libquadmath.a
+%versmainlib libquadmath.so
+%endif
+%doc %{_mandir}/man1/gfortran%{binsuffix}.1.gz
+
+%if %{separate_biarch}
+%files fortran%{separate_biarch_suffix}
+%defattr(-,root,root)
+%dir %{versmainlibdirbi}/finclude
+%{versmainlibdirbi}/finclude/*
+%versbiarchlib libgfortran.a
+%versbiarchlib libgfortran.so
+%versbiarchlib libgfortran.spec
+%versbiarchlib libcaf_single.a
+%ifarch %quadmath_arch
+%versbiarchlib libquadmath.a
+%versbiarchlib libquadmath.so
+%endif
+%endif
+
+%files -n libgfortran%{libgfortran_sover}%{libgfortran_suffix}
+%defattr(-,root,root)
+%mainlib libgfortran.so.%{libgfortran_sover}*
+
+%if %{separate_biarch}
+%files -n libgfortran%{libgfortran_sover}%{libgfortran_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libgfortran.so.%{libgfortran_sover}*
+%endif
+
+%ifarch %quadmath_arch
+%files -n libquadmath%{libquadmath_sover}%{libquadmath_suffix}
+%defattr(-,root,root)
+%mainlib libquadmath.so.%{libquadmath_sover}*
+
+%if %{separate_biarch}
+%files -n libquadmath%{libquadmath_sover}%{libquadmath_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libquadmath.so.%{libquadmath_sover}*
+%endif
+%endif
+%endif
+
+%files info
+%defattr(-,root,root)
+%doc %{_infodir}/cpp%{binsuffix}.info*.gz
+%doc %{_infodir}/cppinternals%{binsuffix}.info*.gz
+%doc %{_infodir}/gcc%{binsuffix}.info*.gz
+%doc %{_infodir}/gccint%{binsuffix}.info*.gz
+%doc %{_infodir}/gccinstall%{binsuffix}.info*.gz
+%doc %{_infodir}/libgomp%{binsuffix}.info*.gz
+%ifarch %itm_arch
+%doc %{_infodir}/libitm%{binsuffix}.info*.gz
+%endif
+%if %{build_fortran}
+%doc %{_infodir}/gfortran%{binsuffix}.info*.gz
+%ifarch %quadmath_arch
+%doc %{_infodir}/libquadmath%{binsuffix}.info*.gz
+%endif
+%endif
+%if %{build_ada}
+%doc %{_infodir}/gnat-style%{binsuffix}.info*gz
+%doc %{_infodir}/gnat_rm%{binsuffix}.info*gz
+%doc %{_infodir}/gnat_ugn%{binsuffix}.info*gz
+%endif
+
+%files -n cpp@base_ver@
+%defattr(-,root,root)
+%dir %{_libdir}/gcc
+%dir %{_libdir}/gcc/%{GCCDIST}
+%dir %{libsubdir}
+%{_prefix}/bin/cpp%{binsuffix}
+%{libsubdir}/cc1
+%doc %{_mandir}/man1/cpp%{binsuffix}.1.gz
+
+%if %{build_objc}
+%files objc
+%defattr(-,root,root)
+%{libsubdir}/cc1obj
+%{libsubdir}/include/objc
+%versmainlib libobjc.a
+%versmainlib libobjc.so
+
+%if %{separate_biarch}
+%files objc%{separate_biarch_suffix}
+%defattr(-,root,root)
+%versbiarchlib libobjc.a
+%versbiarchlib libobjc.so
+%endif
+
+%files -n libobjc%{libobjc_sover}%{libobjc_suffix}
+%defattr(-,root,root)
+%mainlib libobjc.so.%{libobjc_sover}*
+
+%if %{separate_biarch}
+%files -n libobjc%{libobjc_sover}%{libobjc_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libobjc.so.%{libobjc_sover}*
+%endif
+%endif
+
+
+%if %{build_objcp}
+%files obj-c++
+%defattr(-,root,root)
+%{libsubdir}/cc1objplus
+
+%if %{separate_biarch}
+%files obj-c++%{separate_biarch_suffix}
+%defattr(-,root,root)
+# empty - only for the dependency
+%if %{suse_version} < 1310
+%doc README
+%endif
+%endif
+%endif
+
+
+%if %{build_ada}
+%files ada
+%defattr(-,root,root)
+%dir %{_libdir}/gcc
+%dir %{_libdir}/gcc/%{GCCDIST}
+%dir %{libsubdir}
+%{_prefix}/bin/gnat*
+%dir %{versmainlibdir}/adalib
+%{versmainlibdir}/adainclude
+%{versmainlibdir}/adalib/*.ali
+%{versmainlibdir}/adalib/*.a
+%{versmainlibdir}/adalib/libgnarl.so
+%{versmainlibdir}/adalib/libgnat.so
+%{versmainlibdir}/gnat1
+
+%if %{separate_biarch}
+%files ada%{separate_biarch_suffix}
+%defattr(-,root,root)
+%dir %{versmainlibdirbi}/adalib
+%{versmainlibdirbi}/adainclude
+%{versmainlibdirbi}/adalib/*.ali
+%{versmainlibdirbi}/adalib/*.a
+%{versmainlibdirbi}/adalib/libgnarl.so
+%{versmainlibdirbi}/adalib/libgnat.so
+%endif
+
+%files -n libada@base_ver@
+%defattr(-,root,root)
+%mainlib libgnarl%{binsuffix}.so
+%mainlib libgnat%{binsuffix}.so
+
+%if %{separate_biarch}
+%files -n libada@base_ver@%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libgnarl%{binsuffix}.so
+%biarchlib libgnat%{binsuffix}.so
+%endif
+%endif
+
+%if %{build_go}
+%files go
+%defattr(-,root,root)
+%{_prefix}/bin/gccgo%{binsuffix}
+%{_prefix}/bin/go%{binsuffix}
+%{_prefix}/bin/gofmt%{binsuffix}
+%{libsubdir}/go1
+%versmainlib libgo.a
+%versmainlib libgo.so
+%versmainlib libgobegin.a
+%versmainlib libgolibbegin.a
+%versmainlibdir/cgo
+%dir %mainlibdir/go
+%dir %mainlibdir/go/%{gcc_dir_version}
+%mainlibdir/go/%{gcc_dir_version}/%{GCCDIST}
+%doc %{_mandir}/man1/gccgo%{binsuffix}.1.gz
+%doc %{_mandir}/man1/go%{binsuffix}.1.gz
+%doc %{_mandir}/man1/gofmt%{binsuffix}.1.gz
+
+%if %{separate_biarch}
+%files go%{separate_biarch_suffix}
+%defattr(-,root,root)
+%versbiarchlib libgo.a
+%versbiarchlib libgo.so
+%versbiarchlib libgobegin.a
+%versbiarchlib libgolibbegin.a
+%dir %mainlibdirbi/go
+%dir %mainlibdirbi/go/%{gcc_dir_version}
+%mainlibdirbi/go/%{gcc_dir_version}/%{GCCDIST}
+%endif
+
+%files -n libgo%{libgo_sover}%{libgo_suffix}
+%defattr(-,root,root)
+%mainlib libgo.so.%{libgo_sover}*
+
+%if %{separate_biarch}
+%files -n libgo%{libgo_sover}%{libgo_suffix}%{separate_biarch_suffix}
+%defattr(-,root,root)
+%biarchlib libgo.so.%{libgo_sover}*
+%endif
+%endif
+# GCC-TESTSUITE-DELETE-END
+
+%if 0%{?run_tests:1}
+%files -n gcc@base_ver@-testresults
+%defattr(-,root,root)
+%doc testresults/test_summary.txt
+%doc testresults/*.sum
+%doc testresults/*.log
+%endif
+
+
+%changelog
diff --git a/gcc41-ppc32-retaddr.patch b/gcc41-ppc32-retaddr.patch
new file mode 100644
index 0000000..72f7ca7
--- /dev/null
+++ b/gcc41-ppc32-retaddr.patch
@@ -0,0 +1,91 @@
+2005-11-28 Jakub Jelinek
+
+ * 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;
++}
diff --git a/gcc43-no-unwind-tables.diff b/gcc43-no-unwind-tables.diff
new file mode 100644
index 0000000..e19163f
--- /dev/null
+++ b/gcc43-no-unwind-tables.diff
@@ -0,0 +1,13 @@
+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 =
diff --git a/gcc44-rename-info-files.patch b/gcc44-rename-info-files.patch
new file mode 100644
index 0000000..660332e
--- /dev/null
+++ b/gcc44-rename-info-files.patch
@@ -0,0 +1,665 @@
+#! /bin/sh -e
+
+# DP: Allow transformations on info file names. Reference the
+# DP: transformed info file names in the texinfo files.
+
+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
+
+
+gcc/ChangeLog:
+
+2004-02-17 Matthias Klose
+
+ * Makefile.in: Allow transformations on info file names.
+ Define MAKEINFODEFS, macros to pass transformated info file
+ names to makeinfo.
+ * doc/cpp.texi: Use macros defined in MAKEINFODEFS for references.
+ * doc/cppinternals.texi: Likewise.
+ * doc/extend.texi: Likewise.
+ * doc/gcc.texi: Likewise.
+ * doc/gccint.texi: Likewise.
+ * doc/invoke.texi: Likewise.
+ * doc/libgcc.texi: Likewise.
+ * doc/makefile.texi: Likewise.
+ * doc/passes.texi: Likewise.
+ * doc/sourcebuild.texi: Likewise.
+ * doc/standards.texi: Likewise.
+ * doc/trouble.texi: Likewise.
+
+gcc/fortran/ChangeLog:
+ * Make-lang.in: Allow transformations on info file names.
+ Pass macros of transformated info file defined in MAKEINFODEFS
+ names to makeinfo.
+ * gfortran.texi: Use macros defined in MAKEINFODEFS for references.
+
+gcc/java/ChangeLog:
+ * Make-lang.in: Allow transformations on info file names.
+ Pass macros of transformated info file defined in MAKEINFODEFS
+ names to makeinfo.
+ * gcj.texi: Use macros defined in MAKEINFODEFS for references.
+
+
+---
+ gcc/Makefile.in | 74 ++++++++++++++++++++++++++++++++++++----------
+ gcc/ada/gnat-style.texi | 2 -
+ gcc/ada/gnat_rm.texi | 2 -
+ gcc/ada/gnat_ugn.texi | 2 -
+ gcc/doc/cpp.texi | 2 -
+ gcc/doc/cppinternals.texi | 2 -
+ gcc/doc/extend.texi | 2 -
+ gcc/doc/gcc.texi | 8 ++--
+ gcc/doc/gccint.texi | 4 +-
+ gcc/doc/install.texi | 2 -
+ gcc/doc/invoke.texi | 10 +++---
+ gcc/doc/libgcc.texi | 2 -
+ gcc/doc/makefile.texi | 2 -
+ gcc/doc/passes.texi | 2 -
+ gcc/doc/standards.texi | 4 +-
+ gcc/fortran/Make-lang.in | 11 +++---
+ gcc/fortran/gfortran.texi | 2 -
+ gcc/java/Make-lang.in | 19 +++++++++--
+ gcc/java/gcj.texi | 20 ++++++------
+ libgomp/Makefile.am | 13 ++++----
+ libgomp/Makefile.in | 14 ++++----
+ libgomp/libgomp.texi | 2 -
+ 22 files changed, 131 insertions(+), 70 deletions(-)
+
+Index: gcc/Makefile.in
+===================================================================
+--- gcc/Makefile.in.orig 2017-03-22 09:07:47.180401238 +0100
++++ gcc/Makefile.in 2017-03-22 09:07:50.212445405 +0100
+@@ -3066,8 +3066,27 @@ install-no-fixedincludes:
+
+ doc: $(BUILD_INFO) $(GENERATED_MANPAGES)
+
+-INFOFILES = doc/cpp.info doc/gcc.info doc/gccint.info \
+- doc/gccinstall.info doc/cppinternals.info
++INFO_CPP_NAME = $(shell echo cpp|sed '$(program_transform_name)')
++INFO_GCC_NAME = $(shell echo gcc|sed '$(program_transform_name)')
++INFO_GXX_NAME = $(shell echo g++|sed '$(program_transform_name)')
++INFO_GCCINT_NAME = $(shell echo gccint|sed '$(program_transform_name)')
++INFO_GCCINSTALL_NAME = $(shell echo gccinstall|sed '$(program_transform_name)')
++INFO_CPPINT_NAME = $(shell echo cppinternals|sed '$(program_transform_name)')
++
++INFO_FORTRAN_NAME = $(shell echo gfortran|sed '$(program_transform_name)')
++INFO_GCJ_NAME = $(shell echo gcj|sed '$(program_transform_name)')
++
++INFOFILES = doc/$(INFO_CPP_NAME).info doc/$(INFO_GCC_NAME).info \
++ doc/$(INFO_GCCINT_NAME).info \
++ doc/$(INFO_GCCINSTALL_NAME).info doc/$(INFO_CPPINT_NAME).info
++
++MAKEINFODEFS = -D 'fncpp $(INFO_CPP_NAME)' -D 'fngcc $(INFO_GCC_NAME)' \
++ -D 'fngxx $(INFO_GXX_NAME)' \
++ -D 'fngccint $(INFO_GCCINT_NAME)' \
++ -D 'fngccinstall $(INFO_GCCINSTALL_NAME)' \
++ -D 'fncppint $(INFO_CPPINT_NAME)' \
++ -D 'fngfortran $(INFO_FORTRAN_NAME)' \
++ -D 'fngcj $(INFO_GCJ_NAME)'
+
+ info: $(INFOFILES) lang.info @GENINSRC@ srcinfo lang.srcinfo
+
+@@ -3122,21 +3141,41 @@ gcc-vers.texi: $(BASEVER) $(DEVPHASE)
+ # patterns. To use them, put each of the specific targets with its
+ # specific dependencies but no build commands.
+
+-doc/cpp.info: $(TEXI_CPP_FILES)
+-doc/gcc.info: $(TEXI_GCC_FILES)
+-doc/gccint.info: $(TEXI_GCCINT_FILES)
+-doc/cppinternals.info: $(TEXI_CPPINT_FILES)
+-
++# Generic entry to handle info files, which are not renamed (currently Ada)
+ doc/%.info: %.texi
+ if [ x$(BUILD_INFO) = xinfo ]; then \
+ $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
+ -I $(gcc_docdir)/include -o $@ $<; \
+ fi
+
++doc/$(INFO_CPP_NAME).info: $(TEXI_CPP_FILES)
++ if [ x$(BUILD_INFO) = xinfo ]; then \
++ $(MAKEINFO) $(MAKEINFOFLAGS) $(MAKEINFODEFS) -I $(gcc_docdir) \
++ -I $(gcc_docdir)/include -o $@ $<; \
++ fi
++
++doc/$(INFO_GCC_NAME).info: $(TEXI_GCC_FILES)
++ if [ x$(BUILD_INFO) = xinfo ]; then \
++ $(MAKEINFO) $(MAKEINFOFLAGS) $(MAKEINFODEFS) -I $(gcc_docdir) \
++ -I $(gcc_docdir)/include -o $@ $<; \
++ fi
++
++doc/$(INFO_GCCINT_NAME).info: $(TEXI_GCCINT_FILES)
++ if [ x$(BUILD_INFO) = xinfo ]; then \
++ $(MAKEINFO) $(MAKEINFOFLAGS) $(MAKEINFODEFS) -I $(gcc_docdir) \
++ -I $(gcc_docdir)/include -o $@ $<; \
++ fi
++
++doc/$(INFO_CPPINT_NAME).info: $(TEXI_CPPINT_FILES)
++ if [ x$(BUILD_INFO) = xinfo ]; then \
++ $(MAKEINFO) $(MAKEINFOFLAGS) $(MAKEINFODEFS) -I $(gcc_docdir) \
++ -I $(gcc_docdir)/include -o $@ $<; \
++ fi
++
+ # Duplicate entry to handle renaming of gccinstall.info
+-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
++doc/$(INFO_GCCINSTALL_NAME).info: $(TEXI_GCCINSTALL_FILES)
+ if [ x$(BUILD_INFO) = xinfo ]; then \
+- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
++ $(MAKEINFO) $(MAKEINFOFLAGS) $(MAKEINFODEFS) -I $(gcc_docdir) \
+ -I $(gcc_docdir)/include -o $@ $<; \
+ fi
+
+@@ -3555,11 +3594,11 @@ install-driver: installdirs xgcc$(exeext
+ # $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
+ # to do the install.
+ install-info:: doc installdirs \
+- $(DESTDIR)$(infodir)/cpp.info \
+- $(DESTDIR)$(infodir)/gcc.info \
+- $(DESTDIR)$(infodir)/cppinternals.info \
+- $(DESTDIR)$(infodir)/gccinstall.info \
+- $(DESTDIR)$(infodir)/gccint.info \
++ $(DESTDIR)$(infodir)/$(INFO_CPP_NAME).info \
++ $(DESTDIR)$(infodir)/$(INFO_GCC_NAME).info \
++ $(DESTDIR)$(infodir)/$(INFO_CPPINT_NAME).info \
++ $(DESTDIR)$(infodir)/$(INFO_GCCINSTALL_NAME).info \
++ $(DESTDIR)$(infodir)/$(INFO_GCCINT_NAME).info \
+ lang.install-info
+
+ $(DESTDIR)$(infodir)/%.info: doc/%.info installdirs
+@@ -3780,8 +3819,11 @@ uninstall: lang.uninstall
+ -rm -rf $(DESTDIR)$(bindir)/$(GCOV_INSTALL_NAME)$(exeext)
+ -rm -rf $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext)
+ -rm -rf $(DESTDIR)$(man1dir)/cpp$(man1ext)
+- -rm -f $(DESTDIR)$(infodir)/cpp.info* $(DESTDIR)$(infodir)/gcc.info*
+- -rm -f $(DESTDIR)$(infodir)/cppinternals.info* $(DESTDIR)$(infodir)/gccint.info*
++ -rm -f $(DESTDIR)$(infodir)/$(INFO_CPP_NAME).info*
++ -rm -f $(DESTDIR)$(infodir)/$(INFO_GCC_NAME).info*
++ -rm -f $(DESTDIR)$(infodir)/$(INFO_CPPINT_NAME).info*
++ -rm -f $(DESTDIR)$(infodir)/$(INFO_GCCINT_NAME).info*
++ -rm -f $(DESTDIR)$(infodir)/$(INFO_GCCINSTALL_NAME).info*
+ for i in ar nm ranlib ; do \
+ install_name=`echo gcc-$$i|sed '$(program_transform_name)'`$(exeext) ;\
+ target_install_name=$(target_noncanonical)-`echo gcc-$$i|sed '$(program_transform_name)'`$(exeext) ; \
+Index: gcc/ada/gnat-style.texi
+===================================================================
+--- gcc/ada/gnat-style.texi.orig 2017-03-22 09:07:47.184401296 +0100
++++ gcc/ada/gnat-style.texi 2017-03-22 09:07:50.212445405 +0100
+@@ -31,7 +31,7 @@ Texts. A copy of the license is include
+
+ @dircategory Software development
+ @direntry
+-* gnat-style: (gnat-style). GNAT Coding Style
++* gnat-style: (gnat-style-7). GNAT Coding Style
+ @end direntry
+
+ @macro syntax{element}
+Index: gcc/ada/gnat_rm.texi
+===================================================================
+--- gcc/ada/gnat_rm.texi.orig 2017-03-22 09:07:47.192401412 +0100
++++ gcc/ada/gnat_rm.texi 2017-03-22 09:07:50.220445522 +0100
+@@ -12,7 +12,7 @@
+ @finalout
+ @dircategory GNU Ada Tools
+ @direntry
+-* gnat_rm: (gnat_rm.info). gnat_rm
++* GNAT Reference Manual: (gnat_rm-7). Reference Manual for GNU Ada tools.
+ @end direntry
+
+ @definfoenclose strong,`,'
+Index: gcc/ada/gnat_ugn.texi
+===================================================================
+--- gcc/ada/gnat_ugn.texi.orig 2017-03-22 09:07:47.200401529 +0100
++++ gcc/ada/gnat_ugn.texi 2017-03-22 09:07:50.224445580 +0100
+@@ -12,7 +12,7 @@
+ @finalout
+ @dircategory GNU Ada Tools
+ @direntry
+-* gnat_ugn: (gnat_ugn.info). gnat_ugn
++* User's Guide: (gnat_ugn-7).
+ @end direntry
+
+ @definfoenclose strong,`,'
+Index: gcc/doc/cpp.texi
+===================================================================
+--- gcc/doc/cpp.texi.orig 2017-03-22 09:07:47.200401529 +0100
++++ gcc/doc/cpp.texi 2017-03-22 09:07:50.228445638 +0100
+@@ -50,7 +50,7 @@ This manual contains no Invariant Sectio
+ @ifinfo
+ @dircategory Software development
+ @direntry
+-* Cpp: (cpp). The GNU C preprocessor.
++* @value{fncpp}: (@value{fncpp}). The GNU C preprocessor.
+ @end direntry
+ @end ifinfo
+
+Index: gcc/doc/cppinternals.texi
+===================================================================
+--- gcc/doc/cppinternals.texi.orig 2017-03-22 09:07:47.200401529 +0100
++++ gcc/doc/cppinternals.texi 2017-03-22 09:07:50.228445638 +0100
+@@ -7,7 +7,7 @@
+ @ifinfo
+ @dircategory Software development
+ @direntry
+-* Cpplib: (cppinternals). Cpplib internals.
++* @value{fncppint}: (@value{fncppint}). Cpplib internals.
+ @end direntry
+ @end ifinfo
+
+Index: gcc/doc/extend.texi
+===================================================================
+--- gcc/doc/extend.texi.orig 2017-03-22 09:07:47.204401587 +0100
++++ gcc/doc/extend.texi 2017-03-22 09:07:50.232445697 +0100
+@@ -21790,7 +21790,7 @@ want to write code that checks whether t
+ test for the GNU compiler the same way as for C programs: check for a
+ predefined macro @code{__GNUC__}. You can also use @code{__GNUG__} to
+ test specifically for GNU C++ (@pxref{Common Predefined Macros,,
+-Predefined Macros,cpp,The GNU C Preprocessor}).
++Predefined Macros,@value{fncpp},The GNU C Preprocessor}).
+
+ @menu
+ * C++ Volatiles:: What constitutes an access to a volatile object.
+Index: gcc/doc/gcc.texi
+===================================================================
+--- gcc/doc/gcc.texi.orig 2017-03-22 09:07:47.208401645 +0100
++++ gcc/doc/gcc.texi 2017-03-22 09:10:01.702361422 +0100
+@@ -63,11 +63,11 @@ Texts being (a) (see below), and with th
+ @ifnottex
+ @dircategory Software development
+ @direntry
+-* gcc: (gcc). The GNU Compiler Collection.
+-* g++: (gcc). The GNU C++ compiler.
+-* gcov: (gcc) Gcov. @command{gcov}---a test coverage program.
+-* gcov-tool: (gcc) Gcov-tool. @command{gcov-tool}---an offline gcda profile processing program.
+-* gcov-dump: (gcc) Gcov-dump. @command{gcov-dump}---an offline gcda and gcno profile dump tool.
++* @value{fngcc}: (@value{fngcc}). The GNU Compiler Collection.
++* @value{fngxx}: (@value{fngcc}). The GNU C++ compiler.
++* gcov: (@value{fngcc}) Gcov. @command{gcov}---a test coverage program.
++* gcov-tool: (@value{fngcc}) Gcov-tool. @command{gcov-tool}---an offline gcda profile processing program.
++* gcov-dump: (@value{fngcc}) Gcov-dump. @command{gcov-dump}---an offline gcda and gcno profile dump tool.
+ @end direntry
+ This file documents the use of the GNU compilers.
+ @sp 1
+@@ -127,7 +127,7 @@ version @value{version-GCC}.
+ The internals of the GNU compilers, including how to port them to new
+ targets and some information about how to write front ends for new
+ languages, are documented in a separate manual. @xref{Top,,
+-Introduction, gccint, GNU Compiler Collection (GCC) Internals}.
++Introduction, @value{fngccint}, GNU Compiler Collection (GCC) Internals}.
+
+ @menu
+ * G++ and GCC:: You can compile C or C++ programs.
+Index: gcc/doc/gccint.texi
+===================================================================
+--- gcc/doc/gccint.texi.orig 2017-03-22 09:07:47.208401645 +0100
++++ gcc/doc/gccint.texi 2017-03-22 09:07:50.232445697 +0100
+@@ -49,7 +49,7 @@ Texts being (a) (see below), and with th
+ @ifnottex
+ @dircategory Software development
+ @direntry
+-* gccint: (gccint). Internals of the GNU Compiler Collection.
++* @value{fngccint}: (@value{fngccint}). Internals of the GNU Compiler Collection.
+ @end direntry
+ This file documents the internals of the GNU compilers.
+ @sp 1
+@@ -81,7 +81,7 @@ write front ends for new languages. It
+ @value{VERSION_PACKAGE}
+ @end ifset
+ version @value{version-GCC}. The use of the GNU compilers is documented in a
+-separate manual. @xref{Top,, Introduction, gcc, Using the GNU
++separate manual. @xref{Top,, Introduction, @value{fngcc}, Using the GNU
+ Compiler Collection (GCC)}.
+
+ This manual is mainly a reference manual rather than a tutorial. It
+Index: gcc/doc/install.texi
+===================================================================
+--- gcc/doc/install.texi.orig 2017-03-22 09:07:47.208401645 +0100
++++ gcc/doc/install.texi 2017-03-22 09:07:50.232445697 +0100
+@@ -94,7 +94,7 @@ Free Documentation License}''.
+ @end ifinfo
+ @dircategory Software development
+ @direntry
+-* gccinstall: (gccinstall). Installing the GNU Compiler Collection.
++* @value{fngccinstall}: (@value{fngccinstall}). Installing the GNU Compiler Collection.
+ @end direntry
+
+ @c Part 3 Titlepage and Copyright
+Index: gcc/doc/invoke.texi
+===================================================================
+--- gcc/doc/invoke.texi.orig 2017-03-22 09:07:47.216401762 +0100
++++ gcc/doc/invoke.texi 2017-03-22 09:07:50.240445813 +0100
+@@ -7215,7 +7215,7 @@ the standard calling sequence automatica
+ and nothing is saved by pretending it doesn't exist. The
+ machine-description macro @code{FRAME_POINTER_REQUIRED} controls
+ whether a target machine supports this flag. @xref{Registers,,Register
+-Usage, gccint, GNU Compiler Collection (GCC) Internals}.
++Usage, @value{fngccint}, GNU Compiler Collection (GCC) Internals}.
+
+ The default setting (when not optimizing for
+ size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
+@@ -11601,7 +11601,7 @@ One of the standard libraries bypassed b
+ @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
+ which GCC uses to overcome shortcomings of particular machines, or special
+ needs for some languages.
+-(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
++(@xref{Interface,,Interfacing to GCC Output,@value{fngccint},GNU Compiler
+ Collection (GCC) Internals},
+ for more discussion of @file{libgcc.a}.)
+ In most cases, you need @file{libgcc.a} even when you want to avoid
+@@ -11610,7 +11610,7 @@ or @option{-nodefaultlibs} you should us
+ This ensures that you have no unresolved references to internal GCC
+ library subroutines.
+ (An example of such an internal subroutine is @code{__main}, used to ensure C++
+-constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
++constructors are called; @pxref{Collect2,,@code{collect2}, @value{fngccint},
+ GNU Compiler Collection (GCC) Internals}.)
+
+ @item -pie
+@@ -26503,7 +26503,7 @@ Note that you can also specify places to
+ @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
+ take precedence over places specified using environment variables, which
+ in turn take precedence over those specified by the configuration of GCC@.
+-@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
++@xref{Driver,, Controlling the Compilation Driver @file{gcc}, @value{fngccint},
+ GNU Compiler Collection (GCC) Internals}.
+
+ @table @env
+@@ -26663,7 +26663,7 @@ the headers it contains change.
+
+ A precompiled header file is searched for when @code{#include} is
+ seen in the compilation. As it searches for the included file
+-(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
++(@pxref{Search Path,,Search Path,@value{fncpp},The C Preprocessor}) the
+ compiler looks for a precompiled header in each directory just before it
+ looks for the include file in that directory. The name searched for is
+ the name specified in the @code{#include} with @samp{.gch} appended. If
+Index: gcc/doc/libgcc.texi
+===================================================================
+--- gcc/doc/libgcc.texi.orig 2017-03-22 09:07:47.220401820 +0100
++++ gcc/doc/libgcc.texi 2017-03-22 09:07:50.240445813 +0100
+@@ -24,7 +24,7 @@ that needs them.
+ GCC will also generate calls to C library routines, such as
+ @code{memcpy} and @code{memset}, in some cases. The set of routines
+ that GCC may possibly use is documented in @ref{Other
+-Builtins,,,gcc, Using the GNU Compiler Collection (GCC)}.
++Builtins,,,@value{fngcc}, Using the GNU Compiler Collection (GCC)}.
+
+ These routines take arguments and return values of a specific machine
+ mode, not a specific C type. @xref{Machine Modes}, for an explanation
+Index: gcc/fortran/Make-lang.in
+===================================================================
+--- gcc/fortran/Make-lang.in.orig 2017-03-22 09:07:47.220401820 +0100
++++ gcc/fortran/Make-lang.in 2017-03-22 09:07:50.240445813 +0100
+@@ -114,7 +114,8 @@ fortran.tags: force
+ cd $(srcdir)/fortran; etags -o TAGS.sub *.c *.h; \
+ etags --include TAGS.sub --include ../TAGS.sub
+
+-fortran.info: doc/gfortran.info doc/gfc-internals.info
++INFO_FORTRAN_NAME = $(shell echo gfortran|sed '$(program_transform_name)')
++fortran.info: doc/$(INFO_FORTRAN_NAME).info
+ fortran.dvi: doc/gfortran.dvi doc/gfc-internals.dvi
+
+ F95_HTMLFILES = $(build_htmldir)/gfortran
+@@ -181,10 +182,10 @@ GFORTRAN_TEXI = \
+ $(srcdir)/doc/include/gcc-common.texi \
+ gcc-vers.texi
+
+-doc/gfortran.info: $(GFORTRAN_TEXI)
++doc/$(INFO_FORTRAN_NAME).info: $(GFORTRAN_TEXI)
+ if [ x$(BUILD_INFO) = xinfo ]; then \
+ rm -f doc/gfortran.info-*; \
+- $(MAKEINFO) -I $(srcdir)/doc/include -I $(srcdir)/fortran \
++ $(MAKEINFO) $(MAKEINFODEFS) -I $(srcdir)/doc/include -I $(srcdir)/fortran \
+ -o $@ $<; \
+ else true; fi
+
+@@ -249,7 +250,7 @@ fortran.install-common: install-finclude
+
+ fortran.install-plugin:
+
+-fortran.install-info: $(DESTDIR)$(infodir)/gfortran.info
++fortran.install-info: $(DESTDIR)$(infodir)/$(INFO_FORTRAN_NAME).info
+
+ fortran.install-man: $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext)
+
+@@ -267,7 +268,7 @@ fortran.uninstall:
+ rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
+ rm -rf $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext); \
+ rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
+- rm -rf $(DESTDIR)$(infodir)/gfortran.info*
++ rm -rf $(DESTDIR)$(infodir)/$(INFO_FORTRAN_NAME).info*
+
+ #
+ # Clean hooks:
+Index: gcc/fortran/gfortran.texi
+===================================================================
+--- gcc/fortran/gfortran.texi.orig 2017-03-22 09:07:47.220401820 +0100
++++ gcc/fortran/gfortran.texi 2017-03-22 09:07:50.244445871 +0100
+@@ -101,7 +101,7 @@ Texts being (a) (see below), and with th
+ @ifinfo
+ @dircategory Software development
+ @direntry
+-* gfortran: (gfortran). The GNU Fortran Compiler.
++* @value{fngfortran}: (@value{fngfortran}). The GNU Fortran Compiler.
+ @end direntry
+ This file documents the use and the internals of
+ the GNU Fortran compiler, (@command{gfortran}).
+Index: libffi/Makefile.am
+===================================================================
+--- libffi/Makefile.am.orig 2017-03-22 09:07:47.220401820 +0100
++++ libffi/Makefile.am 2017-03-22 09:07:50.244445871 +0100
+@@ -25,6 +25,8 @@ TEXINFO_TEX = ../gcc/doc/include/texin
+ # Defines info, dvi, pdf and html targets
+ MAKEINFOFLAGS = -I $(srcdir)/../gcc/doc/include
+ info_TEXINFOS = doc/libffi.texi
++INFO_LIBFFI_NAME = $(shell echo libffi | sed '${program_transform_name}')
++INFO_DEPS = doc/$(INFO_LIBFFI_NAME).info
+
+ # AM_CONDITIONAL on configure option --generated-files-in-srcdir
+ if GENINSRC
+@@ -42,17 +44,17 @@ endif
+
+ all-local: $(STAMP_GENINSRC)
+
+-stamp-geninsrc: doc/libffi.info
+- cp -p $(top_builddir)/doc/libffi.info $(srcdir)/doc/libffi.info
++stamp-geninsrc: doc/$(INFO_LIBFFI_NAME).info
++ cp -p $(top_builddir)/doc/$(INFO_LIBFFI_NAME).info $(srcdir)/doc/libffi.info
+ @touch $@
+
+-doc/libffi.info: $(STAMP_BUILD_INFO)
++doc/$(INFO_LIBFFI_NAME).info: $(STAMP_BUILD_INFO)
+
+ stamp-build-info: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp)
+- $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)/doc -o doc/libffi.info $(srcdir)/doc/libffi.texi
++ $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -D 'fnlibffi $(INFO_LIBFFI_NAME)' -I $(srcdir)/doc -o doc/$(INFO_LIBFFI_NAME).info $(srcdir)/doc/libffi.texi
+ @touch $@
+
+-CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) doc/libffi.info
++CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) doc/$(INFO_LIBFFI_NAME).info
+ MAINTAINERCLEANFILES = $(srcdir)/doc/libffi.info
+
+ ## ################################################################
+Index: libffi/Makefile.in
+===================================================================
+--- libffi/Makefile.in.orig 2017-03-22 09:07:47.224401878 +0100
++++ libffi/Makefile.in 2017-03-22 09:07:50.244445871 +0100
+@@ -158,7 +158,6 @@ MULTIDIRS =
+ MULTISUBDIR =
+ MULTIDO = true
+ MULTICLEAN = true
+-INFO_DEPS = doc/libffi.info
+ am__TEXINFO_TEX_DIR = $(srcdir)/../gcc/doc/include
+ DVIS = doc/libffi.dvi
+ PDFS = doc/libffi.pdf
+@@ -352,6 +351,8 @@ TEXINFO_TEX = ../gcc/doc/include/texinfo
+ # Defines info, dvi, pdf and html targets
+ MAKEINFOFLAGS = -I $(srcdir)/../gcc/doc/include
+ info_TEXINFOS = doc/libffi.texi
++INFO_LIBFFI_NAME = $(shell echo libffi | sed '${program_transform_name}')
++INFO_DEPS = doc/$(INFO_LIBFFI_NAME).info
+ @GENINSRC_FALSE@STAMP_GENINSRC =
+
+ # AM_CONDITIONAL on configure option --generated-files-in-srcdir
+@@ -360,7 +361,7 @@ info_TEXINFOS = doc/libffi.texi
+
+ # AM_CONDITIONAL on configure check ACX_CHECK_PROG_VER([MAKEINFO])
+ @BUILD_INFO_TRUE@STAMP_BUILD_INFO = stamp-build-info
+-CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) doc/libffi.info
++CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) doc/$(INFO_LIBFFI_NAME).info
+ MAINTAINERCLEANFILES = $(srcdir)/doc/libffi.info
+
+ # Work around what appears to be a GNU make bug handling MAKEFLAGS
+@@ -1893,14 +1894,15 @@ uninstall-am: uninstall-dvi-am uninstall
+
+ all-local: $(STAMP_GENINSRC)
+
+-stamp-geninsrc: doc/libffi.info
+- cp -p $(top_builddir)/doc/libffi.info $(srcdir)/doc/libffi.info
++$(srcdir)/doc/libffi.info: stamp-geninsrc
++stamp-geninsrc: doc/$(INFO_LIBFFI_NAME).info
++ cp -p $(top_builddir)/doc/$(INFO_LIBFFI_NAME).info $(srcdir)/doc/libffi.info
+ @touch $@
+
+-doc/libffi.info: $(STAMP_BUILD_INFO)
++doc/$(INFO_LIBFFI_NAME).info: $(STAMP_BUILD_INFO)
+
+ stamp-build-info: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp)
+- $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)/doc -o doc/libffi.info $(srcdir)/doc/libffi.texi
++ $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -D 'fnlibffi $(INFO_LIBFFI_NAME)' -I $(srcdir)/doc -o doc/$(INFO_LIBFFI_NAME).info $(srcdir)/doc/libffi.texi
+ @touch $@
+ @LIBAT_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libffi.map-sun : libffi.map $(top_srcdir)/../contrib/make_sunver.pl \
+ @LIBAT_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@ $(libffi_la_OBJECTS) $(libffi_la_LIBADD)
+Index: libffi/doc/libffi.texi
+===================================================================
+--- libffi/doc/libffi.texi.orig 2017-03-22 09:07:47.224401878 +0100
++++ libffi/doc/libffi.texi 2017-03-22 09:07:50.244445871 +0100
+@@ -33,7 +33,7 @@ section entitled ``GNU General Public Li
+
+ @dircategory Development
+ @direntry
+-* libffi: (libffi). Portable foreign-function interface library.
++* libffi: (@value{fnlibffi}). Portable foreign-function interface library.
+ @end direntry
+
+ @titlepage
+Index: libgomp/Makefile.am
+===================================================================
+--- libgomp/Makefile.am.orig 2017-03-22 09:07:47.224401878 +0100
++++ libgomp/Makefile.am 2017-03-22 09:07:50.244445871 +0100
+@@ -125,16 +125,19 @@ endif
+
+ all-local: $(STAMP_GENINSRC)
+
+-stamp-geninsrc: libgomp.info
+- cp -p $(top_builddir)/libgomp.info $(srcdir)/libgomp.info
++INFO_LIBGOMP_NAME = $(shell echo libgomp|sed '$(program_transform_name)')
++stamp-geninsrc: $(INFO_LIBGOMP_NAME).info
++ cp -p $(top_builddir)/$(INFO_LIBGOMP_NAME).info $(srcdir)/libgomp.info
+ @touch $@
+
+-libgomp.info: $(STAMP_BUILD_INFO)
++libgomp.info: $(INFO_LIBGOMP_NAME).info
++ cp $(INFO_LIBGOMP_NAME).info libgomp.info
++$(INFO_LIBGOMP_NAME).info: $(STAMP_BUILD_INFO)
+
+ stamp-build-info: libgomp.texi
+- $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) -o libgomp.info $(srcdir)/libgomp.texi
++ $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -D 'fnlibgomp $(INFO_LIBGOMP_NAME)' -I $(srcdir) -o $(INFO_LIBGOMP_NAME).info $(srcdir)/libgomp.texi
+ @touch $@
+
+
+-CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) libgomp.info
++CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) $(INFO_LIBGOMP_NAME).info
+ MAINTAINERCLEANFILES = $(srcdir)/libgomp.info
+Index: libgomp/Makefile.in
+===================================================================
+--- libgomp/Makefile.in.orig 2017-03-22 09:07:47.224401878 +0100
++++ libgomp/Makefile.in 2017-03-22 09:07:50.244445871 +0100
+@@ -487,7 +487,8 @@ info_TEXINFOS = libgomp.texi
+
+ # AM_CONDITIONAL on configure check ACX_CHECK_PROG_VER([MAKEINFO])
+ @BUILD_INFO_TRUE@STAMP_BUILD_INFO = stamp-build-info
+-CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) libgomp.info
++INFO_LIBGOMP_NAME = $(shell echo libgomp|sed '$(program_transform_name)')
++CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) $(INFO_LIBGOMP_NAME).info
+ MAINTAINERCLEANFILES = $(srcdir)/libgomp.info
+ all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+@@ -1302,15 +1303,16 @@ env.lo: libgomp_f.h
+ env.o: libgomp_f.h
+
+ all-local: $(STAMP_GENINSRC)
+-
+-stamp-geninsrc: libgomp.info
+- cp -p $(top_builddir)/libgomp.info $(srcdir)/libgomp.info
++stamp-geninsrc: $(INFO_LIBGOMP_NAME).info
++ cp -p $(top_builddir)/$(INFO_LIBGOMP_NAME).info $(srcdir)/libgomp.info
+ @touch $@
+
+-libgomp.info: $(STAMP_BUILD_INFO)
++libgomp.info: $(INFO_LIBGOMP_NAME).info
++ cp $(INFO_LIBGOMP_NAME).info libgomp.info
++$(INFO_LIBGOMP_NAME).info: $(STAMP_BUILD_INFO)
+
+ stamp-build-info: libgomp.texi
+- $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) -o libgomp.info $(srcdir)/libgomp.texi
++ $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -D 'fnlibgomp $(INFO_LIBGOMP_NAME)' -I $(srcdir) -o $(INFO_LIBGOMP_NAME).info $(srcdir)/libgomp.texi
+ @touch $@
+
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+Index: libgomp/libgomp.texi
+===================================================================
+--- libgomp/libgomp.texi.orig 2017-03-22 09:07:47.224401878 +0100
++++ libgomp/libgomp.texi 2017-03-22 09:07:50.244445871 +0100
+@@ -31,7 +31,7 @@ texts being (a) (see below), and with th
+ @ifinfo
+ @dircategory GNU Libraries
+ @direntry
+-* libgomp: (libgomp). GNU Offloading and Multi Processing Runtime Library.
++* @value{fnlibgomp}: (@value{fnlibgomp}). GNU Offloading and Multi Processing Runtime Library.
+ @end direntry
+
+ This manual documents libgomp, the GNU Offloading and Multi Processing
+Index: libitm/libitm.texi
+===================================================================
+--- libitm/libitm.texi.orig 2017-03-22 09:07:47.224401878 +0100
++++ libitm/libitm.texi 2017-03-22 09:07:50.244445871 +0100
+@@ -20,7 +20,7 @@ Free Documentation License''.
+ @ifinfo
+ @dircategory GNU Libraries
+ @direntry
+-* libitm: (libitm). GNU Transactional Memory Library
++* libitm: (libitm-6). GNU Transactional Memory Library
+ @end direntry
+
+ This manual documents the GNU Transactional Memory Library.
+Index: libquadmath/libquadmath.texi
+===================================================================
+--- libquadmath/libquadmath.texi.orig 2017-03-22 09:07:47.224401878 +0100
++++ libquadmath/libquadmath.texi 2017-03-22 09:07:50.244445871 +0100
+@@ -25,7 +25,7 @@ copy and modify this GNU manual.
+ @ifinfo
+ @dircategory GNU Libraries
+ @direntry
+-* libquadmath: (libquadmath). GCC Quad-Precision Math Library
++* libquadmath: (libquadmath-6). GCC Quad-Precision Math Library
+ @end direntry
+
+ This manual documents the GCC Quad-Precision Math Library API.
diff --git a/gcc44-textdomain.patch b/gcc44-textdomain.patch
new file mode 100644
index 0000000..05577d0
--- /dev/null
+++ b/gcc44-textdomain.patch
@@ -0,0 +1,116 @@
+#! /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
+ }
+ }
diff --git a/gcc48-bsc1161913.patch b/gcc48-bsc1161913.patch
new file mode 100644
index 0000000..8b4fa2b
--- /dev/null
+++ b/gcc48-bsc1161913.patch
@@ -0,0 +1,78 @@
+commit 5c8a1211b9873a1b69ef7b2fddae181535bc3b0a
+Author: Vladimir N. Makarov
+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
+
+ 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;
diff --git a/gcc48-libstdc++-api-reference.patch b/gcc48-libstdc++-api-reference.patch
new file mode 100644
index 0000000..4becfa0
--- /dev/null
+++ b/gcc48-libstdc++-api-reference.patch
@@ -0,0 +1,14 @@
+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 @@
+
+ Frequently Asked Questions
+
+- API and Source Documentation
++ API and Source Documentation
+
+
Table of Contents
- The GNU C++ Library Manual
- I.
+ Introduction
+
diff --git a/gcc48-remove-mpfr-2.4.0-requirement.patch b/gcc48-remove-mpfr-2.4.0-requirement.patch
new file mode 100644
index 0000000..b5eb04f
--- /dev/null
+++ b/gcc48-remove-mpfr-2.4.0-requirement.patch
@@ -0,0 +1,247 @@
+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
+ #include ],[
+- #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
+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;
+ }
diff --git a/gcc5-no-return-gcc43-workaround.patch b/gcc5-no-return-gcc43-workaround.patch
new file mode 100644
index 0000000..8a01dc5
--- /dev/null
+++ b/gcc5-no-return-gcc43-workaround.patch
@@ -0,0 +1,23 @@
+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,
diff --git a/gcc7-aarch64-bsc1214052.patch b/gcc7-aarch64-bsc1214052.patch
new file mode 100644
index 0000000..6dab583
--- /dev/null
+++ b/gcc7-aarch64-bsc1214052.patch
@@ -0,0 +1,993 @@
+From 04553281f42e5c4340d554a93d1a73006365d8fb Mon Sep 17 00:00:00 2001
+From: Richard Sandiford
+Date: Fri, 16 Jun 2023 17:00:51 +0100
+Subject: [PATCH 1/7] aarch64: Explicitly handle frames with no saved registers
+To: gcc-patches@gcc.gnu.org
+
+If a frame has no saved registers, it can be allocated in one go.
+There is no need to treat the areas below and above the saved
+registers as separate.
+
+This is a no-op as thing stand, since a leaf function will have
+no outgoing arguments, and so all the frame will be above where
+the saved registers normally go.
+
+gcc/
+ * config/aarch64/aarch64.c (aarch64_layout_frame): Explicitly
+ allocate the frame in one go if there are no saved registers.
+---
+ gcc/config/aarch64/aarch64.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
+index 4e94be3b0b4..bb4f6020e5d 100644
+--- a/gcc/config/aarch64/aarch64.c
++++ b/gcc/config/aarch64/aarch64.c
+@@ -2901,8 +2901,10 @@ aarch64_layout_frame (void)
+ else if (cfun->machine->frame.wb_candidate1 != INVALID_REGNUM)
+ max_push_offset = 256;
+
+- if (cfun->machine->frame.frame_size < max_push_offset
+- && crtl->outgoing_args_size == 0)
++ if (cfun->machine->frame.saved_regs_size == 0)
++ cfun->machine->frame.initial_adjust = cfun->machine->frame.frame_size;
++ else if (cfun->machine->frame.frame_size < max_push_offset
++ && crtl->outgoing_args_size == 0)
+ {
+ /* Simple, small frame with no outgoing arguments:
+ stp reg1, reg2, [sp, -frame_size]!
+--
+2.25.1
+
+
+From e97c93de7ceadad75774f897424a50ece3215129 Mon Sep 17 00:00:00 2001
+From: Richard Sandiford
+Date: Fri, 16 Jun 2023 16:55:12 +0100
+Subject: [PATCH 2/7] aarch64: Add bytes_below_hard_fp to frame info
+To: gcc-patches@gcc.gnu.org
+
+The frame layout code currently hard-codes the assumption that
+the number of bytes below the saved registers is equal to the
+size of the outgoing arguments. This patch abstracts that
+value into a new field of aarch64_frame.
+
+gcc/
+ * config/aarch64/aarch64.h (aarch64_frame::bytes_below_hard_fp): New
+ field.
+ * config/aarch64/aarch64.c (aarch64_layout_frame): Initialize it,
+ and use it instead of crtl->outgoing_args_size.
+ (aarch64_get_separate_components): Use bytes_below_hard_fp instead
+ of outgoing_args_size.
+ (aarch64_process_components): Likewise.
+---
+ gcc/config/aarch64/aarch64.c | 40 +++++++++++++++++++++---------------
+ gcc/config/aarch64/aarch64.h | 6 +++++-
+ 2 files changed, 28 insertions(+), 18 deletions(-)
+
+diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
+index bb4f6020e5d..12df8bb783c 100644
+--- a/gcc/config/aarch64/aarch64.c
++++ b/gcc/config/aarch64/aarch64.c
+@@ -2826,6 +2826,8 @@ aarch64_layout_frame (void)
+ last_fp_reg = regno;
+ }
+
++ cfun->machine->frame.bytes_below_hard_fp = crtl->outgoing_args_size;
++
+ if (frame_pointer_needed)
+ {
+ /* FP and LR are placed in the linkage record. */
+@@ -2885,7 +2887,7 @@ aarch64_layout_frame (void)
+
+ cfun->machine->frame.frame_size
+ = ROUND_UP (cfun->machine->frame.hard_fp_offset
+- + crtl->outgoing_args_size,
++ + cfun->machine->frame.bytes_below_hard_fp,
+ STACK_BOUNDARY / BITS_PER_UNIT);
+
+ cfun->machine->frame.locals_offset = cfun->machine->frame.saved_varargs_size;
+@@ -2904,32 +2906,33 @@ aarch64_layout_frame (void)
+ if (cfun->machine->frame.saved_regs_size == 0)
+ cfun->machine->frame.initial_adjust = cfun->machine->frame.frame_size;
+ else if (cfun->machine->frame.frame_size < max_push_offset
+- && crtl->outgoing_args_size == 0)
++ && cfun->machine->frame.bytes_below_hard_fp == 0)
+ {
+- /* Simple, small frame with no outgoing arguments:
++ /* Simple, small frame with no data below the saved registers.
+ stp reg1, reg2, [sp, -frame_size]!
+ stp reg3, reg4, [sp, 16] */
+ cfun->machine->frame.callee_adjust = cfun->machine->frame.frame_size;
+ }
+- else if ((crtl->outgoing_args_size
++ else if ((cfun->machine->frame.bytes_below_hard_fp
+ + cfun->machine->frame.saved_regs_size < 512)
+ && !(cfun->calls_alloca
+ && cfun->machine->frame.hard_fp_offset < max_push_offset))
+ {
+- /* Frame with small outgoing arguments:
++ /* Frame with small area below the saved registers:
+ sub sp, sp, frame_size
+- stp reg1, reg2, [sp, outgoing_args_size]
+- stp reg3, reg4, [sp, outgoing_args_size + 16] */
++ stp reg1, reg2, [sp, bytes_below_hard_fp]
++ stp reg3, reg4, [sp, bytes_below_hard_fp + 16] */
+ cfun->machine->frame.initial_adjust = cfun->machine->frame.frame_size;
+ cfun->machine->frame.callee_offset
+ = cfun->machine->frame.frame_size - cfun->machine->frame.hard_fp_offset;
+ }
+ else if (cfun->machine->frame.hard_fp_offset < max_push_offset)
+ {
+- /* Frame with large outgoing arguments but a small local area:
++ /* Frame with large area below the saved registers, but with a
++ small area above:
+ stp reg1, reg2, [sp, -hard_fp_offset]!
+ stp reg3, reg4, [sp, 16]
+- sub sp, sp, outgoing_args_size */
++ sub sp, sp, bytes_below_hard_fp */
+ cfun->machine->frame.callee_adjust = cfun->machine->frame.hard_fp_offset;
+ cfun->machine->frame.final_adjust
+ = cfun->machine->frame.frame_size - cfun->machine->frame.callee_adjust;
+@@ -2945,17 +2948,19 @@ aarch64_layout_frame (void)
+ cfun->machine->frame.callee_adjust = varargs_and_saved_regs_size;
+ cfun->machine->frame.final_adjust
+ = cfun->machine->frame.frame_size - cfun->machine->frame.callee_adjust;
++ cfun->machine->frame.bytes_below_hard_fp
++ = cfun->machine->frame.final_adjust;
+ cfun->machine->frame.hard_fp_offset = cfun->machine->frame.callee_adjust;
+ cfun->machine->frame.locals_offset = cfun->machine->frame.hard_fp_offset;
+ }
+ else
+ {
+- /* Frame with large local area and outgoing arguments using frame pointer:
++ /* General case:
+ sub sp, sp, hard_fp_offset
+ stp x29, x30, [sp, 0]
+ add x29, sp, 0
+ stp reg3, reg4, [sp, 16]
+- sub sp, sp, outgoing_args_size */
++ sub sp, sp, bytes_below_hard_fp */
+ cfun->machine->frame.initial_adjust = cfun->machine->frame.hard_fp_offset;
+ cfun->machine->frame.final_adjust
+ = cfun->machine->frame.frame_size - cfun->machine->frame.initial_adjust;
+@@ -3313,9 +3318,11 @@ aarch64_get_separate_components (void)
+ if (aarch64_register_saved_on_entry (regno))
+ {
+ HOST_WIDE_INT offset = cfun->machine->frame.reg_offset[regno];
++
++ /* Get the offset relative to the register we'll use. */
+ if (!frame_pointer_needed)
+- offset += cfun->machine->frame.frame_size
+- - cfun->machine->frame.hard_fp_offset;
++ offset += cfun->machine->frame.bytes_below_hard_fp;
++
+ /* Check that we can access the stack slot of the register with one
+ direct load with no adjustments needed. */
+ if (offset_12bit_unsigned_scaled_p (DImode, offset))
+@@ -3418,8 +3425,8 @@ aarch64_process_components (sbitmap components, bool prologue_p)
+ rtx reg = gen_rtx_REG (mode, regno);
+ HOST_WIDE_INT offset = cfun->machine->frame.reg_offset[regno];
+ if (!frame_pointer_needed)
+- offset += cfun->machine->frame.frame_size
+- - cfun->machine->frame.hard_fp_offset;
++ offset += cfun->machine->frame.bytes_below_hard_fp;
++
+ rtx addr = plus_constant (Pmode, ptr_reg, offset);
+ rtx mem = gen_frame_mem (mode, addr);
+
+@@ -3460,8 +3467,7 @@ aarch64_process_components (sbitmap components, bool prologue_p)
+ /* REGNO2 can be saved/restored in a pair with REGNO. */
+ rtx reg2 = gen_rtx_REG (mode, regno2);
+ if (!frame_pointer_needed)
+- offset2 += cfun->machine->frame.frame_size
+- - cfun->machine->frame.hard_fp_offset;
++ offset2 += cfun->machine->frame.bytes_below_hard_fp;
+ rtx addr2 = plus_constant (Pmode, ptr_reg, offset2);
+ rtx mem2 = gen_frame_mem (mode, addr2);
+ rtx set2 = prologue_p ? gen_rtx_SET (mem2, reg2)
+diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
+index ddf833ebfe8..6dc6ef2b989 100644
+--- a/gcc/config/aarch64/aarch64.h
++++ b/gcc/config/aarch64/aarch64.h
+@@ -558,9 +558,13 @@ struct GTY (()) aarch64_frame
+ HOST_WIDE_INT saved_varargs_size;
+
+ /* The size of the saved callee-save int/FP registers. */
+-
+ HOST_WIDE_INT saved_regs_size;
+
++ /* The number of bytes between the bottom of the static frame (the bottom
++ of the outgoing arguments) and the hard frame pointer. This value is
++ always a multiple of STACK_BOUNDARY. */
++ HOST_WIDE_INT bytes_below_hard_fp;
++
+ /* Offset from the base of the frame (incomming SP) to the
+ top of the locals area. This value is always a multiple of
+ STACK_BOUNDARY. */
+--
+2.25.1
+
+
+From e628f34ef3a7db3a75aa146b3e75099a9c431d20 Mon Sep 17 00:00:00 2001
+From: Richard Sandiford
+Date: Tue, 27 Jun 2023 11:25:40 +0100
+Subject: [PATCH 3/7] aarch64: Rename locals_offset to bytes_above_locals
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+To: gcc-patches@gcc.gnu.org
+
+locals_offset was described as:
+
+ /* Offset from the base of the frame (incomming SP) to the
+ top of the locals area. This value is always a multiple of
+ STACK_BOUNDARY. */
+
+This is implicitly an “upside down” view of the frame: the incoming
+SP is at offset 0, and anything N bytes below the incoming SP is at
+offset N (rather than -N).
+
+However, reg_offset instead uses a “right way up” view; that is,
+it views offsets in address terms. Something above X is at a
+positive offset from X and something below X is at a negative
+offset from X.
+
+Also, even on FRAME_GROWS_DOWNWARD targets like AArch64,
+target-independent code views offsets in address terms too:
+locals are allocated at negative offsets to virtual_stack_vars.
+
+It seems confusing to have *_offset fields of the same structure
+using different polarities like this. This patch tries to avoid
+that by renaming locals_offset to bytes_above_locals.
+
+gcc/
+ * config/aarch64/aarch64.h (aarch64_frame::locals_offset): Rename to...
+ (aarch64_frame::bytes_above_locals): ...this.
+ * config/aarch64/aarch64.c (aarch64_layout_frame)
+ (aarch64_initial_elimination_offset): Update accordingly.
+---
+ gcc/config/aarch64/aarch64.c | 12 +++++++-----
+ gcc/config/aarch64/aarch64.h | 6 +++---
+ 2 files changed, 10 insertions(+), 8 deletions(-)
+
+diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
+index 12df8bb783c..27dd3b7a62b 100644
+--- a/gcc/config/aarch64/aarch64.c
++++ b/gcc/config/aarch64/aarch64.c
+@@ -2890,7 +2890,8 @@ aarch64_layout_frame (void)
+ + cfun->machine->frame.bytes_below_hard_fp,
+ STACK_BOUNDARY / BITS_PER_UNIT);
+
+- cfun->machine->frame.locals_offset = cfun->machine->frame.saved_varargs_size;
++ cfun->machine->frame.bytes_above_locals
++ = cfun->machine->frame.saved_varargs_size;
+
+ cfun->machine->frame.initial_adjust = 0;
+ cfun->machine->frame.final_adjust = 0;
+@@ -2951,7 +2952,8 @@ aarch64_layout_frame (void)
+ cfun->machine->frame.bytes_below_hard_fp
+ = cfun->machine->frame.final_adjust;
+ cfun->machine->frame.hard_fp_offset = cfun->machine->frame.callee_adjust;
+- cfun->machine->frame.locals_offset = cfun->machine->frame.hard_fp_offset;
++ cfun->machine->frame.bytes_above_locals
++ = cfun->machine->frame.hard_fp_offset;
+ }
+ else
+ {
+@@ -5653,14 +5655,14 @@ aarch64_initial_elimination_offset (unsigned from, unsigned to)
+
+ if (from == FRAME_POINTER_REGNUM)
+ return cfun->machine->frame.hard_fp_offset
+- - cfun->machine->frame.locals_offset;
++ - cfun->machine->frame.bytes_above_locals;
+ }
+
+ if (to == STACK_POINTER_REGNUM)
+ {
+ if (from == FRAME_POINTER_REGNUM)
+- return cfun->machine->frame.frame_size
+- - cfun->machine->frame.locals_offset;
++ return cfun->machine->frame.frame_size
++ - cfun->machine->frame.bytes_above_locals;
+ }
+
+ return cfun->machine->frame.frame_size;
+diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
+index 6dc6ef2b989..79af237ada6 100644
+--- a/gcc/config/aarch64/aarch64.h
++++ b/gcc/config/aarch64/aarch64.h
+@@ -565,10 +565,10 @@ struct GTY (()) aarch64_frame
+ always a multiple of STACK_BOUNDARY. */
+ HOST_WIDE_INT bytes_below_hard_fp;
+
+- /* Offset from the base of the frame (incomming SP) to the
+- top of the locals area. This value is always a multiple of
++ /* The number of bytes between the top of the locals area and the top
++ of the frame (the incomming SP). This value is always a multiple of
+ STACK_BOUNDARY. */
+- HOST_WIDE_INT locals_offset;
++ HOST_WIDE_INT bytes_above_locals;
+
+ /* Offset from the base of the frame (incomming SP) to the
+ hard_frame_pointer. This value is always a multiple of
+--
+2.25.1
+
+
+From da0132a4cd2eb26ecaff20578bf2753b20014223 Mon Sep 17 00:00:00 2001
+From: Richard Sandiford
+Date: Tue, 27 Jun 2023 11:28:11 +0100
+Subject: [PATCH 4/7] aarch64: Rename hard_fp_offset to bytes_above_hard_fp
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+To: gcc-patches@gcc.gnu.org
+
+Similarly to the previous locals_offset patch, hard_fp_offset
+was described as:
+
+ /* Offset from the base of the frame (incomming SP) to the
+ hard_frame_pointer. This value is always a multiple of
+ STACK_BOUNDARY. */
+ poly_int64 hard_fp_offset;
+
+which again took an “upside-down” view: higher offsets meant lower
+addresses. This patch renames the field to bytes_above_hard_fp instead.
+
+gcc/
+ * config/aarch64/aarch64.h (aarch64_frame::hard_fp_offset): Rename
+ to...
+ (aarch64_frame::bytes_above_hard_fp): ...this.
+ * config/aarch64/aarch64.c (aarch64_layout_frame)
+ (aarch64_expand_prologue): Update accordingly.
+ (aarch64_initial_elimination_offset): Likewise.
+---
+ gcc/config/aarch64/aarch64.c | 29 ++++++++++++++++-------------
+ gcc/config/aarch64/aarch64.h | 6 +++---
+ 2 files changed, 19 insertions(+), 16 deletions(-)
+
+diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
+index 27dd3b7a62b..e3c36abb1e3 100644
+--- a/gcc/config/aarch64/aarch64.c
++++ b/gcc/config/aarch64/aarch64.c
+@@ -2881,12 +2881,12 @@ aarch64_layout_frame (void)
+ HOST_WIDE_INT varargs_and_saved_regs_size
+ = offset + cfun->machine->frame.saved_varargs_size;
+
+- cfun->machine->frame.hard_fp_offset
++ cfun->machine->frame.bytes_above_hard_fp
+ = ROUND_UP (varargs_and_saved_regs_size + get_frame_size (),
+ STACK_BOUNDARY / BITS_PER_UNIT);
+
+ cfun->machine->frame.frame_size
+- = ROUND_UP (cfun->machine->frame.hard_fp_offset
++ = ROUND_UP (cfun->machine->frame.bytes_above_hard_fp
+ + cfun->machine->frame.bytes_below_hard_fp,
+ STACK_BOUNDARY / BITS_PER_UNIT);
+
+@@ -2917,7 +2917,7 @@ aarch64_layout_frame (void)
+ else if ((cfun->machine->frame.bytes_below_hard_fp
+ + cfun->machine->frame.saved_regs_size < 512)
+ && !(cfun->calls_alloca
+- && cfun->machine->frame.hard_fp_offset < max_push_offset))
++ && cfun->machine->frame.bytes_above_hard_fp < max_push_offset))
+ {
+ /* Frame with small area below the saved registers:
+ sub sp, sp, frame_size
+@@ -2925,16 +2925,17 @@ aarch64_layout_frame (void)
+ stp reg3, reg4, [sp, bytes_below_hard_fp + 16] */
+ cfun->machine->frame.initial_adjust = cfun->machine->frame.frame_size;
+ cfun->machine->frame.callee_offset
+- = cfun->machine->frame.frame_size - cfun->machine->frame.hard_fp_offset;
++ = cfun->machine->frame.frame_size - cfun->machine->frame.bytes_above_hard_fp;
+ }
+- else if (cfun->machine->frame.hard_fp_offset < max_push_offset)
++ else if (cfun->machine->frame.bytes_above_hard_fp < max_push_offset)
+ {
+ /* Frame with large area below the saved registers, but with a
+ small area above:
+- stp reg1, reg2, [sp, -hard_fp_offset]!
++ stp reg1, reg2, [sp, -bytes_above_hard_fp]!
+ stp reg3, reg4, [sp, 16]
+ sub sp, sp, bytes_below_hard_fp */
+- cfun->machine->frame.callee_adjust = cfun->machine->frame.hard_fp_offset;
++ cfun->machine->frame.callee_adjust
++ = cfun->machine->frame.bytes_above_hard_fp;
+ cfun->machine->frame.final_adjust
+ = cfun->machine->frame.frame_size - cfun->machine->frame.callee_adjust;
+ }
+@@ -2951,19 +2952,21 @@ aarch64_layout_frame (void)
+ = cfun->machine->frame.frame_size - cfun->machine->frame.callee_adjust;
+ cfun->machine->frame.bytes_below_hard_fp
+ = cfun->machine->frame.final_adjust;
+- cfun->machine->frame.hard_fp_offset = cfun->machine->frame.callee_adjust;
++ cfun->machine->frame.bytes_above_hard_fp
++ = cfun->machine->frame.callee_adjust;
+ cfun->machine->frame.bytes_above_locals
+- = cfun->machine->frame.hard_fp_offset;
++ = cfun->machine->frame.bytes_above_hard_fp;
+ }
+ else
+ {
+ /* General case:
+- sub sp, sp, hard_fp_offset
++ sub sp, sp, bytes_above_hard_fp
+ stp x29, x30, [sp, 0]
+ add x29, sp, 0
+ stp reg3, reg4, [sp, 16]
+ sub sp, sp, bytes_below_hard_fp */
+- cfun->machine->frame.initial_adjust = cfun->machine->frame.hard_fp_offset;
++ cfun->machine->frame.initial_adjust
++ = cfun->machine->frame.bytes_above_hard_fp;
+ cfun->machine->frame.final_adjust
+ = cfun->machine->frame.frame_size - cfun->machine->frame.initial_adjust;
+ }
+@@ -5651,10 +5654,10 @@ aarch64_initial_elimination_offset (unsigned from, unsigned to)
+ if (to == HARD_FRAME_POINTER_REGNUM)
+ {
+ if (from == ARG_POINTER_REGNUM)
+- return cfun->machine->frame.hard_fp_offset;
++ return cfun->machine->frame.bytes_above_hard_fp;
+
+ if (from == FRAME_POINTER_REGNUM)
+- return cfun->machine->frame.hard_fp_offset
++ return cfun->machine->frame.bytes_above_hard_fp
+ - cfun->machine->frame.bytes_above_locals;
+ }
+
+diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
+index 79af237ada6..35ba9681e03 100644
+--- a/gcc/config/aarch64/aarch64.h
++++ b/gcc/config/aarch64/aarch64.h
+@@ -570,10 +570,10 @@ struct GTY (()) aarch64_frame
+ STACK_BOUNDARY. */
+ HOST_WIDE_INT bytes_above_locals;
+
+- /* Offset from the base of the frame (incomming SP) to the
+- hard_frame_pointer. This value is always a multiple of
++ /* The number of bytes between the hard_frame_pointer and the top of
++ the frame (the incomming SP). This value is always a multiple of
+ STACK_BOUNDARY. */
+- HOST_WIDE_INT hard_fp_offset;
++ HOST_WIDE_INT bytes_above_hard_fp;
+
+ /* The size of the frame. This value is the offset from base of the
+ * frame (incomming SP) to the stack_pointer. This value is always
+--
+2.25.1
+
+
+From 19776fcf06856ceff521f99a1ceddaf113cf0d09 Mon Sep 17 00:00:00 2001
+From: Richard Sandiford
+Date: Thu, 22 Jun 2023 22:26:30 +0100
+Subject: [PATCH 5/7] aarch64: Tweak frame_size comment
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+To: gcc-patches@gcc.gnu.org
+
+This patch fixes another case in which a value was described with
+an “upside-down” view.
+
+gcc/
+ * config/aarch64/aarch64.h (aarch64_frame::frame_size): Tweak comment.
+---
+ gcc/config/aarch64/aarch64.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
+index 35ba9681e03..19b7082187a 100644
+--- a/gcc/config/aarch64/aarch64.h
++++ b/gcc/config/aarch64/aarch64.h
+@@ -575,9 +575,9 @@ struct GTY (()) aarch64_frame
+ STACK_BOUNDARY. */
+ HOST_WIDE_INT bytes_above_hard_fp;
+
+- /* The size of the frame. This value is the offset from base of the
+- * frame (incomming SP) to the stack_pointer. This value is always
+- * a multiple of STACK_BOUNDARY. */
++ /* The size of the frame, i.e. the number of bytes between the bottom
++ of the outgoing arguments and the incoming SP. This value is always
++ a multiple of STACK_BOUNDARY. */
+ HOST_WIDE_INT frame_size;
+
+ /* The size of the initial stack adjustment before saving callee-saves. */
+--
+2.25.1
+
+
+From 69c18301a2dea6dd686d4351ba3c095490707d16 Mon Sep 17 00:00:00 2001
+From: Richard Sandiford
+Date: Tue, 15 Aug 2023 19:05:30 +0100
+Subject: [PATCH 6/7] Backport check-function-bodies support
+To: gcc-patches@gcc.gnu.org
+
+---
+ gcc/testsuite/lib/scanasm.exp | 191 ++++++++++++++++++++++++++++++++++
+ 1 file changed, 191 insertions(+)
+
+diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp
+index bab23e8e165..1103f86c602 100644
+--- a/gcc/testsuite/lib/scanasm.exp
++++ b/gcc/testsuite/lib/scanasm.exp
+@@ -514,3 +514,194 @@ proc scan-lto-assembler { args } {
+ verbose "output_file: $output_file"
+ dg-scan "scan-assembler" 1 $testcase $output_file $args
+ }
++
++# Read assembly file FILENAME and store a mapping from function names
++# to function bodies in array RESULT. FILENAME has already been uploaded
++# locally where necessary and is known to exist.
++
++proc parse_function_bodies { filename result } {
++ upvar $result up_result
++
++ # Regexp for the start of a function definition (name in \1).
++ set label {^([a-zA-Z_]\S+):$}
++
++ # Regexp for the end of a function definition.
++ set terminator {^\s*\.size}
++
++ # Regexp for lines that aren't interesting.
++ set fluff {^\s*(?:\.|//|@|$)}
++
++ set fd [open $filename r]
++ set in_function 0
++ while { [gets $fd line] >= 0 } {
++ if { [regexp $label $line dummy function_name] } {
++ set in_function 1
++ set function_body ""
++ } elseif { $in_function } {
++ if { [regexp $terminator $line] } {
++ set up_result($function_name) $function_body
++ set in_function 0
++ } elseif { ![regexp $fluff $line] } {
++ append function_body $line "\n"
++ }
++ }
++ }
++ close $fd
++}
++
++# FUNCTIONS is an array that maps function names to function bodies.
++# Return true if it contains a definition of function NAME and if
++# that definition matches BODY_REGEXP.
++
++proc check_function_body { functions name body_regexp } {
++ upvar $functions up_functions
++
++ if { ![info exists up_functions($name)] } {
++ return 0
++ }
++ set fn_res [regexp "^$body_regexp\$" $up_functions($name)]
++ if { !$fn_res } {
++ verbose -log "body: $body_regexp"
++ verbose -log "against: $up_functions($name)"
++ }
++ return $fn_res
++}
++
++# Check the implementations of functions against expected output. Used as:
++#
++# { dg-do { check-function-bodies PREFIX TERMINATOR[ OPTION[ SELECTOR]] } }
++#
++# See sourcebuild.texi for details.
++
++proc check-function-bodies { args } {
++ if { [llength $args] < 2 } {
++ error "too few arguments to check-function-bodies"
++ }
++ if { [llength $args] > 4 } {
++ error "too many arguments to check-function-bodies"
++ }
++
++ if { [llength $args] >= 3 } {
++ set required_flags [lindex $args 2]
++
++ upvar 2 dg-extra-tool-flags extra_tool_flags
++ set flags $extra_tool_flags
++
++ global torture_current_flags
++ if { [info exists torture_current_flags] } {
++ append flags " " $torture_current_flags
++ }
++ foreach required_flag $required_flags {
++ switch -- $required_flag {
++ target -
++ xfail {
++ error "misplaced $required_flag in check-function-bodies"
++ }
++ }
++ }
++ foreach required_flag $required_flags {
++ if { ![regexp " $required_flag " $flags] } {
++ return
++ }
++ }
++ }
++
++ set xfail_all 0
++ if { [llength $args] >= 4 } {
++ switch [dg-process-target [lindex $args 3]] {
++ "S" { }
++ "N" { return }
++ "F" { set xfail_all 1 }
++ "P" { }
++ }
++ }
++
++ set testcase [testname-for-summary]
++ # The name might include a list of options; extract the file name.
++ set filename [lindex $testcase 0]
++
++ global srcdir
++ set input_filename "$srcdir/$filename"
++ set output_filename "[file rootname [file tail $filename]].s"
++
++ set prefix [lindex $args 0]
++ set prefix_len [string length $prefix]
++ set terminator [lindex $args 1]
++ if { [string equal $terminator ""] } {
++ set terminator "*/"
++ }
++ set terminator_len [string length $terminator]
++
++ set have_bodies 0
++ if { [is_remote host] } {
++ remote_upload host "$filename"
++ }
++ if { [file exists $output_filename] } {
++ parse_function_bodies $output_filename functions
++ set have_bodies 1
++ } else {
++ verbose -log "$testcase: output file does not exist"
++ }
++
++ set count 0
++ set function_regexp ""
++ set label {^(\S+):$}
++
++ set lineno 1
++ set fd [open $input_filename r]
++ set in_function 0
++ while { [gets $fd line] >= 0 } {
++ if { [string equal -length $prefix_len $line $prefix] } {
++ set line [string trim [string range $line $prefix_len end]]
++ if { !$in_function } {
++ if { [regexp "^(.*?\\S)\\s+{(.*)}\$" $line dummy \
++ line selector] } {
++ set selector [dg-process-target $selector]
++ } else {
++ set selector "P"
++ }
++ if { ![regexp $label $line dummy function_name] } {
++ close $fd
++ error "check-function-bodies: line $lineno does not have a function label"
++ }
++ set in_function 1
++ set function_regexp ""
++ } elseif { [string equal $line "("] } {
++ append function_regexp "(?:"
++ } elseif { [string equal $line "|"] } {
++ append function_regexp "|"
++ } elseif { [string equal $line ")"] } {
++ append function_regexp ")"
++ } elseif { [string equal $line "..."] } {
++ append function_regexp ".*"
++ } else {
++ append function_regexp "\t" $line "\n"
++ }
++ } elseif { [string equal -length $terminator_len $line $terminator] } {
++ if { ![string equal $selector "N"] } {
++ if { $xfail_all || [string equal $selector "F"] } {
++ setup_xfail "*-*-*"
++ }
++ set testname "$testcase check-function-bodies $function_name"
++ if { !$have_bodies } {
++ unresolved $testname
++ } elseif { [check_function_body functions $function_name \
++ $function_regexp] } {
++ pass $testname
++ } else {
++ fail $testname
++ }
++ }
++ set in_function 0
++ incr count
++ }
++ incr lineno
++ }
++ close $fd
++ if { $in_function } {
++ error "check-function-bodies: missing \"$terminator\""
++ }
++ if { $count == 0 } {
++ error "check-function-bodies: no matches found"
++ }
++}
+--
+2.25.1
+
+
+From c2c772172f0478315ab94386ebf9963efd36eb75 Mon Sep 17 00:00:00 2001
+From: Richard Sandiford
+Date: Thu, 15 Jun 2023 19:16:52 +0100
+Subject: [PATCH 7/7] aarch64: Make stack smash canary protect saved registers
+To: gcc-patches@gcc.gnu.org
+
+AArch64 normally puts the saved registers near the bottom of the frame,
+immediately above any dynamic allocations. But this means that a
+stack-smash attack on those dynamic allocations could overwrite the
+saved registers without needing to reach as far as the stack smash
+canary.
+
+The same thing could also happen for variable-sized arguments that are
+passed by value, since those are allocated before a call and popped on
+return.
+
+This patch avoids that by putting the locals (and thus the canary) below
+the saved registers when stack smash protection is active.
+
+The patch fixes CVE-2023-4039.
+
+gcc/
+ * config/aarch64/aarch64.c (aarch64_save_regs_above_locals_p):
+ New function.
+ (aarch64_layout_frame): Use it to decide whether locals should
+ go above or below the saved registers.
+ (aarch64_expand_prologue): Update stack layout comment.
+ Emit a stack tie after the final adjustment.
+
+gcc/testsuite/
+ * gcc.target/aarch64/stack-protector-8.c: New test.
+ * gcc.target/aarch64/stack-protector-9.c: Likewise.
+---
+ gcc/config/aarch64/aarch64.c | 45 +++++++++-
+ .../gcc.target/aarch64/stack-protector-8.c | 86 +++++++++++++++++++
+ .../gcc.target/aarch64/stack-protector-9.c | 33 +++++++
+ 3 files changed, 161 insertions(+), 3 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.target/aarch64/stack-protector-8.c
+ create mode 100644 gcc/testsuite/gcc.target/aarch64/stack-protector-9.c
+
+diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
+index e3c36abb1e3..8708b4fe4ea 100644
+--- a/gcc/config/aarch64/aarch64.c
++++ b/gcc/config/aarch64/aarch64.c
+@@ -2780,6 +2780,20 @@ aarch64_frame_pointer_required (void)
+ return false;
+ }
+
++/* Return true if the current function should save registers above
++ the locals area, rather than below it. */
++
++static bool
++aarch64_save_regs_above_locals_p ()
++{
++ /* When using stack smash protection, make sure that the canary slot
++ comes between the locals and the saved registers. Otherwise,
++ it would be possible for a carefully sized smash attack to change
++ the saved registers (particularly LR and FP) without reaching the
++ canary. */
++ return crtl->stack_protect_guard;
++}
++
+ /* Mark the registers that need to be saved by the callee and calculate
+ the size of the callee-saved registers area and frame record (both FP
+ and LR may be omitted). */
+@@ -2828,6 +2842,16 @@ aarch64_layout_frame (void)
+
+ cfun->machine->frame.bytes_below_hard_fp = crtl->outgoing_args_size;
+
++ bool regs_at_top_p = aarch64_save_regs_above_locals_p ();
++
++ if (regs_at_top_p)
++ {
++ cfun->machine->frame.bytes_below_hard_fp += get_frame_size ();
++ cfun->machine->frame.bytes_below_hard_fp
++ = ROUND_UP (cfun->machine->frame.bytes_below_hard_fp,
++ STACK_BOUNDARY / BITS_PER_UNIT);
++ }
++
+ if (frame_pointer_needed)
+ {
+ /* FP and LR are placed in the linkage record. */
+@@ -2881,8 +2905,11 @@ aarch64_layout_frame (void)
+ HOST_WIDE_INT varargs_and_saved_regs_size
+ = offset + cfun->machine->frame.saved_varargs_size;
+
++ cfun->machine->frame.bytes_above_hard_fp = varargs_and_saved_regs_size;
++ if (!regs_at_top_p)
++ cfun->machine->frame.bytes_above_hard_fp += get_frame_size ();
+ cfun->machine->frame.bytes_above_hard_fp
+- = ROUND_UP (varargs_and_saved_regs_size + get_frame_size (),
++ = ROUND_UP (cfun->machine->frame.bytes_above_hard_fp,
+ STACK_BOUNDARY / BITS_PER_UNIT);
+
+ cfun->machine->frame.frame_size
+@@ -2892,6 +2919,9 @@ aarch64_layout_frame (void)
+
+ cfun->machine->frame.bytes_above_locals
+ = cfun->machine->frame.saved_varargs_size;
++ if (regs_at_top_p)
++ cfun->machine->frame.bytes_above_locals
++ += cfun->machine->frame.saved_regs_size;
+
+ cfun->machine->frame.initial_adjust = 0;
+ cfun->machine->frame.final_adjust = 0;
+@@ -3537,10 +3567,10 @@ aarch64_set_handled_components (sbitmap components)
+ | for register varargs |
+ | |
+ +-------------------------------+
+- | local variables | <-- frame_pointer_rtx
++ | local variables (1) | <-- frame_pointer_rtx
+ | |
+ +-------------------------------+
+- | padding0 | \
++ | padding (1) | \
+ +-------------------------------+ |
+ | callee-saved registers | | frame.saved_regs_size
+ +-------------------------------+ |
+@@ -3548,6 +3578,10 @@ aarch64_set_handled_components (sbitmap components)
+ +-------------------------------+ |
+ | FP' | / <- hard_frame_pointer_rtx (aligned)
+ +-------------------------------+
++ | local variables (2) |
++ +-------------------------------+
++ | padding (2) |
++ +-------------------------------+
+ | dynamic allocation |
+ +-------------------------------+
+ | padding |
+@@ -3557,6 +3591,9 @@ aarch64_set_handled_components (sbitmap components)
+ +-------------------------------+
+ | | <-- stack_pointer_rtx (aligned)
+
++ The regions marked (1) and (2) are mutually exclusive. (2) is used
++ when aarch64_save_regs_above_locals_p is true.
++
+ Dynamic stack allocations via alloca() decrease stack_pointer_rtx
+ but leave frame_pointer_rtx and hard_frame_pointer_rtx
+ unchanged. */
+@@ -3626,6 +3663,8 @@ aarch64_expand_prologue (void)
+ aarch64_save_callee_saves (DFmode, callee_offset, V0_REGNUM, V31_REGNUM,
+ callee_adjust != 0 || frame_pointer_needed);
+ aarch64_sub_sp (IP1_REGNUM, final_adjust, !frame_pointer_needed);
++ if (frame_pointer_needed && final_adjust != 0)
++ emit_insn (gen_stack_tie (stack_pointer_rtx, hard_frame_pointer_rtx));
+ }
+
+ /* Return TRUE if we can use a simple_return insn.
+diff --git a/gcc/testsuite/gcc.target/aarch64/stack-protector-8.c b/gcc/testsuite/gcc.target/aarch64/stack-protector-8.c
+new file mode 100644
+index 00000000000..2575abbec73
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/aarch64/stack-protector-8.c
+@@ -0,0 +1,86 @@
++/* { dg-options " -O -fstack-protector-strong" } */
++/* { dg-final { check-function-bodies "**" "" } } */
++
++void g(void *);
++
++/*
++** test1:
++** sub sp, sp, #304
++** stp x29, x30, \[sp, #?272\]
++** add x29, sp, #?272
++** str (x[0-9]+), \[sp, #?288\]
++** ...
++** ldr (x[0-9]+), \[\1\]
++** str \2, \[(?:sp, #?264|x29, #?-8)\]
++** mov \2, *0
++** (
++** add x0, sp, #?8
++** |
++** sub x0, x29, #?264
++** )
++** bl g
++** ...
++** ldr x[0-9]+, \[\1\]
++** ...
++** (
++** bne .*
++** |
++** cbnz .*
++** )
++** ...
++** ldr \1, \[sp, #?288\]
++** ldp x29, x30, \[sp, #?272\]
++** add sp, sp, #?304
++** ret
++** bl __stack_chk_fail
++*/
++int test1() {
++ int y[0x40];
++ g(y);
++ return 1;
++}
++
++/*
++** test2:
++** stp x29, x30, \[sp, #?-32\]!
++** (
++** mov x29, sp
++** |
++** add x29, sp, #?0
++** )
++** str (x[0-9]+), \[sp, #?16\]
++** sub sp, sp, #1040
++** ...
++** ldr (x[0-9]+), \[\1\]
++** str \2, \[(?:sp, #?1032|x29, #?-8)\]
++** mov \2, *0
++** (
++** add x0, sp, #?8
++** |
++** sub x0, x29, #?1032
++** )
++** bl g
++** ...
++** ldr x[0-9]+, \[\1\]
++** ...
++** (
++** bne .*
++** |
++** cbnz .*
++** )
++** ...
++** (
++** add sp, sp, #?1040
++** |
++** add sp, x29, #?0
++** )
++** ldr \1, \[sp, #?16\]
++** ldp x29, x30, \[sp\], #?32
++** ret
++** bl __stack_chk_fail
++*/
++int test2() {
++ int y[0x100];
++ g(y);
++ return 1;
++}
+diff --git a/gcc/testsuite/gcc.target/aarch64/stack-protector-9.c b/gcc/testsuite/gcc.target/aarch64/stack-protector-9.c
+new file mode 100644
+index 00000000000..1d267343806
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/aarch64/stack-protector-9.c
+@@ -0,0 +1,33 @@
++/* { dg-options "-O2 -mcpu=cortex-a73 -fstack-protector-all" } */
++/* { dg-final { check-function-bodies "**" "" } } */
++
++/*
++** main:
++** ...
++** stp x29, x30, \[sp, #?-[0-9]+\]!
++** ...
++** sub sp, sp, #[0-9]+
++** ...
++** str x[0-9]+, \[x29, #?-8\]
++** ...
++*/
++int f(const char *);
++void g(void *);
++int main(int argc, char* argv[])
++{
++ int a;
++ int b;
++ char c[2+f(argv[1])];
++ int d[0x100];
++ char y;
++
++ y=42; a=4; b=10;
++ c[0] = 'h'; c[1] = '\0';
++
++ c[f(argv[2])] = '\0';
++
++ __builtin_printf("%d %d\n%s\n", a, b, c);
++ g(d);
++
++ return 0;
++}
+--
+2.25.1
+
diff --git a/gcc7-aarch64-moutline-atomics.patch b/gcc7-aarch64-moutline-atomics.patch
new file mode 100644
index 0000000..33cf2d6
--- /dev/null
+++ b/gcc7-aarch64-moutline-atomics.patch
@@ -0,0 +1,4298 @@
+From 56c60ff0b1ee5d15e9e1673eddda6cb450e4253c Mon Sep 17 00:00:00 2001
+From: Kyrylo Tkachov
+Date: Tue, 6 Jun 2017 13:26:46 +0000
+Subject: [PATCH 01/24] Allow const0_rtx operand for atomic compare-exchange
+ patterns
+To: gcc-patches@gcc.gnu.org
+
+2017-06-06 Kyrylo Tkachov
+
+gcc/
+ * config/aarch64/atomics.md (atomic_compare_and_swap expander):
+ Use aarch64_reg_or_zero predicate for operand 4.
+ (aarch64_compare_and_swap define_insn_and_split):
+ Use aarch64_reg_or_zero predicate for operand 3. Add 'Z' constraint.
+ (aarch64_store_exclusive): Likewise for operand 2.
+
+gcc/testsuite/
+ * gcc.target/aarch64/atomic_cmp_exchange_zero_reg_1.c: New test.
+
+(cherry picked from commit 4ebcc903bf03705099cd4b50231dc8fe444d70b9)
+---
+ gcc/config/aarch64/atomics.md | 8 ++++----
+ .../aarch64/atomic_cmp_exchange_zero_reg_1.c | 12 ++++++++++++
+ 2 files changed, 16 insertions(+), 4 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.target/aarch64/atomic_cmp_exchange_zero_reg_1.c
+
+diff --git a/gcc/config/aarch64/atomics.md b/gcc/config/aarch64/atomics.md
+index 09d441075f0..27fc1933ce3 100644
+--- a/gcc/config/aarch64/atomics.md
++++ b/gcc/config/aarch64/atomics.md
+@@ -25,7 +25,7 @@
+ (match_operand:ALLI 1 "register_operand" "") ;; val out
+ (match_operand:ALLI 2 "aarch64_sync_memory_operand" "") ;; memory
+ (match_operand:ALLI 3 "general_operand" "") ;; expected
+- (match_operand:ALLI 4 "register_operand" "") ;; desired
++ (match_operand:ALLI 4 "aarch64_reg_or_zero" "") ;; desired
+ (match_operand:SI 5 "const_int_operand") ;; is_weak
+ (match_operand:SI 6 "const_int_operand") ;; mod_s
+ (match_operand:SI 7 "const_int_operand")] ;; mod_f
+@@ -45,7 +45,7 @@
+ (set (match_dup 1)
+ (unspec_volatile:SHORT
+ [(match_operand:SI 2 "aarch64_plus_operand" "rI") ;; expected
+- (match_operand:SHORT 3 "register_operand" "r") ;; desired
++ (match_operand:SHORT 3 "aarch64_reg_or_zero" "rZ") ;; desired
+ (match_operand:SI 4 "const_int_operand") ;; is_weak
+ (match_operand:SI 5 "const_int_operand") ;; mod_s
+ (match_operand:SI 6 "const_int_operand")] ;; mod_f
+@@ -69,7 +69,7 @@
+ (set (match_dup 1)
+ (unspec_volatile:GPI
+ [(match_operand:GPI 2 "aarch64_plus_operand" "rI") ;; expect
+- (match_operand:GPI 3 "register_operand" "r") ;; desired
++ (match_operand:GPI 3 "aarch64_reg_or_zero" "rZ") ;; desired
+ (match_operand:SI 4 "const_int_operand") ;; is_weak
+ (match_operand:SI 5 "const_int_operand") ;; mod_s
+ (match_operand:SI 6 "const_int_operand")] ;; mod_f
+@@ -534,7 +534,7 @@
+ (unspec_volatile:SI [(const_int 0)] UNSPECV_SX))
+ (set (match_operand:ALLI 1 "aarch64_sync_memory_operand" "=Q")
+ (unspec_volatile:ALLI
+- [(match_operand:ALLI 2 "register_operand" "r")
++ [(match_operand:ALLI 2 "aarch64_reg_or_zero" "rZ")
+ (match_operand:SI 3 "const_int_operand")]
+ UNSPECV_SX))]
+ ""
+diff --git a/gcc/testsuite/gcc.target/aarch64/atomic_cmp_exchange_zero_reg_1.c b/gcc/testsuite/gcc.target/aarch64/atomic_cmp_exchange_zero_reg_1.c
+new file mode 100644
+index 00000000000..15606b68990
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/aarch64/atomic_cmp_exchange_zero_reg_1.c
+@@ -0,0 +1,12 @@
++/* { dg-do compile } */
++/* { dg-options "-O2" } */
++
++int
++foo (int *a)
++{
++ int x = 3;
++ return __atomic_compare_exchange_n (a, &x, 0, 1, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);
++}
++
++/* { dg-final { scan-assembler "stxr\\tw\[0-9\]+, wzr,.*" } } */
++/* { dg-final { scan-assembler-not "mov\\tw\[0-9\]+, 0" } } */
+--
+2.26.2
+
+
+From b8e2b779d1815147073e9dcb04a1f8f9d96b1a62 Mon Sep 17 00:00:00 2001
+From: Ramana Radhakrishnan
+Date: Mon, 16 Jul 2018 09:03:48 +0000
+Subject: [PATCH 02/24] Add early clobber for aarch64_store_exclusive.
+To: gcc-patches@gcc.gnu.org
+
+2018-07-16 Ramana Radhakrishnan
+
+gcc/
+ * config/aarch64/atomics.md (aarch64_store_execlusive): Add
+ early clobber.
+
+(cherry picked from commit 1d896f48fa2f796ba13773ab735ef40fa3afb257)
+---
+ gcc/config/aarch64/atomics.md | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gcc/config/aarch64/atomics.md b/gcc/config/aarch64/atomics.md
+index 27fc1933ce3..eb4b95c2453 100644
+--- a/gcc/config/aarch64/atomics.md
++++ b/gcc/config/aarch64/atomics.md
+@@ -530,7 +530,7 @@
+ )
+
+ (define_insn "aarch64_store_exclusive"
+- [(set (match_operand:SI 0 "register_operand" "=r")
++ [(set (match_operand:SI 0 "register_operand" "=&r")
+ (unspec_volatile:SI [(const_int 0)] UNSPECV_SX))
+ (set (match_operand:ALLI 1 "aarch64_sync_memory_operand" "=Q")
+ (unspec_volatile:ALLI
+--
+2.26.2
+
+
+From 03ffcedc78870eaf89e0f45b3d7a2e3af003e45a Mon Sep 17 00:00:00 2001
+From: Richard Henderson
+Date: Wed, 31 Oct 2018 09:29:29 +0000
+Subject: [PATCH 03/24] aarch64: Simplify LSE cas generation
+To: gcc-patches@gcc.gnu.org
+
+The cas insn is a single insn, and if expanded properly need not
+be split after reload. Use the proper inputs for the insn.
+
+2018-10-31 Richard Henderson
+
+gcc/
+ * config/aarch64/aarch64.c (aarch64_expand_compare_and_swap):
+ Force oldval into the rval register for TARGET_LSE; emit the compare
+ during initial expansion so that it may be deleted if unused.
+ (aarch64_gen_atomic_cas): Remove.
+ * config/aarch64/atomics.md (@aarch64_compare_and_swap_lse):
+ Change =&r to +r for operand 0; use match_dup for operand 2;
+ remove is_weak and mod_f operands as unused. Drop the split
+ and merge with...
+ (@aarch64_atomic_cas): ... this pattern's output; remove.
+ (@aarch64_compare_and_swap_lse): Similarly.
+ (@aarch64_atomic_cas): Similarly.
+
+(cherry picked from commit 77f33f44baf24c22848197aa80962c003dd7b3e2)
+---
+ gcc/config/aarch64/aarch64-protos.h | 1 -
+ gcc/config/aarch64/aarch64.c | 62 ++++--------
+ gcc/config/aarch64/atomics.md | 143 +++++++++-------------------
+ 3 files changed, 63 insertions(+), 143 deletions(-)
+
+diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
+index 9543f8c9f29..e25f9833af4 100644
+--- a/gcc/config/aarch64/aarch64-protos.h
++++ b/gcc/config/aarch64/aarch64-protos.h
+@@ -425,7 +425,6 @@ rtx aarch64_load_tp (rtx);
+
+ void aarch64_expand_compare_and_swap (rtx op[]);
+ void aarch64_split_compare_and_swap (rtx op[]);
+-void aarch64_gen_atomic_cas (rtx, rtx, rtx, rtx, rtx);
+
+ bool aarch64_atomic_ldop_supported_p (enum rtx_code);
+ void aarch64_gen_atomic_ldop (enum rtx_code, rtx, rtx, rtx, rtx, rtx);
+diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
+index 05eaef3d2e6..c03d0ff9b40 100644
+--- a/gcc/config/aarch64/aarch64.c
++++ b/gcc/config/aarch64/aarch64.c
+@@ -11865,7 +11865,6 @@ aarch64_expand_compare_and_swap (rtx operands[])
+ machine_mode mode, cmp_mode;
+ typedef rtx (*gen_cas_fn) (rtx, rtx, rtx, rtx, rtx, rtx, rtx);
+ int idx;
+- gen_cas_fn gen;
+ const gen_cas_fn split_cas[] =
+ {
+ gen_aarch64_compare_and_swapqi,
+@@ -11873,7 +11872,8 @@ aarch64_expand_compare_and_swap (rtx operands[])
+ gen_aarch64_compare_and_swapsi,
+ gen_aarch64_compare_and_swapdi
+ };
+- const gen_cas_fn atomic_cas[] =
++ typedef rtx (*gen_lse_fn) (rtx, rtx, rtx, rtx);
++ const gen_lse_fn atomic_cas[] =
+ {
+ gen_aarch64_compare_and_swapqi_lse,
+ gen_aarch64_compare_and_swaphi_lse,
+@@ -11932,14 +11932,26 @@ aarch64_expand_compare_and_swap (rtx operands[])
+ gcc_unreachable ();
+ }
+ if (TARGET_LSE)
+- gen = atomic_cas[idx];
++ {
++ /* The CAS insn requires oldval and rval overlap, but we need to
++ have a copy of oldval saved across the operation to tell if
++ the operation is successful. */
++ if (mode == QImode || mode == HImode)
++ rval = copy_to_mode_reg (SImode, gen_lowpart (SImode, oldval));
++ else if (reg_overlap_mentioned_p (rval, oldval))
++ rval = copy_to_mode_reg (mode, oldval);
++ else
++ emit_move_insn (rval, oldval);
++ emit_insn (atomic_cas[idx] (rval, mem, newval, mod_s));
++ aarch64_gen_compare_reg (EQ, rval, oldval);
++ }
+ else
+- gen = split_cas[idx];
+-
+- emit_insn (gen (rval, mem, oldval, newval, is_weak, mod_s, mod_f));
++ emit_insn (split_cas[idx] (rval, mem, oldval, newval, is_weak, mod_s,
++ mod_f));
+
+ if (mode == QImode || mode == HImode)
+- emit_move_insn (operands[1], gen_lowpart (mode, rval));
++ rval = gen_lowpart (mode, rval);
++ emit_move_insn (operands[1], rval);
+
+ x = gen_rtx_REG (CCmode, CC_REGNUM);
+ x = gen_rtx_EQ (SImode, x, const0_rtx);
+@@ -11989,42 +12001,6 @@ aarch64_emit_post_barrier (enum memmodel model)
+ }
+ }
+
+-/* Emit an atomic compare-and-swap operation. RVAL is the destination register
+- for the data in memory. EXPECTED is the value expected to be in memory.
+- DESIRED is the value to store to memory. MEM is the memory location. MODEL
+- is the memory ordering to use. */
+-
+-void
+-aarch64_gen_atomic_cas (rtx rval, rtx mem,
+- rtx expected, rtx desired,
+- rtx model)
+-{
+- rtx (*gen) (rtx, rtx, rtx, rtx);
+- machine_mode mode;
+-
+- mode = GET_MODE (mem);
+-
+- switch (mode)
+- {
+- case QImode: gen = gen_aarch64_atomic_casqi; break;
+- case HImode: gen = gen_aarch64_atomic_cashi; break;
+- case SImode: gen = gen_aarch64_atomic_cassi; break;
+- case DImode: gen = gen_aarch64_atomic_casdi; break;
+- default:
+- gcc_unreachable ();
+- }
+-
+- /* Move the expected value into the CAS destination register. */
+- emit_insn (gen_rtx_SET (rval, expected));
+-
+- /* Emit the CAS. */
+- emit_insn (gen (rval, mem, desired, model));
+-
+- /* Compare the expected value with the value loaded by the CAS, to establish
+- whether the swap was made. */
+- aarch64_gen_compare_reg (EQ, rval, expected);
+-}
+-
+ /* Split a compare and swap pattern. */
+
+ void
+diff --git a/gcc/config/aarch64/atomics.md b/gcc/config/aarch64/atomics.md
+index eb4b95c2453..713aec618a2 100644
+--- a/gcc/config/aarch64/atomics.md
++++ b/gcc/config/aarch64/atomics.md
+@@ -85,56 +85,50 @@
+ }
+ )
+
+-(define_insn_and_split "aarch64_compare_and_swap_lse"
+- [(set (reg:CC CC_REGNUM) ;; bool out
+- (unspec_volatile:CC [(const_int 0)] UNSPECV_ATOMIC_CMPSW))
+- (set (match_operand:SI 0 "register_operand" "=&r") ;; val out
+- (zero_extend:SI
+- (match_operand:SHORT 1 "aarch64_sync_memory_operand" "+Q"))) ;; memory
+- (set (match_dup 1)
+- (unspec_volatile:SHORT
+- [(match_operand:SI 2 "aarch64_plus_operand" "rI") ;; expected
+- (match_operand:SHORT 3 "register_operand" "r") ;; desired
+- (match_operand:SI 4 "const_int_operand") ;; is_weak
+- (match_operand:SI 5 "const_int_operand") ;; mod_s
+- (match_operand:SI 6 "const_int_operand")] ;; mod_f
+- UNSPECV_ATOMIC_CMPSW))]
+- "TARGET_LSE"
+- "#"
+- "&& reload_completed"
+- [(const_int 0)]
+- {
+- aarch64_gen_atomic_cas (operands[0], operands[1],
+- operands[2], operands[3],
+- operands[5]);
+- DONE;
+- }
+-)
+-
+-(define_insn_and_split "aarch64_compare_and_swap_lse"
+- [(set (reg:CC CC_REGNUM) ;; bool out
+- (unspec_volatile:CC [(const_int 0)] UNSPECV_ATOMIC_CMPSW))
+- (set (match_operand:GPI 0 "register_operand" "=&r") ;; val out
+- (match_operand:GPI 1 "aarch64_sync_memory_operand" "+Q")) ;; memory
+- (set (match_dup 1)
+- (unspec_volatile:GPI
+- [(match_operand:GPI 2 "aarch64_plus_operand" "rI") ;; expect
+- (match_operand:GPI 3 "register_operand" "r") ;; desired
+- (match_operand:SI 4 "const_int_operand") ;; is_weak
+- (match_operand:SI 5 "const_int_operand") ;; mod_s
+- (match_operand:SI 6 "const_int_operand")] ;; mod_f
+- UNSPECV_ATOMIC_CMPSW))]
+- "TARGET_LSE"
+- "#"
+- "&& reload_completed"
+- [(const_int 0)]
+- {
+- aarch64_gen_atomic_cas (operands[0], operands[1],
+- operands[2], operands[3],
+- operands[5]);
+- DONE;
+- }
+-)
++(define_insn "aarch64_compare_and_swap_lse"
++ [(set (match_operand:SI 0 "register_operand" "+r") ;; val out
++ (zero_extend:SI
++ (match_operand:SHORT 1 "aarch64_sync_memory_operand" "+Q"))) ;; memory
++ (set (match_dup 1)
++ (unspec_volatile:SHORT
++ [(match_dup 0) ;; expected
++ (match_operand:SHORT 2 "aarch64_reg_or_zero" "rZ") ;; desired
++ (match_operand:SI 3 "const_int_operand")] ;; mod_s
++ UNSPECV_ATOMIC_CMPSW))]
++ "TARGET_LSE"
++{
++ enum memmodel model = memmodel_from_int (INTVAL (operands[3]));
++ if (is_mm_relaxed (model))
++ return "cas\t%0, %2, %1";
++ else if (is_mm_acquire (model) || is_mm_consume (model))
++ return "casa\t%0, %2, %1";
++ else if (is_mm_release (model))
++ return "casl\t%0, %2, %1";
++ else
++ return "casal\t%0, %2, %1";
++})
++
++(define_insn "aarch64_compare_and_swap_lse"
++ [(set (match_operand:GPI 0 "register_operand" "+r") ;; val out
++ (match_operand:GPI 1 "aarch64_sync_memory_operand" "+Q")) ;; memory
++ (set (match_dup 1)
++ (unspec_volatile:GPI
++ [(match_dup 0) ;; expected
++ (match_operand:GPI 2 "aarch64_reg_or_zero" "rZ") ;; desired
++ (match_operand:SI 3 "const_int_operand")] ;; mod_s
++ UNSPECV_ATOMIC_CMPSW))]
++ "TARGET_LSE"
++{
++ enum memmodel model = memmodel_from_int (INTVAL (operands[3]));
++ if (is_mm_relaxed (model))
++ return "cas\t%0, %2, %1";
++ else if (is_mm_acquire (model) || is_mm_consume (model))
++ return "casa\t%0, %2, %1";
++ else if (is_mm_release (model))
++ return "casl\t%0, %2, %1";
++ else
++ return "casal\t%0, %2, %1";
++})
+
+ (define_expand "atomic_exchange"
+ [(match_operand:ALLI 0 "register_operand" "")
+@@ -607,55 +601,6 @@
+ return "swpal\t%2, %0, %1";
+ })
+
+-;; Atomic compare-and-swap: HI and smaller modes.
+-
+-(define_insn "aarch64_atomic_cas"
+- [(set (match_operand:SI 0 "register_operand" "+&r") ;; out
+- (zero_extend:SI
+- (match_operand:SHORT 1 "aarch64_sync_memory_operand" "+Q"))) ;; memory.
+- (set (match_dup 1)
+- (unspec_volatile:SHORT
+- [(match_dup 0)
+- (match_operand:SHORT 2 "register_operand" "r") ;; value.
+- (match_operand:SI 3 "const_int_operand" "")] ;; model.
+- UNSPECV_ATOMIC_CAS))]
+- "TARGET_LSE && reload_completed"
+-{
+- enum memmodel model = memmodel_from_int (INTVAL (operands[3]));
+- if (is_mm_relaxed (model))
+- return "cas\t%0, %2, %1";
+- else if (is_mm_acquire (model) || is_mm_consume (model))
+- return "casa\t%0, %2, %1";
+- else if (is_mm_release (model))
+- return "casl\t%0, %2, %1";
+- else
+- return "casal\t%0, %2, %1";
+-})
+-
+-;; Atomic compare-and-swap: SI and larger modes.
+-
+-(define_insn "aarch64_atomic_cas"
+- [(set (match_operand:GPI 0 "register_operand" "+&r") ;; out
+- (match_operand:GPI 1 "aarch64_sync_memory_operand" "+Q")) ;; memory.
+- (set (match_dup 1)
+- (unspec_volatile:GPI
+- [(match_dup 0)
+- (match_operand:GPI 2 "register_operand" "r") ;; value.
+- (match_operand:SI 3 "const_int_operand" "")] ;; model.
+- UNSPECV_ATOMIC_CAS))]
+- "TARGET_LSE && reload_completed"
+-{
+- enum memmodel model = memmodel_from_int (INTVAL (operands[3]));
+- if (is_mm_relaxed (model))
+- return "cas\t%0, %2, %1";
+- else if (is_mm_acquire (model) || is_mm_consume (model))
+- return "casa\t%0, %2, %1";
+- else if (is_mm_release (model))
+- return "casl\t%0, %2, %1";
+- else
+- return "casal\t%0, %2, %1";
+-})
+-
+ ;; Atomic load-op: Load data, operate, store result, keep data.
+
+ (define_insn "aarch64_atomic_load"
+--
+2.26.2
+
+
+From 19c478bafa944772683d4fdf6a4be962b9fb5d7e Mon Sep 17 00:00:00 2001
+From: Kyrylo Tkachov
+Date: Fri, 2 Jun 2017 14:41:52 +0000
+Subject: [PATCH 04/24] Emit tighter strong atomic compare-exchange loop when
+ comparing against zero
+To: gcc-patches@gcc.gnu.org
+
+2017-06-02 Kyrylo Tkachov
+
+gcc/
+ * config/aarch64/aarch64.c (aarch64_split_compare_and_swap):
+ Emit CBNZ inside loop when doing a strong exchange and comparing
+ against zero. Generate the CC flags after the loop.
+
+gcc/testsuite/
+ * gcc.target/aarch64/atomic_cmp_exchange_zero_strong_1.c: New test.
+
+(cherry picked from commit 17f47f8621099fdc4b0fc6681924f97230c8a114)
+---
+ gcc/config/aarch64/aarch64.c | 41 ++++++++++++++++---
+ .../atomic_cmp_exchange_zero_strong_1.c | 12 ++++++
+ 2 files changed, 47 insertions(+), 6 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.target/aarch64/atomic_cmp_exchange_zero_strong_1.c
+
+diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
+index c03d0ff9b40..c2789665728 100644
+--- a/gcc/config/aarch64/aarch64.c
++++ b/gcc/config/aarch64/aarch64.c
+@@ -12024,6 +12024,17 @@ aarch64_split_compare_and_swap (rtx operands[])
+ mode = GET_MODE (mem);
+ model = memmodel_from_int (INTVAL (model_rtx));
+
++ /* When OLDVAL is zero and we want the strong version we can emit a tighter
++ loop:
++ .label1:
++ LD[A]XR rval, [mem]
++ CBNZ rval, .label2
++ ST[L]XR scratch, newval, [mem]
++ CBNZ scratch, .label1
++ .label2:
++ CMP rval, 0. */
++ bool strong_zero_p = !is_weak && oldval == const0_rtx;
++
+ label1 = NULL;
+ if (!is_weak)
+ {
+@@ -12040,11 +12051,21 @@ aarch64_split_compare_and_swap (rtx operands[])
+ else
+ aarch64_emit_load_exclusive (mode, rval, mem, model_rtx);
+
+- cond = aarch64_gen_compare_reg (NE, rval, oldval);
+- x = gen_rtx_NE (VOIDmode, cond, const0_rtx);
+- x = gen_rtx_IF_THEN_ELSE (VOIDmode, x,
+- gen_rtx_LABEL_REF (Pmode, label2), pc_rtx);
+- aarch64_emit_unlikely_jump (gen_rtx_SET (pc_rtx, x));
++ if (strong_zero_p)
++ {
++ x = gen_rtx_NE (VOIDmode, rval, const0_rtx);
++ x = gen_rtx_IF_THEN_ELSE (VOIDmode, x,
++ gen_rtx_LABEL_REF (Pmode, label2), pc_rtx);
++ aarch64_emit_unlikely_jump (gen_rtx_SET (pc_rtx, x));
++ }
++ else
++ {
++ cond = aarch64_gen_compare_reg (NE, rval, oldval);
++ x = gen_rtx_NE (VOIDmode, cond, const0_rtx);
++ x = gen_rtx_IF_THEN_ELSE (VOIDmode, x,
++ gen_rtx_LABEL_REF (Pmode, label2), pc_rtx);
++ aarch64_emit_unlikely_jump (gen_rtx_SET (pc_rtx, x));
++ }
+
+ aarch64_emit_store_exclusive (mode, scratch, mem, newval, model_rtx);
+
+@@ -12063,7 +12084,15 @@ aarch64_split_compare_and_swap (rtx operands[])
+ }
+
+ emit_label (label2);
+-
++ /* If we used a CBNZ in the exchange loop emit an explicit compare with RVAL
++ to set the condition flags. If this is not used it will be removed by
++ later passes. */
++ if (strong_zero_p)
++ {
++ cond = gen_rtx_REG (CCmode, CC_REGNUM);
++ x = gen_rtx_COMPARE (CCmode, rval, const0_rtx);
++ emit_insn (gen_rtx_SET (cond, x));
++ }
+ /* Emit any final barrier needed for a __sync operation. */
+ if (is_mm_sync (model))
+ aarch64_emit_post_barrier (model);
+diff --git a/gcc/testsuite/gcc.target/aarch64/atomic_cmp_exchange_zero_strong_1.c b/gcc/testsuite/gcc.target/aarch64/atomic_cmp_exchange_zero_strong_1.c
+new file mode 100644
+index 00000000000..b14a7c29437
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/aarch64/atomic_cmp_exchange_zero_strong_1.c
+@@ -0,0 +1,12 @@
++/* { dg-do compile } */
++/* { dg-options "-O2" } */
++
++int
++foo (int *a)
++{
++ int x = 0;
++ return __atomic_compare_exchange_n (a, &x, 4, 0,
++ __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);
++}
++
++/* { dg-final { scan-assembler-times "cbnz\\tw\[0-9\]+" 2 } } */
+--
+2.26.2
+
+
+From 1b90e5f91c930b124f1d4940b515a7ea64809904 Mon Sep 17 00:00:00 2001
+From: Richard Henderson
+Date: Wed, 31 Oct 2018 09:42:39 +0000
+Subject: [PATCH 05/24] aarch64: Improve cas generation
+To: gcc-patches@gcc.gnu.org
+
+Do not zero-extend the input to the cas for subword operations;
+instead, use the appropriate zero-extending compare insns.
+Correct the predicates and constraints for immediate expected operand.
+
+2018-10-31 Richard Henderson
+
+gcc/
+ * config/aarch64/aarch64.c (aarch64_gen_compare_reg_maybe_ze): New.
+ (aarch64_split_compare_and_swap): Use it.
+ (aarch64_expand_compare_and_swap): Likewise. Remove convert_modes;
+ test oldval against the proper predicate.
+ * config/aarch64/atomics.md (@atomic_compare_and_swap):
+ Use nonmemory_operand for expected.
+ (cas_short_expected_pred): New.
+ (@aarch64_compare_and_swap): Use it; use "rn" not "rI" to match.
+ (@aarch64_compare_and_swap): Use "rn" not "rI" for expected.
+ * config/aarch64/predicates.md (aarch64_plushi_immediate): New.
+ (aarch64_plushi_operand): New.
+
+(cherry picked from commit d400fda3a8c3330f77eb9d51874f5482d3819a9f)
+---
+ gcc/config/aarch64/aarch64.c | 97 ++++++++++++++++++++------------
+ gcc/config/aarch64/atomics.md | 19 ++++---
+ gcc/config/aarch64/predicates.md | 12 ++++
+ 3 files changed, 84 insertions(+), 44 deletions(-)
+
+diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
+index c2789665728..afde9e291f9 100644
+--- a/gcc/config/aarch64/aarch64.c
++++ b/gcc/config/aarch64/aarch64.c
+@@ -1198,6 +1198,33 @@ aarch64_gen_compare_reg (RTX_CODE code, rtx x, rtx y)
+ return cc_reg;
+ }
+
++/* Similarly, but maybe zero-extend Y if Y_MODE < SImode. */
++
++static rtx
++aarch64_gen_compare_reg_maybe_ze (RTX_CODE code, rtx x, rtx y,
++ machine_mode y_mode)
++{
++ if (y_mode == QImode || y_mode == HImode)
++ {
++ if (CONST_INT_P (y))
++ y = GEN_INT (INTVAL (y) & GET_MODE_MASK (y_mode));
++ else
++ {
++ rtx t, cc_reg;
++ machine_mode cc_mode;
++
++ t = gen_rtx_ZERO_EXTEND (SImode, y);
++ t = gen_rtx_COMPARE (CC_SWPmode, t, x);
++ cc_mode = CC_SWPmode;
++ cc_reg = gen_rtx_REG (cc_mode, CC_REGNUM);
++ emit_set_insn (cc_reg, t);
++ return cc_reg;
++ }
++ }
++
++ return aarch64_gen_compare_reg (code, x, y);
++}
++
+ /* Build the SYMBOL_REF for __tls_get_addr. */
+
+ static GTY(()) rtx tls_get_addr_libfunc;
+@@ -11861,8 +11888,8 @@ aarch64_emit_unlikely_jump (rtx insn)
+ void
+ aarch64_expand_compare_and_swap (rtx operands[])
+ {
+- rtx bval, rval, mem, oldval, newval, is_weak, mod_s, mod_f, x;
+- machine_mode mode, cmp_mode;
++ rtx bval, rval, mem, oldval, newval, is_weak, mod_s, mod_f, x, cc_reg;
++ machine_mode mode, r_mode;
+ typedef rtx (*gen_cas_fn) (rtx, rtx, rtx, rtx, rtx, rtx, rtx);
+ int idx;
+ const gen_cas_fn split_cas[] =
+@@ -11890,36 +11917,19 @@ aarch64_expand_compare_and_swap (rtx operands[])
+ mod_s = operands[6];
+ mod_f = operands[7];
+ mode = GET_MODE (mem);
+- cmp_mode = mode;
+
+ /* Normally the succ memory model must be stronger than fail, but in the
+ unlikely event of fail being ACQUIRE and succ being RELEASE we need to
+ promote succ to ACQ_REL so that we don't lose the acquire semantics. */
+-
+ if (is_mm_acquire (memmodel_from_int (INTVAL (mod_f)))
+ && is_mm_release (memmodel_from_int (INTVAL (mod_s))))
+ mod_s = GEN_INT (MEMMODEL_ACQ_REL);
+
+- switch (mode)
++ r_mode = mode;
++ if (mode == QImode || mode == HImode)
+ {
+- case QImode:
+- case HImode:
+- /* For short modes, we're going to perform the comparison in SImode,
+- so do the zero-extension now. */
+- cmp_mode = SImode;
+- rval = gen_reg_rtx (SImode);
+- oldval = convert_modes (SImode, mode, oldval, true);
+- /* Fall through. */
+-
+- case SImode:
+- case DImode:
+- /* Force the value into a register if needed. */
+- if (!aarch64_plus_operand (oldval, mode))
+- oldval = force_reg (cmp_mode, oldval);
+- break;
+-
+- default:
+- gcc_unreachable ();
++ r_mode = SImode;
++ rval = gen_reg_rtx (r_mode);
+ }
+
+ switch (mode)
+@@ -11936,25 +11946,40 @@ aarch64_expand_compare_and_swap (rtx operands[])
+ /* The CAS insn requires oldval and rval overlap, but we need to
+ have a copy of oldval saved across the operation to tell if
+ the operation is successful. */
+- if (mode == QImode || mode == HImode)
+- rval = copy_to_mode_reg (SImode, gen_lowpart (SImode, oldval));
+- else if (reg_overlap_mentioned_p (rval, oldval))
+- rval = copy_to_mode_reg (mode, oldval);
++ if (reg_overlap_mentioned_p (rval, oldval))
++ rval = copy_to_mode_reg (r_mode, oldval);
+ else
+- emit_move_insn (rval, oldval);
++ emit_move_insn (rval, gen_lowpart (r_mode, oldval));
++
+ emit_insn (atomic_cas[idx] (rval, mem, newval, mod_s));
+- aarch64_gen_compare_reg (EQ, rval, oldval);
++ cc_reg = aarch64_gen_compare_reg_maybe_ze (NE, rval, oldval, mode);
+ }
+ else
+- emit_insn (split_cas[idx] (rval, mem, oldval, newval, is_weak, mod_s,
+- mod_f));
++ {
++ /* The oldval predicate varies by mode. Test it and force to reg. */
++ insn_code code;
++ switch (mode)
++ {
++ case QImode: code = CODE_FOR_aarch64_compare_and_swapqi; break;
++ case HImode: code = CODE_FOR_aarch64_compare_and_swaphi; break;
++ case SImode: code = CODE_FOR_aarch64_compare_and_swapsi; break;
++ case DImode: code = CODE_FOR_aarch64_compare_and_swapdi; break;
++ default:
++ gcc_unreachable ();
++ }
++ if (!insn_data[code].operand[2].predicate (oldval, mode))
++ oldval = force_reg (mode, oldval);
+
+- if (mode == QImode || mode == HImode)
++ emit_insn (split_cas[idx] (rval, mem, oldval, newval, is_weak, mod_s,
++ mod_f));
++ cc_reg = gen_rtx_REG (CCmode, CC_REGNUM);
++ }
++
++ if (r_mode != mode)
+ rval = gen_lowpart (mode, rval);
+ emit_move_insn (operands[1], rval);
+
+- x = gen_rtx_REG (CCmode, CC_REGNUM);
+- x = gen_rtx_EQ (SImode, x, const0_rtx);
++ x = gen_rtx_EQ (SImode, cc_reg, const0_rtx);
+ emit_insn (gen_rtx_SET (bval, x));
+ }
+
+@@ -12060,10 +12085,10 @@ aarch64_split_compare_and_swap (rtx operands[])
+ }
+ else
+ {
+- cond = aarch64_gen_compare_reg (NE, rval, oldval);
++ cond = aarch64_gen_compare_reg_maybe_ze (NE, rval, oldval, mode);
+ x = gen_rtx_NE (VOIDmode, cond, const0_rtx);
+ x = gen_rtx_IF_THEN_ELSE (VOIDmode, x,
+- gen_rtx_LABEL_REF (Pmode, label2), pc_rtx);
++ gen_rtx_LABEL_REF (Pmode, label2), pc_rtx);
+ aarch64_emit_unlikely_jump (gen_rtx_SET (pc_rtx, x));
+ }
+
+diff --git a/gcc/config/aarch64/atomics.md b/gcc/config/aarch64/atomics.md
+index 713aec618a2..577000fa6a4 100644
+--- a/gcc/config/aarch64/atomics.md
++++ b/gcc/config/aarch64/atomics.md
+@@ -24,8 +24,8 @@
+ [(match_operand:SI 0 "register_operand" "") ;; bool out
+ (match_operand:ALLI 1 "register_operand" "") ;; val out
+ (match_operand:ALLI 2 "aarch64_sync_memory_operand" "") ;; memory
+- (match_operand:ALLI 3 "general_operand" "") ;; expected
+- (match_operand:ALLI 4 "aarch64_reg_or_zero" "") ;; desired
++ (match_operand:ALLI 3 "nonmemory_operand" "") ;; expected
++ (match_operand:ALLI 4 "aarch64_reg_or_zero" "") ;; desired
+ (match_operand:SI 5 "const_int_operand") ;; is_weak
+ (match_operand:SI 6 "const_int_operand") ;; mod_s
+ (match_operand:SI 7 "const_int_operand")] ;; mod_f
+@@ -36,19 +36,22 @@
+ }
+ )
+
++(define_mode_attr cas_short_expected_pred
++ [(QI "aarch64_reg_or_imm") (HI "aarch64_plushi_operand")])
++
+ (define_insn_and_split "aarch64_compare_and_swap"
+ [(set (reg:CC CC_REGNUM) ;; bool out
+ (unspec_volatile:CC [(const_int 0)] UNSPECV_ATOMIC_CMPSW))
+- (set (match_operand:SI 0 "register_operand" "=&r") ;; val out
++ (set (match_operand:SI 0 "register_operand" "=&r") ;; val out
+ (zero_extend:SI
+ (match_operand:SHORT 1 "aarch64_sync_memory_operand" "+Q"))) ;; memory
+ (set (match_dup 1)
+ (unspec_volatile:SHORT
+- [(match_operand:SI 2 "aarch64_plus_operand" "rI") ;; expected
++ [(match_operand:SHORT 2 "" "rn") ;; expected
+ (match_operand:SHORT 3 "aarch64_reg_or_zero" "rZ") ;; desired
+- (match_operand:SI 4 "const_int_operand") ;; is_weak
+- (match_operand:SI 5 "const_int_operand") ;; mod_s
+- (match_operand:SI 6 "const_int_operand")] ;; mod_f
++ (match_operand:SI 4 "const_int_operand") ;; is_weak
++ (match_operand:SI 5 "const_int_operand") ;; mod_s
++ (match_operand:SI 6 "const_int_operand")] ;; mod_f
+ UNSPECV_ATOMIC_CMPSW))
+ (clobber (match_scratch:SI 7 "=&r"))]
+ ""
+@@ -68,7 +71,7 @@
+ (match_operand:GPI 1 "aarch64_sync_memory_operand" "+Q")) ;; memory
+ (set (match_dup 1)
+ (unspec_volatile:GPI
+- [(match_operand:GPI 2 "aarch64_plus_operand" "rI") ;; expect
++ [(match_operand:GPI 2 "aarch64_plus_operand" "rn") ;; expect
+ (match_operand:GPI 3 "aarch64_reg_or_zero" "rZ") ;; desired
+ (match_operand:SI 4 "const_int_operand") ;; is_weak
+ (match_operand:SI 5 "const_int_operand") ;; mod_s
+diff --git a/gcc/config/aarch64/predicates.md b/gcc/config/aarch64/predicates.md
+index e83d45b3945..20429e5d04c 100644
+--- a/gcc/config/aarch64/predicates.md
++++ b/gcc/config/aarch64/predicates.md
+@@ -86,6 +86,18 @@
+ (ior (match_operand 0 "register_operand")
+ (match_operand 0 "aarch64_plus_immediate")))
+
++(define_predicate "aarch64_plushi_immediate"
++ (match_code "const_int")
++{
++ HOST_WIDE_INT val = INTVAL (op);
++ /* The HImode value must be zero-extendable to an SImode plus_operand. */
++ return ((val & 0xfff) == val || sext_hwi (val & 0xf000, 16) == val);
++})
++
++(define_predicate "aarch64_plushi_operand"
++ (ior (match_operand 0 "register_operand")
++ (match_operand 0 "aarch64_plushi_immediate")))
++
+ (define_predicate "aarch64_pluslong_immediate"
+ (and (match_code "const_int")
+ (match_test "(INTVAL (op) < 0xffffff && INTVAL (op) > -0xffffff)")))
+--
+2.26.2
+
+
+From 585818b9697910d3c136db9805f129f4d735e28d Mon Sep 17 00:00:00 2001
+From: Richard Henderson
+Date: Wed, 31 Oct 2018 09:47:21 +0000
+Subject: [PATCH 06/24] aarch64: Improve swp generation
+To: gcc-patches@gcc.gnu.org
+
+Allow zero as an input; fix constraints; avoid unnecessary split.
+
+2018-10-31 Richard Henderson
+
+gcc/
+ * config/aarch64/aarch64.c (aarch64_emit_atomic_swap): Remove.
+ (aarch64_gen_atomic_ldop): Don't call it.
+ * config/aarch64/atomics.md (atomic_exchange):
+ Use aarch64_reg_or_zero.
+ (aarch64_atomic_exchange): Likewise.
+ (aarch64_atomic_exchange_lse): Remove split; remove & from
+ operand 0; use aarch64_reg_or_zero for input; merge ...
+ (@aarch64_atomic_swp): ... this and remove.
+
+(cherry picked from commit 8f5603d363a4e0453d2c38c7103aeb0bdca85c4e)
+---
+ gcc/config/aarch64/aarch64.c | 25 ------------------
+ gcc/config/aarch64/atomics.md | 49 +++++++++++------------------------
+ 2 files changed, 15 insertions(+), 59 deletions(-)
+
+diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
+index afde9e291f9..d08af9d63ca 100644
+--- a/gcc/config/aarch64/aarch64.c
++++ b/gcc/config/aarch64/aarch64.c
+@@ -12142,27 +12142,6 @@ aarch64_emit_bic (machine_mode mode, rtx dst, rtx s1, rtx s2, int shift)
+ emit_insn (gen (dst, s2, shift_rtx, s1));
+ }
+
+-/* Emit an atomic swap. */
+-
+-static void
+-aarch64_emit_atomic_swap (machine_mode mode, rtx dst, rtx value,
+- rtx mem, rtx model)
+-{
+- rtx (*gen) (rtx, rtx, rtx, rtx);
+-
+- switch (mode)
+- {
+- case QImode: gen = gen_aarch64_atomic_swpqi; break;
+- case HImode: gen = gen_aarch64_atomic_swphi; break;
+- case SImode: gen = gen_aarch64_atomic_swpsi; break;
+- case DImode: gen = gen_aarch64_atomic_swpdi; break;
+- default:
+- gcc_unreachable ();
+- }
+-
+- emit_insn (gen (dst, mem, value, model));
+-}
+-
+ /* Operations supported by aarch64_emit_atomic_load_op. */
+
+ enum aarch64_atomic_load_op_code
+@@ -12275,10 +12254,6 @@ aarch64_gen_atomic_ldop (enum rtx_code code, rtx out_data, rtx out_result,
+ a SET then emit a swap instruction and finish. */
+ switch (code)
+ {
+- case SET:
+- aarch64_emit_atomic_swap (mode, out_data, src, mem, model_rtx);
+- return;
+-
+ case MINUS:
+ /* Negate the value and treat it as a PLUS. */
+ {
+diff --git a/gcc/config/aarch64/atomics.md b/gcc/config/aarch64/atomics.md
+index 577000fa6a4..f1cc972bae4 100644
+--- a/gcc/config/aarch64/atomics.md
++++ b/gcc/config/aarch64/atomics.md
+@@ -136,7 +136,7 @@
+ (define_expand "atomic_exchange"
+ [(match_operand:ALLI 0 "register_operand" "")
+ (match_operand:ALLI 1 "aarch64_sync_memory_operand" "")
+- (match_operand:ALLI 2 "register_operand" "")
++ (match_operand:ALLI 2 "aarch64_reg_or_zero" "")
+ (match_operand:SI 3 "const_int_operand" "")]
+ ""
+ {
+@@ -156,10 +156,10 @@
+
+ (define_insn_and_split "aarch64_atomic_exchange"
+ [(set (match_operand:ALLI 0 "register_operand" "=&r") ;; output
+- (match_operand:ALLI 1 "aarch64_sync_memory_operand" "+Q")) ;; memory
++ (match_operand:ALLI 1 "aarch64_sync_memory_operand" "+Q")) ;; memory
+ (set (match_dup 1)
+ (unspec_volatile:ALLI
+- [(match_operand:ALLI 2 "register_operand" "r") ;; input
++ [(match_operand:ALLI 2 "aarch64_reg_or_zero" "rZ") ;; input
+ (match_operand:SI 3 "const_int_operand" "")] ;; model
+ UNSPECV_ATOMIC_EXCHG))
+ (clobber (reg:CC CC_REGNUM))
+@@ -175,22 +175,25 @@
+ }
+ )
+
+-(define_insn_and_split "aarch64_atomic_exchange_lse"
+- [(set (match_operand:ALLI 0 "register_operand" "=&r")
++(define_insn "aarch64_atomic_exchange_lse"
++ [(set (match_operand:ALLI 0 "register_operand" "=r")
+ (match_operand:ALLI 1 "aarch64_sync_memory_operand" "+Q"))
+ (set (match_dup 1)
+ (unspec_volatile:ALLI
+- [(match_operand:ALLI 2 "register_operand" "r")
++ [(match_operand:ALLI 2 "aarch64_reg_or_zero" "rZ")
+ (match_operand:SI 3 "const_int_operand" "")]
+ UNSPECV_ATOMIC_EXCHG))]
+ "TARGET_LSE"
+- "#"
+- "&& reload_completed"
+- [(const_int 0)]
+ {
+- aarch64_gen_atomic_ldop (SET, operands[0], NULL, operands[1],
+- operands[2], operands[3]);
+- DONE;
++ enum memmodel model = memmodel_from_int (INTVAL (operands[3]));
++ if (is_mm_relaxed (model))
++ return "swp\t%2, %0, %1";
++ else if (is_mm_acquire (model) || is_mm_consume (model))
++ return "swpa\t%2, %0, %1";
++ else if (is_mm_release (model))
++ return "swpl\t%2, %0, %1";
++ else
++ return "swpal\t%2, %0, %1";
+ }
+ )
+
+@@ -582,28 +585,6 @@
+
+ ;; ARMv8.1-A LSE instructions.
+
+-;; Atomic swap with memory.
+-(define_insn "aarch64_atomic_swp"
+- [(set (match_operand:ALLI 0 "register_operand" "+&r")
+- (match_operand:ALLI 1 "aarch64_sync_memory_operand" "+Q"))
+- (set (match_dup 1)
+- (unspec_volatile:ALLI
+- [(match_operand:ALLI 2 "register_operand" "r")
+- (match_operand:SI 3 "const_int_operand" "")]
+- UNSPECV_ATOMIC_SWP))]
+- "TARGET_LSE && reload_completed"
+- {
+- enum memmodel model = memmodel_from_int (INTVAL (operands[3]));
+- if (is_mm_relaxed (model))
+- return "swp\t%2, %0, %1";
+- else if (is_mm_acquire (model) || is_mm_consume (model))
+- return "swpa\t%2, %0, %1";
+- else if (is_mm_release (model))
+- return "swpl\t%2, %0, %1";
+- else
+- return "swpal\t%2, %0, %1";
+- })
+-
+ ;; Atomic load-op: Load data, operate, store result, keep data.
+
+ (define_insn "aarch64_atomic_load"
+--
+2.26.2
+
+
+From 2d9e1f5e434f9511ca82149bbf9b0d64acacac64 Mon Sep 17 00:00:00 2001
+From: Richard Henderson
+Date: Wed, 31 Oct 2018 09:58:48 +0000
+Subject: [PATCH 07/24] aarch64: Improve atomic-op lse generation
+To: gcc-patches@gcc.gnu.org
+
+Fix constraints; avoid unnecessary split. Drop the use of the atomic_op
+iterator in favor of the ATOMIC_LDOP iterator; this is simplier and more
+logical for ldclr aka bic.
+
+2018-10-31 Richard Henderson
+
+gcc/
+ * config/aarch64/aarch64.c (aarch64_emit_bic): Remove.
+ (aarch64_atomic_ldop_supported_p): Remove.
+ (aarch64_gen_atomic_ldop): Remove.
+ * config/aarch64/atomic.md (atomic_):
+ Fully expand LSE operations here.
+ (atomic_fetch_): Likewise.
+ (atomic__fetch): Likewise.
+ (aarch64_atomic__lse): Drop atomic_op iterator
+ and use ATOMIC_LDOP instead; use register_operand for the input;
+ drop the split and emit insns directly.
+ (aarch64_atomic_fetch__lse): Likewise.
+ (aarch64_atomic__fetch_lse): Remove.
+ (@aarch64_atomic_load): Remove.
+
+(cherry picked from commit 7803ec5ee2a547043fb6708a08ddb1361ba91202)
+---
+ gcc/config/aarch64/aarch64-protos.h | 2 -
+ gcc/config/aarch64/aarch64.c | 247 ----------------------------
+ gcc/config/aarch64/atomics.md | 197 +++++++++++-----------
+ gcc/config/aarch64/iterators.md | 5 +-
+ 4 files changed, 108 insertions(+), 343 deletions(-)
+
+diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
+index e25f9833af4..e47f2174479 100644
+--- a/gcc/config/aarch64/aarch64-protos.h
++++ b/gcc/config/aarch64/aarch64-protos.h
+@@ -426,8 +426,6 @@ rtx aarch64_load_tp (rtx);
+ void aarch64_expand_compare_and_swap (rtx op[]);
+ void aarch64_split_compare_and_swap (rtx op[]);
+
+-bool aarch64_atomic_ldop_supported_p (enum rtx_code);
+-void aarch64_gen_atomic_ldop (enum rtx_code, rtx, rtx, rtx, rtx, rtx);
+ void aarch64_split_atomic_op (enum rtx_code, rtx, rtx, rtx, rtx, rtx, rtx);
+
+ bool aarch64_gen_adjusted_ldpstp (rtx *, bool, enum machine_mode, RTX_CODE);
+diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
+index d08af9d63ca..ed3cec30859 100644
+--- a/gcc/config/aarch64/aarch64.c
++++ b/gcc/config/aarch64/aarch64.c
+@@ -11983,32 +11983,6 @@ aarch64_expand_compare_and_swap (rtx operands[])
+ emit_insn (gen_rtx_SET (bval, x));
+ }
+
+-/* Test whether the target supports using a atomic load-operate instruction.
+- CODE is the operation and AFTER is TRUE if the data in memory after the
+- operation should be returned and FALSE if the data before the operation
+- should be returned. Returns FALSE if the operation isn't supported by the
+- architecture. */
+-
+-bool
+-aarch64_atomic_ldop_supported_p (enum rtx_code code)
+-{
+- if (!TARGET_LSE)
+- return false;
+-
+- switch (code)
+- {
+- case SET:
+- case AND:
+- case IOR:
+- case XOR:
+- case MINUS:
+- case PLUS:
+- return true;
+- default:
+- return false;
+- }
+-}
+-
+ /* Emit a barrier, that is appropriate for memory model MODEL, at the end of a
+ sequence implementing an atomic operation. */
+
+@@ -12123,227 +12097,6 @@ aarch64_split_compare_and_swap (rtx operands[])
+ aarch64_emit_post_barrier (model);
+ }
+
+-/* Emit a BIC instruction. */
+-
+-static void
+-aarch64_emit_bic (machine_mode mode, rtx dst, rtx s1, rtx s2, int shift)
+-{
+- rtx shift_rtx = GEN_INT (shift);
+- rtx (*gen) (rtx, rtx, rtx, rtx);
+-
+- switch (mode)
+- {
+- case SImode: gen = gen_and_one_cmpl_lshrsi3; break;
+- case DImode: gen = gen_and_one_cmpl_lshrdi3; break;
+- default:
+- gcc_unreachable ();
+- }
+-
+- emit_insn (gen (dst, s2, shift_rtx, s1));
+-}
+-
+-/* Operations supported by aarch64_emit_atomic_load_op. */
+-
+-enum aarch64_atomic_load_op_code
+-{
+- AARCH64_LDOP_PLUS, /* A + B */
+- AARCH64_LDOP_XOR, /* A ^ B */
+- AARCH64_LDOP_OR, /* A | B */
+- AARCH64_LDOP_BIC /* A & ~B */
+-};
+-
+-/* Emit an atomic load-operate. */
+-
+-static void
+-aarch64_emit_atomic_load_op (enum aarch64_atomic_load_op_code code,
+- machine_mode mode, rtx dst, rtx src,
+- rtx mem, rtx model)
+-{
+- typedef rtx (*aarch64_atomic_load_op_fn) (rtx, rtx, rtx, rtx);
+- const aarch64_atomic_load_op_fn plus[] =
+- {
+- gen_aarch64_atomic_loadaddqi,
+- gen_aarch64_atomic_loadaddhi,
+- gen_aarch64_atomic_loadaddsi,
+- gen_aarch64_atomic_loadadddi
+- };
+- const aarch64_atomic_load_op_fn eor[] =
+- {
+- gen_aarch64_atomic_loadeorqi,
+- gen_aarch64_atomic_loadeorhi,
+- gen_aarch64_atomic_loadeorsi,
+- gen_aarch64_atomic_loadeordi
+- };
+- const aarch64_atomic_load_op_fn ior[] =
+- {
+- gen_aarch64_atomic_loadsetqi,
+- gen_aarch64_atomic_loadsethi,
+- gen_aarch64_atomic_loadsetsi,
+- gen_aarch64_atomic_loadsetdi
+- };
+- const aarch64_atomic_load_op_fn bic[] =
+- {
+- gen_aarch64_atomic_loadclrqi,
+- gen_aarch64_atomic_loadclrhi,
+- gen_aarch64_atomic_loadclrsi,
+- gen_aarch64_atomic_loadclrdi
+- };
+- aarch64_atomic_load_op_fn gen;
+- int idx = 0;
+-
+- switch (mode)
+- {
+- case QImode: idx = 0; break;
+- case HImode: idx = 1; break;
+- case SImode: idx = 2; break;
+- case DImode: idx = 3; break;
+- default:
+- gcc_unreachable ();
+- }
+-
+- switch (code)
+- {
+- case AARCH64_LDOP_PLUS: gen = plus[idx]; break;
+- case AARCH64_LDOP_XOR: gen = eor[idx]; break;
+- case AARCH64_LDOP_OR: gen = ior[idx]; break;
+- case AARCH64_LDOP_BIC: gen = bic[idx]; break;
+- default:
+- gcc_unreachable ();
+- }
+-
+- emit_insn (gen (dst, mem, src, model));
+-}
+-
+-/* Emit an atomic load+operate. CODE is the operation. OUT_DATA is the
+- location to store the data read from memory. OUT_RESULT is the location to
+- store the result of the operation. MEM is the memory location to read and
+- modify. MODEL_RTX is the memory ordering to use. VALUE is the second
+- operand for the operation. Either OUT_DATA or OUT_RESULT, but not both, can
+- be NULL. */
+-
+-void
+-aarch64_gen_atomic_ldop (enum rtx_code code, rtx out_data, rtx out_result,
+- rtx mem, rtx value, rtx model_rtx)
+-{
+- machine_mode mode = GET_MODE (mem);
+- machine_mode wmode = (mode == DImode ? DImode : SImode);
+- const bool short_mode = (mode < SImode);
+- aarch64_atomic_load_op_code ldop_code;
+- rtx src;
+- rtx x;
+-
+- if (out_data)
+- out_data = gen_lowpart (mode, out_data);
+-
+- if (out_result)
+- out_result = gen_lowpart (mode, out_result);
+-
+- /* Make sure the value is in a register, putting it into a destination
+- register if it needs to be manipulated. */
+- if (!register_operand (value, mode)
+- || code == AND || code == MINUS)
+- {
+- src = out_result ? out_result : out_data;
+- emit_move_insn (src, gen_lowpart (mode, value));
+- }
+- else
+- src = value;
+- gcc_assert (register_operand (src, mode));
+-
+- /* Preprocess the data for the operation as necessary. If the operation is
+- a SET then emit a swap instruction and finish. */
+- switch (code)
+- {
+- case MINUS:
+- /* Negate the value and treat it as a PLUS. */
+- {
+- rtx neg_src;
+-
+- /* Resize the value if necessary. */
+- if (short_mode)
+- src = gen_lowpart (wmode, src);
+-
+- neg_src = gen_rtx_NEG (wmode, src);
+- emit_insn (gen_rtx_SET (src, neg_src));
+-
+- if (short_mode)
+- src = gen_lowpart (mode, src);
+- }
+- /* Fall-through. */
+- case PLUS:
+- ldop_code = AARCH64_LDOP_PLUS;
+- break;
+-
+- case IOR:
+- ldop_code = AARCH64_LDOP_OR;
+- break;
+-
+- case XOR:
+- ldop_code = AARCH64_LDOP_XOR;
+- break;
+-
+- case AND:
+- {
+- rtx not_src;
+-
+- /* Resize the value if necessary. */
+- if (short_mode)
+- src = gen_lowpart (wmode, src);
+-
+- not_src = gen_rtx_NOT (wmode, src);
+- emit_insn (gen_rtx_SET (src, not_src));
+-
+- if (short_mode)
+- src = gen_lowpart (mode, src);
+- }
+- ldop_code = AARCH64_LDOP_BIC;
+- break;
+-
+- default:
+- /* The operation can't be done with atomic instructions. */
+- gcc_unreachable ();
+- }
+-
+- aarch64_emit_atomic_load_op (ldop_code, mode, out_data, src, mem, model_rtx);
+-
+- /* If necessary, calculate the data in memory after the update by redoing the
+- operation from values in registers. */
+- if (!out_result)
+- return;
+-
+- if (short_mode)
+- {
+- src = gen_lowpart (wmode, src);
+- out_data = gen_lowpart (wmode, out_data);
+- out_result = gen_lowpart (wmode, out_result);
+- }
+-
+- x = NULL_RTX;
+-
+- switch (code)
+- {
+- case MINUS:
+- case PLUS:
+- x = gen_rtx_PLUS (wmode, out_data, src);
+- break;
+- case IOR:
+- x = gen_rtx_IOR (wmode, out_data, src);
+- break;
+- case XOR:
+- x = gen_rtx_XOR (wmode, out_data, src);
+- break;
+- case AND:
+- aarch64_emit_bic (wmode, out_result, out_data, src, 0);
+- return;
+- default:
+- gcc_unreachable ();
+- }
+-
+- emit_set_insn (out_result, x);
+-
+- return;
+-}
+-
+ /* Split an atomic operation. */
+
+ void
+diff --git a/gcc/config/aarch64/atomics.md b/gcc/config/aarch64/atomics.md
+index f1cc972bae4..735407c9fd7 100644
+--- a/gcc/config/aarch64/atomics.md
++++ b/gcc/config/aarch64/atomics.md
+@@ -207,13 +207,37 @@
+ rtx (*gen) (rtx, rtx, rtx);
+
+ /* Use an atomic load-operate instruction when possible. */
+- if (aarch64_atomic_ldop_supported_p (
))
+- gen = gen_aarch64_atomic__lse;
++ if (TARGET_LSE)
++ {
++ switch ()
++ {
++ case MINUS:
++ operands[1] = expand_simple_unop (mode, NEG, operands[1],
++ NULL, 1);
++ /* fallthru */
++ case PLUS:
++ gen = gen_aarch64_atomic_add_lse;
++ break;
++ case IOR:
++ gen = gen_aarch64_atomic_ior_lse;
++ break;
++ case XOR:
++ gen = gen_aarch64_atomic_xor_lse;
++ break;
++ case AND:
++ operands[1] = expand_simple_unop (mode, NOT, operands[1],
++ NULL, 1);
++ gen = gen_aarch64_atomic_bic_lse;
++ break;
++ default:
++ gcc_unreachable ();
++ }
++ operands[1] = force_reg (mode, operands[1]);
++ }
+ else
+ gen = gen_aarch64_atomic_;
+
+ emit_insn (gen (operands[0], operands[1], operands[2]));
+-
+ DONE;
+ }
+ )
+@@ -239,22 +263,25 @@
+ }
+ )
+
+-(define_insn_and_split "aarch64_atomic__lse"
++(define_insn "aarch64_atomic__lse"
+ [(set (match_operand:ALLI 0 "aarch64_sync_memory_operand" "+Q")
+- (unspec_volatile:ALLI
+- [(atomic_op:ALLI (match_dup 0)
+- (match_operand:ALLI 1 "" "r"))
+- (match_operand:SI 2 "const_int_operand")]
+- UNSPECV_ATOMIC_OP))
++ (unspec_volatile:ALLI
++ [(match_dup 0)
++ (match_operand:ALLI 1 "register_operand" "r")
++ (match_operand:SI 2 "const_int_operand")]
++ ATOMIC_LDOP))
+ (clobber (match_scratch:ALLI 3 "=&r"))]
+ "TARGET_LSE"
+- "#"
+- "&& reload_completed"
+- [(const_int 0)]
+ {
+- aarch64_gen_atomic_ldop (, operands[3], NULL, operands[0],
+- operands[1], operands[2]);
+- DONE;
++ enum memmodel model = memmodel_from_int (INTVAL (operands[2]));
++ if (is_mm_relaxed (model))
++ return "ld\t%1, %3, %0";
++ else if (is_mm_release (model))
++ return "ldl\t%1, %3, %0";
++ else if (is_mm_acquire (model) || is_mm_consume (model))
++ return "lda\t%1, %3, %0";
++ else
++ return "ldal\t%1, %3, %0";
+ }
+ )
+
+@@ -280,7 +307,7 @@
+ }
+ )
+
+-;; Load-operate-store, returning the updated memory data.
++;; Load-operate-store, returning the original memory data.
+
+ (define_expand "atomic_fetch_"
+ [(match_operand:ALLI 0 "register_operand" "")
+@@ -293,13 +320,37 @@
+ rtx (*gen) (rtx, rtx, rtx, rtx);
+
+ /* Use an atomic load-operate instruction when possible. */
+- if (aarch64_atomic_ldop_supported_p ())
+- gen = gen_aarch64_atomic_fetch__lse;
++ if (TARGET_LSE)
++ {
++ switch ()
++ {
++ case MINUS:
++ operands[2] = expand_simple_unop (mode, NEG, operands[2],
++ NULL, 1);
++ /* fallthru */
++ case PLUS:
++ gen = gen_aarch64_atomic_fetch_add_lse;
++ break;
++ case IOR:
++ gen = gen_aarch64_atomic_fetch_ior_lse;
++ break;
++ case XOR:
++ gen = gen_aarch64_atomic_fetch_xor_lse;
++ break;
++ case AND:
++ operands[2] = expand_simple_unop (mode, NOT, operands[2],
++ NULL, 1);
++ gen = gen_aarch64_atomic_fetch_bic_lse;
++ break;
++ default:
++ gcc_unreachable ();
++ }
++ operands[2] = force_reg (mode, operands[2]);
++ }
+ else
+ gen = gen_aarch64_atomic_fetch_;
+
+ emit_insn (gen (operands[0], operands[1], operands[2], operands[3]));
+-
+ DONE;
+ })
+
+@@ -326,23 +377,26 @@
+ }
+ )
+
+-(define_insn_and_split "aarch64_atomic_fetch__lse"
+- [(set (match_operand:ALLI 0 "register_operand" "=&r")
+- (match_operand:ALLI 1 "aarch64_sync_memory_operand" "+Q"))
++(define_insn "aarch64_atomic_fetch__lse"
++ [(set (match_operand:ALLI 0 "register_operand" "=r")
++ (match_operand:ALLI 1 "aarch64_sync_memory_operand" "+Q"))
+ (set (match_dup 1)
+- (unspec_volatile:ALLI
+- [(atomic_op:ALLI (match_dup 1)
+- (match_operand:ALLI 2 "" "r"))
+- (match_operand:SI 3 "const_int_operand")]
+- UNSPECV_ATOMIC_LDOP))]
++ (unspec_volatile:ALLI
++ [(match_dup 1)
++ (match_operand:ALLI 2 "register_operand" "r")
++ (match_operand:SI 3 "const_int_operand")]
++ ATOMIC_LDOP))]
+ "TARGET_LSE"
+- "#"
+- "&& reload_completed"
+- [(const_int 0)]
+ {
+- aarch64_gen_atomic_ldop (, operands[0], NULL, operands[1],
+- operands[2], operands[3]);
+- DONE;
++ enum memmodel model = memmodel_from_int (INTVAL (operands[3]));
++ if (is_mm_relaxed (model))
++ return "ld\t%2, %0, %1";
++ else if (is_mm_acquire (model) || is_mm_consume (model))
++ return "lda\t%2, %0, %1";
++ else if (is_mm_release (model))
++ return "ldl\t%2, %0, %1";
++ else
++ return "ldal\t%2, %0, %1";
+ }
+ )
+
+@@ -370,7 +424,7 @@
+ }
+ )
+
+-;; Load-operate-store, returning the original memory data.
++;; Load-operate-store, returning the updated memory data.
+
+ (define_expand "atomic__fetch"
+ [(match_operand:ALLI 0 "register_operand" "")
+@@ -380,17 +434,23 @@
+ (match_operand:SI 3 "const_int_operand")]
+ ""
+ {
+- rtx (*gen) (rtx, rtx, rtx, rtx);
+- rtx value = operands[2];
+-
+- /* Use an atomic load-operate instruction when possible. */
+- if (aarch64_atomic_ldop_supported_p ())
+- gen = gen_aarch64_atomic__fetch_lse;
++ /* Use an atomic load-operate instruction when possible. In this case
++ we will re-compute the result from the original mem value. */
++ if (TARGET_LSE)
++ {
++ rtx tmp = gen_reg_rtx (mode);
++ operands[2] = force_reg (mode, operands[2]);
++ emit_insn (gen_atomic_fetch_
++ (tmp, operands[1], operands[2], operands[3]));
++ tmp = expand_simple_binop (mode, , tmp, operands[2],
++ operands[0], 1, OPTAB_WIDEN);
++ emit_move_insn (operands[0], tmp);
++ }
+ else
+- gen = gen_aarch64_atomic__fetch;
+-
+- emit_insn (gen (operands[0], operands[1], value, operands[3]));
+-
++ {
++ emit_insn (gen_aarch64_atomic__fetch
++ (operands[0], operands[1], operands[2], operands[3]));
++ }
+ DONE;
+ })
+
+@@ -417,29 +477,6 @@
+ }
+ )
+
+-(define_insn_and_split "aarch64_atomic__fetch_lse"
+- [(set (match_operand:ALLI 0 "register_operand" "=&r")
+- (atomic_op:ALLI
+- (match_operand:ALLI 1 "aarch64_sync_memory_operand" "+Q")
+- (match_operand:ALLI 2 "" "r")))
+- (set (match_dup 1)
+- (unspec_volatile:ALLI
+- [(match_dup 1)
+- (match_dup 2)
+- (match_operand:SI 3 "const_int_operand")]
+- UNSPECV_ATOMIC_LDOP))
+- (clobber (match_scratch:ALLI 4 "=&r"))]
+- "TARGET_LSE"
+- "#"
+- "&& reload_completed"
+- [(const_int 0)]
+- {
+- aarch64_gen_atomic_ldop (, operands[4], operands[0], operands[1],
+- operands[2], operands[3]);
+- DONE;
+- }
+-)
+-
+ (define_insn_and_split "atomic_nand_fetch"
+ [(set (match_operand:ALLI 0 "register_operand" "=&r")
+ (not:ALLI
+@@ -582,29 +619,3 @@
+ return "dmb\\tish";
+ }
+ )
+-
+-;; ARMv8.1-A LSE instructions.
+-
+-;; Atomic load-op: Load data, operate, store result, keep data.
+-
+-(define_insn "aarch64_atomic_load"
+- [(set (match_operand:ALLI 0 "register_operand" "=r")
+- (match_operand:ALLI 1 "aarch64_sync_memory_operand" "+Q"))
+- (set (match_dup 1)
+- (unspec_volatile:ALLI
+- [(match_dup 1)
+- (match_operand:ALLI 2 "register_operand")
+- (match_operand:SI 3 "const_int_operand")]
+- ATOMIC_LDOP))]
+- "TARGET_LSE && reload_completed"
+- {
+- enum memmodel model = memmodel_from_int (INTVAL (operands[3]));
+- if (is_mm_relaxed (model))
+- return "ld\t%