From 7b4c0f7abf0dcc2d54a92e7f2825029a60d1da30 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Fri, 26 Jan 2018 22:04:59 -0800
Subject: [PATCH] Re-number gcc-7.2.0 patches and ensure they apply cleanly

This fixes a couple merge errors in j2.diff in the first rebase on 7.2.0:
- `sh[n1234]*eb-*-*` was written instead of `sh[j1234]*eb-*-*`.
- The TARGET_ATOMIC_* defines got moved to gcc/config/sh/sh.h, so move
  TARGET_ATOMIC_HARD_CAS there as well.
---
 ...nonshared.diff => 0001-ssp_nonshared.diff} |  4 +-
 ...memalign.diff => 0002-posix_memalign.diff} |  2 +-
 .../{0005-cilkrts.diff => 0003-cilkrts.diff}  |  0
 ...-fix.diff => 0004-libatomic-test-fix.diff} | 10 +--
 ...st-fix.diff => 0005-libgomp-test-fix.diff} |  6 +-
 ...est-fix.diff => 0006-libitm-test-fix.diff} | 10 +--
 ...est-fix.diff => 0007-libvtv-test-fix.diff} | 10 +--
 ...port.diff => 0008-static-pie-support.diff} |  8 +--
 .../gcc-7.2.0/{0011-j2.diff => 0009-j2.diff}  | 66 +++++++++----------
 ...muslldso.diff => 0010-s390x-muslldso.diff} |  4 +-
 ...5649.diff => 0011-microblaze-pr65649.diff} | 10 +--
 11 files changed, 64 insertions(+), 66 deletions(-)
 rename patches/gcc-7.2.0/{0002-ssp_nonshared.diff => 0001-ssp_nonshared.diff} (82%)
 rename patches/gcc-7.2.0/{0004-posix_memalign.diff => 0002-posix_memalign.diff} (96%)
 rename patches/gcc-7.2.0/{0005-cilkrts.diff => 0003-cilkrts.diff} (100%)
 rename patches/gcc-7.2.0/{0006-libatomic-test-fix.diff => 0004-libatomic-test-fix.diff} (89%)
 rename patches/gcc-7.2.0/{0007-libgomp-test-fix.diff => 0005-libgomp-test-fix.diff} (94%)
 rename patches/gcc-7.2.0/{0008-libitm-test-fix.diff => 0006-libitm-test-fix.diff} (89%)
 rename patches/gcc-7.2.0/{0009-libvtv-test-fix.diff => 0007-libvtv-test-fix.diff} (89%)
 rename patches/gcc-7.2.0/{0010-static-pie-support.diff => 0008-static-pie-support.diff} (86%)
 rename patches/gcc-7.2.0/{0011-j2.diff => 0009-j2.diff} (90%)
 rename patches/gcc-7.2.0/{0012-s390x-muslldso.diff => 0010-s390x-muslldso.diff} (80%)
 rename patches/gcc-7.2.0/{0013-microblaze-pr65649.diff => 0011-microblaze-pr65649.diff} (58%)

diff --git a/patches/gcc-7.2.0/0002-ssp_nonshared.diff b/patches/gcc-7.2.0/0001-ssp_nonshared.diff
similarity index 82%
rename from patches/gcc-7.2.0/0002-ssp_nonshared.diff
rename to patches/gcc-7.2.0/0001-ssp_nonshared.diff
index 8b8bcfa..d29645f 100644
--- a/patches/gcc-7.2.0/0002-ssp_nonshared.diff
+++ b/patches/gcc-7.2.0/0001-ssp_nonshared.diff
@@ -1,8 +1,8 @@
 diff --git a/gcc/gcc.c b/gcc/gcc.c
-index 0f042b0..0576ea7 100644
+index 9721f94b4f6..fba9bfed930 100644
 --- a/gcc/gcc.c
 +++ b/gcc/gcc.c
-@@ -860,7 +860,8 @@ proper position among the other output files.  */
+@@ -863,7 +863,8 @@ proper position among the other output files.  */
  #ifndef LINK_SSP_SPEC
  #ifdef TARGET_LIBC_PROVIDES_SSP
  #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
diff --git a/patches/gcc-7.2.0/0004-posix_memalign.diff b/patches/gcc-7.2.0/0002-posix_memalign.diff
similarity index 96%
rename from patches/gcc-7.2.0/0004-posix_memalign.diff
rename to patches/gcc-7.2.0/0002-posix_memalign.diff
index 76c4453..30bc7b2 100644
--- a/patches/gcc-7.2.0/0004-posix_memalign.diff
+++ b/patches/gcc-7.2.0/0002-posix_memalign.diff
@@ -1,5 +1,5 @@
 diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
-index a1f98d3..4f6b2dc 100644
+index 73d9e887b4b..33f998702fa 100644
 --- a/gcc/config/i386/pmm_malloc.h
 +++ b/gcc/config/i386/pmm_malloc.h
 @@ -27,12 +27,13 @@
diff --git a/patches/gcc-7.2.0/0005-cilkrts.diff b/patches/gcc-7.2.0/0003-cilkrts.diff
similarity index 100%
rename from patches/gcc-7.2.0/0005-cilkrts.diff
rename to patches/gcc-7.2.0/0003-cilkrts.diff
diff --git a/patches/gcc-7.2.0/0006-libatomic-test-fix.diff b/patches/gcc-7.2.0/0004-libatomic-test-fix.diff
similarity index 89%
rename from patches/gcc-7.2.0/0006-libatomic-test-fix.diff
rename to patches/gcc-7.2.0/0004-libatomic-test-fix.diff
index 2b159dc..97dd3c2 100644
--- a/patches/gcc-7.2.0/0006-libatomic-test-fix.diff
+++ b/patches/gcc-7.2.0/0004-libatomic-test-fix.diff
@@ -1,5 +1,5 @@
 diff --git a/libatomic/testsuite/Makefile.am b/libatomic/testsuite/Makefile.am
-index 561b7e2..2548a1b 100644
+index a9a0144185a..a19101aac54 100644
 --- a/libatomic/testsuite/Makefile.am
 +++ b/libatomic/testsuite/Makefile.am
 @@ -11,3 +11,9 @@ EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
@@ -13,10 +13,10 @@ index 561b7e2..2548a1b 100644
 +	echo 'set BUILD_CC "$(CC)"' > $@.tmp
 +	mv $@.tmp $@
 diff --git a/libatomic/testsuite/Makefile.in b/libatomic/testsuite/Makefile.in
-index 34f83e0..4af67ad 100644
+index adfc231484a..5400ac3ce11 100644
 --- a/libatomic/testsuite/Makefile.in
 +++ b/libatomic/testsuite/Makefile.in
-@@ -222,6 +222,7 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
+@@ -223,6 +223,7 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
  	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
  
  RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
@@ -24,7 +24,7 @@ index 34f83e0..4af67ad 100644
  all: all-am
  
  .SUFFIXES:
-@@ -428,6 +429,10 @@ uninstall-am:
+@@ -429,6 +430,10 @@ uninstall-am:
  	uninstall uninstall-am
  
  
@@ -36,7 +36,7 @@ index 34f83e0..4af67ad 100644
  # Otherwise a system limit (for SysV at least) may be exceeded.
  .NOEXPORT:
 diff --git a/libatomic/testsuite/lib/libatomic.exp b/libatomic/testsuite/lib/libatomic.exp
-index cafab54..dd2e1a4 100644
+index cafab5432b7..dd2e1a4de49 100644
 --- a/libatomic/testsuite/lib/libatomic.exp
 +++ b/libatomic/testsuite/lib/libatomic.exp
 @@ -74,6 +74,7 @@ proc libatomic_init { args } {
diff --git a/patches/gcc-7.2.0/0007-libgomp-test-fix.diff b/patches/gcc-7.2.0/0005-libgomp-test-fix.diff
similarity index 94%
rename from patches/gcc-7.2.0/0007-libgomp-test-fix.diff
rename to patches/gcc-7.2.0/0005-libgomp-test-fix.diff
index 2916766..fe99793 100644
--- a/patches/gcc-7.2.0/0007-libgomp-test-fix.diff
+++ b/patches/gcc-7.2.0/0005-libgomp-test-fix.diff
@@ -1,5 +1,5 @@
 diff --git a/libgomp/testsuite/Makefile.am b/libgomp/testsuite/Makefile.am
-index 66a9d94..83d3f67 100644
+index e2a3f460eb0..3309f71e02e 100644
 --- a/libgomp/testsuite/Makefile.am
 +++ b/libgomp/testsuite/Makefile.am
 @@ -12,6 +12,11 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
@@ -15,7 +15,7 @@ index 66a9d94..83d3f67 100644
  # Instead of directly in ../testsuite/libgomp-test-support.exp.in, the
  # following variables have to be "routed through" this Makefile, for expansion
 diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in
-index 4dbb406..001a163 100644
+index 6edb7ae7ade..b3eddbc3e62 100644
 --- a/libgomp/testsuite/Makefile.in
 +++ b/libgomp/testsuite/Makefile.in
 @@ -254,6 +254,7 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
@@ -38,7 +38,7 @@ index 4dbb406..001a163 100644
  # following variables have to be "routed through" this Makefile, for expansion
  # of the several (Makefile) variables used therein.
 diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
-index 1cb4991..398ba1f 100644
+index 5e47872c5c4..b277c93047d 100644
 --- a/libgomp/testsuite/lib/libgomp.exp
 +++ b/libgomp/testsuite/lib/libgomp.exp
 @@ -85,6 +85,7 @@ proc libgomp_init { args } {
diff --git a/patches/gcc-7.2.0/0008-libitm-test-fix.diff b/patches/gcc-7.2.0/0006-libitm-test-fix.diff
similarity index 89%
rename from patches/gcc-7.2.0/0008-libitm-test-fix.diff
rename to patches/gcc-7.2.0/0006-libitm-test-fix.diff
index 857bd64..5cc1f96 100644
--- a/patches/gcc-7.2.0/0008-libitm-test-fix.diff
+++ b/patches/gcc-7.2.0/0006-libitm-test-fix.diff
@@ -1,5 +1,5 @@
 diff --git a/libitm/testsuite/Makefile.am b/libitm/testsuite/Makefile.am
-index 561b7e2..2548a1b 100644
+index a9a0144185a..a19101aac54 100644
 --- a/libitm/testsuite/Makefile.am
 +++ b/libitm/testsuite/Makefile.am
 @@ -11,3 +11,9 @@ EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
@@ -13,10 +13,10 @@ index 561b7e2..2548a1b 100644
 +	echo 'set BUILD_CC "$(CC)"' > $@.tmp
 +	mv $@.tmp $@
 diff --git a/libitm/testsuite/Makefile.in b/libitm/testsuite/Makefile.in
-index 4d79781..46cdc8b 100644
+index eb9e992279d..1250e7f9a5a 100644
 --- a/libitm/testsuite/Makefile.in
 +++ b/libitm/testsuite/Makefile.in
-@@ -232,6 +232,7 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
+@@ -234,6 +234,7 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
  	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
  
  RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
@@ -24,7 +24,7 @@ index 4d79781..46cdc8b 100644
  all: all-am
  
  .SUFFIXES:
-@@ -438,6 +439,10 @@ uninstall-am:
+@@ -440,6 +441,10 @@ uninstall-am:
  	uninstall uninstall-am
  
  
@@ -36,7 +36,7 @@ index 4d79781..46cdc8b 100644
  # Otherwise a system limit (for SysV at least) may be exceeded.
  .NOEXPORT:
 diff --git a/libitm/testsuite/lib/libitm.exp b/libitm/testsuite/lib/libitm.exp
-index 0416296..748f492 100644
+index 041629687f6..748f492c03d 100644
 --- a/libitm/testsuite/lib/libitm.exp
 +++ b/libitm/testsuite/lib/libitm.exp
 @@ -74,6 +74,7 @@ proc libitm_init { args } {
diff --git a/patches/gcc-7.2.0/0009-libvtv-test-fix.diff b/patches/gcc-7.2.0/0007-libvtv-test-fix.diff
similarity index 89%
rename from patches/gcc-7.2.0/0009-libvtv-test-fix.diff
rename to patches/gcc-7.2.0/0007-libvtv-test-fix.diff
index 5364944..294ae45 100644
--- a/patches/gcc-7.2.0/0009-libvtv-test-fix.diff
+++ b/patches/gcc-7.2.0/0007-libvtv-test-fix.diff
@@ -1,5 +1,5 @@
 diff --git a/libvtv/testsuite/Makefile.am b/libvtv/testsuite/Makefile.am
-index 561b7e2..2548a1b 100644
+index a9a0144185a..a19101aac54 100644
 --- a/libvtv/testsuite/Makefile.am
 +++ b/libvtv/testsuite/Makefile.am
 @@ -11,3 +11,9 @@ EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
@@ -13,10 +13,10 @@ index 561b7e2..2548a1b 100644
 +	echo 'set BUILD_CC "$(CC)"' > $@.tmp
 +	mv $@.tmp $@
 diff --git a/libvtv/testsuite/Makefile.in b/libvtv/testsuite/Makefile.in
-index e19e13e..6528f38 100644
+index b5dfd29973c..9f672e9ae98 100644
 --- a/libvtv/testsuite/Makefile.in
 +++ b/libvtv/testsuite/Makefile.in
-@@ -227,6 +227,7 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
+@@ -228,6 +228,7 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
  	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
  
  RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
@@ -24,7 +24,7 @@ index e19e13e..6528f38 100644
  all: all-am
  
  .SUFFIXES:
-@@ -433,6 +434,10 @@ uninstall-am:
+@@ -434,6 +435,10 @@ uninstall-am:
  	uninstall uninstall-am
  
  
@@ -36,7 +36,7 @@ index e19e13e..6528f38 100644
  # Otherwise a system limit (for SysV at least) may be exceeded.
  .NOEXPORT:
 diff --git a/libvtv/testsuite/lib/libvtv.exp b/libvtv/testsuite/lib/libvtv.exp
-index edf5fdd..a596091 100644
+index edf5fddbad2..a596091573b 100644
 --- a/libvtv/testsuite/lib/libvtv.exp
 +++ b/libvtv/testsuite/lib/libvtv.exp
 @@ -74,6 +74,7 @@ proc libvtv_init { args } {
diff --git a/patches/gcc-7.2.0/0010-static-pie-support.diff b/patches/gcc-7.2.0/0008-static-pie-support.diff
similarity index 86%
rename from patches/gcc-7.2.0/0010-static-pie-support.diff
rename to patches/gcc-7.2.0/0008-static-pie-support.diff
index e2a9b9c..2eccaad 100644
--- a/patches/gcc-7.2.0/0010-static-pie-support.diff
+++ b/patches/gcc-7.2.0/0008-static-pie-support.diff
@@ -1,5 +1,5 @@
 diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
-index b0bf40a..d4b56fe 100644
+index 2787a3d16be..ee7b781319e 100644
 --- a/gcc/config/gnu-user.h
 +++ b/gcc/config/gnu-user.h
 @@ -51,10 +51,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
@@ -17,10 +17,10 @@ index b0bf40a..d4b56fe 100644
       fvtable-verify=preinit:vtv_start_preinit.o%s; \
       fvtable-verify=std:vtv_start.o%s} \
 diff --git a/gcc/gcc.c b/gcc/gcc.c
-index 0576ea7..0a280e0 100644
+index fba9bfed930..ffc7a178052 100644
 --- a/gcc/gcc.c
 +++ b/gcc/gcc.c
-@@ -870,7 +870,7 @@ proper position among the other output files.  */
+@@ -873,7 +873,7 @@ proper position among the other output files.  */
  #endif
  
  #ifdef ENABLE_DEFAULT_PIE
@@ -29,7 +29,7 @@ index 0576ea7..0a280e0 100644
  #define PIE_SPEC		NO_PIE_SPEC "|r|shared:;"
  #define NO_FPIE1_SPEC		"fno-pie"
  #define FPIE1_SPEC		NO_FPIE1_SPEC ":;"
-@@ -916,7 +916,7 @@ proper position among the other output files.  */
+@@ -919,7 +919,7 @@ proper position among the other output files.  */
  #ifndef LINK_PIE_SPEC
  #ifdef HAVE_LD_PIE
  #ifndef LD_PIE_SPEC
diff --git a/patches/gcc-7.2.0/0011-j2.diff b/patches/gcc-7.2.0/0009-j2.diff
similarity index 90%
rename from patches/gcc-7.2.0/0011-j2.diff
rename to patches/gcc-7.2.0/0009-j2.diff
index b0cdb87..0abc157 100644
--- a/patches/gcc-7.2.0/0011-j2.diff
+++ b/patches/gcc-7.2.0/0009-j2.diff
@@ -1,5 +1,5 @@
 diff --git a/gcc/config.gcc b/gcc/config.gcc
-index b8bb4d65825..2c827512533 100644
+index a9196cd26d9..50906fd447f 100644
 --- a/gcc/config.gcc
 +++ b/gcc/config.gcc
 @@ -474,7 +474,7 @@ s390*-*-*)
@@ -11,7 +11,7 @@ index b8bb4d65825..2c827512533 100644
  	cpu_type=sh
  	extra_options="${extra_options} fused-madd.opt"
  	extra_objs="${extra_objs} sh_treg_combine.o sh-mem.o sh_optimize_sett_clrt.o"
-@@ -2646,18 +2646,18 @@ s390x-ibm-tpf*)
+@@ -2651,18 +2651,18 @@ s390x-ibm-tpf*)
  	extra_options="${extra_options} s390/tpf.opt"
  	tmake_file="${tmake_file} s390/t-s390"
  	;;
@@ -24,7 +24,7 @@ index b8bb4d65825..2c827512533 100644
  	if test x${with_endian} = x; then
  		case ${target} in
 -		sh[1234]*be-*-* | sh[1234]*eb-*-*) with_endian=big ;;
-+		sh[j1234]*be-*-* | sh[n1234]*eb-*-*) with_endian=big ;;
++		sh[j1234]*be-*-* | sh[j1234]*eb-*-*) with_endian=big ;;
  		shbe-*-* | sheb-*-*)		   with_endian=big,little ;;
  		sh[1234]l* | sh[34]*-*-linux*)	   with_endian=little ;;
  		shl* | sh*-*-linux* | \
@@ -34,7 +34,7 @@ index b8bb4d65825..2c827512533 100644
  		*)				   with_endian=big,little ;;
  		esac
  	fi
-@@ -2724,6 +2724,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
+@@ -2729,6 +2729,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
  	sh2a_nofpu*)		sh_cpu_target=sh2a-nofpu ;;
  	sh2a*)			sh_cpu_target=sh2a ;;
  	sh2e*)			sh_cpu_target=sh2e ;;
@@ -42,7 +42,7 @@ index b8bb4d65825..2c827512533 100644
  	sh2*)			sh_cpu_target=sh2 ;;
  	*)			sh_cpu_target=sh1 ;;
  	esac
-@@ -2745,7 +2746,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
+@@ -2750,7 +2751,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
  	  sh2a-single-only | sh2a-single | sh2a-nofpu | sh2a | \
  	  sh4a-single-only | sh4a-single | sh4a-nofpu | sh4a | sh4al | \
  	  sh4-single-only | sh4-single | sh4-nofpu | sh4 | sh4-300 | \
@@ -51,7 +51,7 @@ index b8bb4d65825..2c827512533 100644
  	"")	sh_cpu_default=${sh_cpu_target} ;;
  	*)	echo "with_cpu=$with_cpu not supported"; exit 1 ;;
  	esac
-@@ -2754,9 +2755,9 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
+@@ -2759,9 +2760,9 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
  		case ${target} in
  		sh[1234]*)	sh_multilibs=${sh_cpu_target} ;;
  		sh-superh-*)	sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;;
@@ -63,7 +63,7 @@ index b8bb4d65825..2c827512533 100644
  		esac
  		if test x$with_fp = xno; then
  			sh_multilibs="`echo $sh_multilibs|sed -e s/m4/sh4-nofpu/ -e s/,m4-[^,]*//g -e s/,m[23]e// -e s/m2a,m2a-single/m2a-nofpu/ -e s/m5-..m....,//g`"
-@@ -2771,7 +2772,8 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
+@@ -2776,7 +2777,8 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
  		m1 | m2 | m2e | m3 | m3e | \
  		m4 | m4-single | m4-single-only | m4-nofpu | m4-300 |\
  		m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al | \
@@ -73,7 +73,7 @@ index b8bb4d65825..2c827512533 100644
  			# TM_MULTILIB_CONFIG is used by t-sh for the non-endian multilib definition
  			# It is passed to MULTIILIB_OPTIONS verbatim.
  			TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG}/${sh_multilib}"
-@@ -2788,7 +2790,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
+@@ -2793,7 +2795,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
  	done
  	TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's:^/::'`
  	if test x${enable_incomplete_targets} = xyes ; then
@@ -82,7 +82,7 @@ index b8bb4d65825..2c827512533 100644
  	fi
  	tm_file="$tm_file ./sysroot-suffix.h"
  	tmake_file="$tmake_file t-sysroot-suffix"
-@@ -4362,6 +4364,8 @@ case "${target}" in
+@@ -4367,6 +4369,8 @@ case "${target}" in
  			;;
  		m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al)
  		        ;;
@@ -91,7 +91,7 @@ index b8bb4d65825..2c827512533 100644
  		*)
  			echo "Unknown CPU used in --with-cpu=$with_cpu, known values:"  1>&2
  			echo "m1 m2 m2e m3 m3e m4 m4-single m4-single-only m4-nofpu" 1>&2
-@@ -4571,7 +4575,7 @@ case ${target} in
+@@ -4576,7 +4580,7 @@ case ${target} in
  		tmake_file="rs6000/t-rs6000 ${tmake_file}"
  		;;
  
@@ -100,25 +100,11 @@ index b8bb4d65825..2c827512533 100644
  		c_target_objs="${c_target_objs} sh-c.o"
  		cxx_target_objs="${cxx_target_objs} sh-c.o"
  		;;
-diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h
-index b08120d..63b77fa 100644
---- a/gcc/config/sh/sh-protos.h
-+++ b/gcc/config/sh/sh-protos.h
-@@ -88,6 +89,9 @@ extern const sh_atomic_model& selected_atomic_model (void);
- #define TARGET_ATOMIC_SOFT_IMASK \
-   (selected_atomic_model ().type == sh_atomic_model::soft_imask)
- 
-+#define TARGET_ATOMIC_HARD_CAS \
-+  (selected_atomic_model ().type == sh_atomic_model::hard_cas)
-+
- #ifdef RTX_CODE
- extern rtx sh_fsca_sf2int (void);
- extern rtx sh_fsca_int2sf (void);
 diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
-index b18e59b..88520e8 100644
+index ff79b93adc2..5fe3f3bfe69 100644
 --- a/gcc/config/sh/sh.c
 +++ b/gcc/config/sh/sh.c
-@@ -692,6 +692,7 @@ parse_validate_atomic_model_option (const char* str)
+@@ -662,6 +662,7 @@ parse_validate_atomic_model_option (const char* str)
    model_names[sh_atomic_model::hard_llcs] = "hard-llcs";
    model_names[sh_atomic_model::soft_tcb] = "soft-tcb";
    model_names[sh_atomic_model::soft_imask] = "soft-imask";
@@ -126,7 +112,7 @@ index b18e59b..88520e8 100644
  
    const char* model_cdef_names[sh_atomic_model::num_models];
    model_cdef_names[sh_atomic_model::none] = "NONE";
-@@ -699,6 +700,7 @@ parse_validate_atomic_model_option (const char* str)
+@@ -669,6 +670,7 @@ parse_validate_atomic_model_option (const char* str)
    model_cdef_names[sh_atomic_model::hard_llcs] = "HARD_LLCS";
    model_cdef_names[sh_atomic_model::soft_tcb] = "SOFT_TCB";
    model_cdef_names[sh_atomic_model::soft_imask] = "SOFT_IMASK";
@@ -134,7 +120,7 @@ index b18e59b..88520e8 100644
  
    sh_atomic_model ret;
    ret.type = sh_atomic_model::none;
-@@ -780,6 +782,9 @@ got_mode_name:;
+@@ -747,6 +749,9 @@ got_mode_name:;
    if (ret.type == sh_atomic_model::soft_imask && TARGET_USERMODE)
      err_ret ("cannot use atomic model %s in user mode", ret.name);
  
@@ -144,7 +130,7 @@ index b18e59b..88520e8 100644
    return ret;
  
  #undef err_ret
-@@ -845,6 +850,8 @@ sh_option_override (void)
+@@ -803,6 +808,8 @@ sh_option_override (void)
      sh_cpu = PROCESSOR_SH2E;
    if (TARGET_SH2A)
      sh_cpu = PROCESSOR_SH2A;
@@ -154,7 +140,7 @@ index b18e59b..88520e8 100644
      sh_cpu = PROCESSOR_SH3;
    if (TARGET_SH3E)
 diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
-index b13d1b3c943..8f483635747 100644
+index b13d1b3c943..9e24649d189 100644
 --- a/gcc/config/sh/sh.h
 +++ b/gcc/config/sh/sh.h
 @@ -83,6 +83,7 @@ extern int code_for_indirect_jump_scratch;
@@ -208,7 +194,17 @@ index b13d1b3c943..8f483635747 100644
  
      num_models
    };
-@@ -1568,7 +1573,7 @@ extern bool current_function_interrupt;
+@@ -388,6 +393,9 @@ extern const sh_atomic_model& selected_atomic_model (void);
+ #define TARGET_ATOMIC_SOFT_IMASK \
+   (selected_atomic_model ().type == sh_atomic_model::soft_imask)
+ 
++#define TARGET_ATOMIC_HARD_CAS \
++  (selected_atomic_model ().type == sh_atomic_model::hard_cas)
++
+ #endif // __cplusplus
+ 
+ #define SUBTARGET_OVERRIDE_OPTIONS (void) 0
+@@ -1568,7 +1576,7 @@ extern bool current_function_interrupt;
  
  /* Nonzero if the target supports dynamic shift instructions
     like shad and shld.  */
@@ -217,7 +213,7 @@ index b13d1b3c943..8f483635747 100644
  
  /* The cost of using the dynamic shift insns (shad, shld) are the same
     if they are available.  If they are not available a library function will
-@@ -1833,6 +1838,7 @@ enum processor_type {
+@@ -1833,6 +1841,7 @@ enum processor_type {
    PROCESSOR_SH2,
    PROCESSOR_SH2E,
    PROCESSOR_SH2A,
@@ -226,10 +222,10 @@ index b13d1b3c943..8f483635747 100644
    PROCESSOR_SH3E,
    PROCESSOR_SH4,
 diff --git a/gcc/config/sh/sh.opt b/gcc/config/sh/sh.opt
-index 1026c73..bac47ed 100644
+index c4f0d964d00..792af395b5d 100644
 --- a/gcc/config/sh/sh.opt
 +++ b/gcc/config/sh/sh.opt
-@@ -71,6 +71,10 @@ m2e
+@@ -65,6 +65,10 @@ m2e
  Target RejectNegative Condition(SUPPORT_SH2E)
  Generate SH2e code.
  
@@ -241,7 +237,7 @@ index 1026c73..bac47ed 100644
  Target RejectNegative Mask(SH3) Condition(SUPPORT_SH3)
  Generate SH3 code.
 diff --git a/gcc/config/sh/sync.md b/gcc/config/sh/sync.md
-index 6f1337b..7cfd9ef 100644
+index b46ac3131a8..72705583f84 100644
 --- a/gcc/config/sh/sync.md
 +++ b/gcc/config/sh/sync.md
 @@ -240,6 +240,9 @@
diff --git a/patches/gcc-7.2.0/0012-s390x-muslldso.diff b/patches/gcc-7.2.0/0010-s390x-muslldso.diff
similarity index 80%
rename from patches/gcc-7.2.0/0012-s390x-muslldso.diff
rename to patches/gcc-7.2.0/0010-s390x-muslldso.diff
index 62c306b..b6c8e7e 100644
--- a/patches/gcc-7.2.0/0012-s390x-muslldso.diff
+++ b/patches/gcc-7.2.0/0010-s390x-muslldso.diff
@@ -1,8 +1,8 @@
 diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
-index 9b00af7..3aacde6 100644
+index 739df00f62d..ccd48ee7b84 100644
 --- a/gcc/config/s390/linux.h
 +++ b/gcc/config/s390/linux.h
-@@ -63,6 +63,9 @@ along with GCC; see the file COPYING3.  If not see
+@@ -76,6 +76,9 @@ along with GCC; see the file COPYING3.  If not see
  #define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
  #define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
  
diff --git a/patches/gcc-7.2.0/0013-microblaze-pr65649.diff b/patches/gcc-7.2.0/0011-microblaze-pr65649.diff
similarity index 58%
rename from patches/gcc-7.2.0/0013-microblaze-pr65649.diff
rename to patches/gcc-7.2.0/0011-microblaze-pr65649.diff
index 5604485..2d64a86 100644
--- a/patches/gcc-7.2.0/0013-microblaze-pr65649.diff
+++ b/patches/gcc-7.2.0/0011-microblaze-pr65649.diff
@@ -1,6 +1,8 @@
---- gcc-6.3.0/gcc/config/microblaze/microblaze.c.orig	2017-01-02 15:07:18.924082703 -0500
-+++ gcc-6.3.0/gcc/config/microblaze/microblaze.c	2017-01-02 15:08:06.362438573 -0500
-@@ -2364,7 +2364,7 @@
+diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
+index d0f86fd4607..dc34ab960bf 100644
+--- a/gcc/config/microblaze/microblaze.c
++++ b/gcc/config/microblaze/microblaze.c
+@@ -2375,7 +2375,7 @@ print_operand (FILE * file, rtx op, int letter)
  	  unsigned long value_long;
  	  REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (op),
  				       value_long);
@@ -9,7 +11,7 @@
  	}
        else
  	{
-@@ -2423,7 +2423,7 @@
+@@ -2434,7 +2434,7 @@ print_operand (FILE * file, rtx op, int letter)
        print_operand_address (file, XEXP (op, 0));
      }
    else if (letter == 'm')