diff --git a/hashes/gcc-6.5.0.tar.xz.sha1 b/hashes/gcc-6.5.0.tar.xz.sha1 new file mode 100644 index 0000000..28e8722 --- /dev/null +++ b/hashes/gcc-6.5.0.tar.xz.sha1 @@ -0,0 +1 @@ +368b3f5d294b1a8727b372ac0a77703d8b41968a gcc-6.5.0.tar.xz diff --git a/patches/gcc-6.5.0/0001-linux_libc_has_function.diff b/patches/gcc-6.5.0/0001-linux_libc_has_function.diff new file mode 100644 index 0000000..f7e2c06 --- /dev/null +++ b/patches/gcc-6.5.0/0001-linux_libc_has_function.diff @@ -0,0 +1,13 @@ +diff --git a/gcc/config/linux.c b/gcc/config/linux.c +index 250296b..16c3768 100644 +--- a/gcc/config/linux.c ++++ b/gcc/config/linux.c +@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see + bool + linux_libc_has_function (enum function_class fn_class) + { +- if (OPTION_GLIBC) ++ if (OPTION_GLIBC || OPTION_MUSL) + return true; + if (OPTION_BIONIC) + if (fn_class == function_c94 diff --git a/patches/gcc-6.5.0/0002-ssp_nonshared.diff b/patches/gcc-6.5.0/0002-ssp_nonshared.diff new file mode 100644 index 0000000..8b8bcfa --- /dev/null +++ b/patches/gcc-6.5.0/0002-ssp_nonshared.diff @@ -0,0 +1,14 @@ +diff --git a/gcc/gcc.c b/gcc/gcc.c +index 0f042b0..0576ea7 100644 +--- a/gcc/gcc.c ++++ b/gcc/gcc.c +@@ -860,7 +860,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" \ +- "|fstack-protector-strong|fstack-protector-explicit:}" ++ "|fstack-protector-strong|fstack-protector-explicit" \ ++ ":-lssp_nonshared}" + #else + #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ + "|fstack-protector-strong|fstack-protector-explicit" \ diff --git a/patches/gcc-6.5.0/0003-mips-unwind.diff b/patches/gcc-6.5.0/0003-mips-unwind.diff new file mode 100644 index 0000000..fe02ef1 --- /dev/null +++ b/patches/gcc-6.5.0/0003-mips-unwind.diff @@ -0,0 +1,13 @@ +diff --git a/libgcc/config/mips/linux-unwind.h b/libgcc/config/mips/linux-unwind.h +index bf12de5..4035c121 100644 +--- a/libgcc/config/mips/linux-unwind.h ++++ b/libgcc/config/mips/linux-unwind.h +@@ -27,7 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + state data appropriately. See unwind-dw2.c for the structs. */ + + #include +-#include ++#include + + /* The third parameter to the signal handler points to something with + * this structure defined in asm/ucontext.h, but the name clashes with diff --git a/patches/gcc-6.5.0/0004-posix_memalign.diff b/patches/gcc-6.5.0/0004-posix_memalign.diff new file mode 100644 index 0000000..16fefa3 --- /dev/null +++ b/patches/gcc-6.5.0/0004-posix_memalign.diff @@ -0,0 +1,30 @@ +diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h +index a9c2be4..2596a90 100644 +--- a/gcc/config/i386/pmm_malloc.h ++++ b/gcc/config/i386/pmm_malloc.h +@@ -27,12 +27,13 @@ + #include + + /* We can't depend on since the prototype of posix_memalign +- may not be visible. */ ++ may not be visible and we can't pollute the namespace either. */ + #ifndef __cplusplus +-extern int posix_memalign (void **, size_t, size_t); ++extern int _mm_posix_memalign (void **, size_t, size_t) + #else +-extern "C" int posix_memalign (void **, size_t, size_t) throw (); ++extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw () + #endif ++__asm__("posix_memalign"); + + static __inline void * + _mm_malloc (size_t __size, size_t __alignment) +@@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment) + return malloc (__size); + if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4)) + __alignment = sizeof (void *); +- if (posix_memalign (&__ptr, __alignment, __size) == 0) ++ if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0) + return __ptr; + else + return NULL; diff --git a/patches/gcc-6.5.0/0005-cilkrts.diff b/patches/gcc-6.5.0/0005-cilkrts.diff new file mode 100644 index 0000000..2f42b44 --- /dev/null +++ b/patches/gcc-6.5.0/0005-cilkrts.diff @@ -0,0 +1,47 @@ +diff --git a/libcilkrts/runtime/os-unix.c b/libcilkrts/runtime/os-unix.c +index cb582dd..e43d7d5 100644 +--- a/libcilkrts/runtime/os-unix.c ++++ b/libcilkrts/runtime/os-unix.c +@@ -51,6 +51,7 @@ + #if defined __linux__ + # include + # include ++# include + #elif defined __APPLE__ + # include + // Uses sysconf(_SC_NPROCESSORS_ONLN) in verbose output +@@ -400,28 +401,19 @@ COMMON_SYSDEP void __cilkrts_sleep(void) + + COMMON_SYSDEP void __cilkrts_yield(void) + { +-#if __APPLE__ || __FreeBSD__ || __VXWORKS__ +- // On MacOS, call sched_yield to yield quantum. I'm not sure why we +- // don't do this on Linux also. +- sched_yield(); +-#elif defined(__DragonFly__) +- // On DragonFly BSD, call sched_yield to yield quantum. +- sched_yield(); +-#elif defined(__MIC__) ++#if defined(__MIC__) + // On MIC, pthread_yield() really trashes things. Arch's measurements + // showed that calling _mm_delay_32() (or doing nothing) was a better + // option. Delaying 1024 clock cycles is a reasonable compromise between + // giving up the processor and latency starting up when work becomes + // available + _mm_delay_32(1024); +-#elif defined(__ANDROID__) || (defined(__sun__) && defined(__svr4__)) +- // On Android and Solaris, call sched_yield to yield quantum. I'm not +- // sure why we don't do this on Linux also. +- sched_yield(); +-#else +- // On Linux, call pthread_yield (which in turn will call sched_yield) +- // to yield quantum. ++#elif defined(__sun__) && !defined(__svr4__) ++ // On old SunOS call pthread_yield to yield a quantum. + pthread_yield(); ++#else ++ // On other platforms call sched_yield to yield a quantum. ++ sched_yield(); + #endif + } + diff --git a/patches/gcc-6.5.0/0006-libatomic-test-fix.diff b/patches/gcc-6.5.0/0006-libatomic-test-fix.diff new file mode 100644 index 0000000..2b159dc --- /dev/null +++ b/patches/gcc-6.5.0/0006-libatomic-test-fix.diff @@ -0,0 +1,58 @@ +diff --git a/libatomic/testsuite/Makefile.am b/libatomic/testsuite/Makefile.am +index 561b7e2..2548a1b 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 \ + _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \ + echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi) + RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)" ++ ++EXTRA_DEJAGNU_SITE_CONFIG = extra.exp ++ ++extra.exp: ++ echo 'set BUILD_CC "$(CC)"' > $@.tmp ++ mv $@.tmp $@ +diff --git a/libatomic/testsuite/Makefile.in b/libatomic/testsuite/Makefile.in +index 34f83e0..4af67ad 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 \ + echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi) + + RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)" ++EXTRA_DEJAGNU_SITE_CONFIG = extra.exp + all: all-am + + .SUFFIXES: +@@ -428,6 +429,10 @@ uninstall-am: + uninstall uninstall-am + + ++extra.exp: ++ echo 'set BUILD_CC "$(CC)"' > $@.tmp ++ mv $@.tmp $@ ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # 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 +--- a/libatomic/testsuite/lib/libatomic.exp ++++ b/libatomic/testsuite/lib/libatomic.exp +@@ -74,6 +74,7 @@ proc libatomic_init { args } { + global ALWAYS_CFLAGS + global CFLAGS + global TOOL_EXECUTABLE TOOL_OPTIONS ++ global BUILD_CC + global GCC_UNDER_TEST + global TESTING_IN_BUILD_TREE + global target_triplet +@@ -89,6 +90,8 @@ proc libatomic_init { args } { + if ![info exists GCC_UNDER_TEST] then { + if [info exists TOOL_EXECUTABLE] { + set GCC_UNDER_TEST $TOOL_EXECUTABLE ++ } elseif [info exists BUILD_CC] { ++ set GCC_UNDER_TEST $BUILD_CC + } else { + set GCC_UNDER_TEST "[find_gcc]" + } diff --git a/patches/gcc-6.5.0/0007-libgomp-test-fix.diff b/patches/gcc-6.5.0/0007-libgomp-test-fix.diff new file mode 100644 index 0000000..2916766 --- /dev/null +++ b/patches/gcc-6.5.0/0007-libgomp-test-fix.diff @@ -0,0 +1,60 @@ +diff --git a/libgomp/testsuite/Makefile.am b/libgomp/testsuite/Makefile.am +index 66a9d94..83d3f67 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 \ + echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi) + RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)" + ++EXTRA_DEJAGNU_SITE_CONFIG = extra.exp ++ ++extra.exp: ++ echo 'set BUILD_CC "$(CC)"' > $@.tmp ++ mv $@.tmp $@ + + # 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 +--- a/libgomp/testsuite/Makefile.in ++++ b/libgomp/testsuite/Makefile.in +@@ -254,6 +254,7 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \ + echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi) + + RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)" ++EXTRA_DEJAGNU_SITE_CONFIG = extra.exp + all: all-am + + .SUFFIXES: +@@ -462,6 +463,10 @@ uninstall-am: + ps ps-am uninstall uninstall-am + + ++extra.exp: ++ echo 'set BUILD_CC "$(CC)"' > $@.tmp ++ mv $@.tmp $@ ++ + # Instead of directly in ../testsuite/libgomp-test-support.exp.in, the + # 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 +--- a/libgomp/testsuite/lib/libgomp.exp ++++ b/libgomp/testsuite/lib/libgomp.exp +@@ -85,6 +85,7 @@ proc libgomp_init { args } { + global ALWAYS_CFLAGS + global CFLAGS + global TOOL_EXECUTABLE TOOL_OPTIONS ++ global BUILD_CC + global GCC_UNDER_TEST + global TESTING_IN_BUILD_TREE + global target_triplet +@@ -107,6 +108,8 @@ proc libgomp_init { args } { + if ![info exists GCC_UNDER_TEST] then { + if [info exists TOOL_EXECUTABLE] { + set GCC_UNDER_TEST $TOOL_EXECUTABLE ++ } elseif [info exists BUILD_CC] { ++ set GCC_UNDER_TEST $BUILD_CC + } else { + set GCC_UNDER_TEST "[find_gcc]" + } diff --git a/patches/gcc-6.5.0/0008-libitm-test-fix.diff b/patches/gcc-6.5.0/0008-libitm-test-fix.diff new file mode 100644 index 0000000..857bd64 --- /dev/null +++ b/patches/gcc-6.5.0/0008-libitm-test-fix.diff @@ -0,0 +1,58 @@ +diff --git a/libitm/testsuite/Makefile.am b/libitm/testsuite/Makefile.am +index 561b7e2..2548a1b 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 \ + _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \ + echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi) + RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)" ++ ++EXTRA_DEJAGNU_SITE_CONFIG = extra.exp ++ ++extra.exp: ++ echo 'set BUILD_CC "$(CC)"' > $@.tmp ++ mv $@.tmp $@ +diff --git a/libitm/testsuite/Makefile.in b/libitm/testsuite/Makefile.in +index 4d79781..46cdc8b 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 \ + echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi) + + RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)" ++EXTRA_DEJAGNU_SITE_CONFIG = extra.exp + all: all-am + + .SUFFIXES: +@@ -438,6 +439,10 @@ uninstall-am: + uninstall uninstall-am + + ++extra.exp: ++ echo 'set BUILD_CC "$(CC)"' > $@.tmp ++ mv $@.tmp $@ ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # 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 +--- a/libitm/testsuite/lib/libitm.exp ++++ b/libitm/testsuite/lib/libitm.exp +@@ -74,6 +74,7 @@ proc libitm_init { args } { + global ALWAYS_CFLAGS + global CFLAGS + global TOOL_EXECUTABLE TOOL_OPTIONS ++ global BUILD_CC + global GCC_UNDER_TEST + global TESTING_IN_BUILD_TREE + global target_triplet +@@ -89,6 +90,8 @@ proc libitm_init { args } { + if ![info exists GCC_UNDER_TEST] then { + if [info exists TOOL_EXECUTABLE] { + set GCC_UNDER_TEST $TOOL_EXECUTABLE ++ } elseif [info exists BUILD_CC] { ++ set GCC_UNDER_TEST $BUILD_CC + } else { + set GCC_UNDER_TEST "[find_gcc]" + } diff --git a/patches/gcc-6.5.0/0009-libvtv-test-fix.diff b/patches/gcc-6.5.0/0009-libvtv-test-fix.diff new file mode 100644 index 0000000..5364944 --- /dev/null +++ b/patches/gcc-6.5.0/0009-libvtv-test-fix.diff @@ -0,0 +1,58 @@ +diff --git a/libvtv/testsuite/Makefile.am b/libvtv/testsuite/Makefile.am +index 561b7e2..2548a1b 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 \ + _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \ + echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi) + RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)" ++ ++EXTRA_DEJAGNU_SITE_CONFIG = extra.exp ++ ++extra.exp: ++ echo 'set BUILD_CC "$(CC)"' > $@.tmp ++ mv $@.tmp $@ +diff --git a/libvtv/testsuite/Makefile.in b/libvtv/testsuite/Makefile.in +index e19e13e..6528f38 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 \ + echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi) + + RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)" ++EXTRA_DEJAGNU_SITE_CONFIG = extra.exp + all: all-am + + .SUFFIXES: +@@ -433,6 +434,10 @@ uninstall-am: + uninstall uninstall-am + + ++extra.exp: ++ echo 'set BUILD_CC "$(CC)"' > $@.tmp ++ mv $@.tmp $@ ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # 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 +--- a/libvtv/testsuite/lib/libvtv.exp ++++ b/libvtv/testsuite/lib/libvtv.exp +@@ -74,6 +74,7 @@ proc libvtv_init { args } { + global ALWAYS_CFLAGS + global CFLAGS + global TOOL_EXECUTABLE TOOL_OPTIONS ++ global BUILD_CC + global GCC_UNDER_TEST + global TESTING_IN_BUILD_TREE + global target_triplet +@@ -89,6 +90,8 @@ proc libvtv_init { args } { + if ![info exists GCC_UNDER_TEST] then { + if [info exists TOOL_EXECUTABLE] { + set GCC_UNDER_TEST $TOOL_EXECUTABLE ++ } elseif [info exists BUILD_CC] { ++ set GCC_UNDER_TEST $BUILD_CC + } else { + set GCC_UNDER_TEST "[find_gcc]" + } diff --git a/patches/gcc-6.5.0/0011-j2.diff b/patches/gcc-6.5.0/0011-j2.diff new file mode 100644 index 0000000..937254d --- /dev/null +++ b/patches/gcc-6.5.0/0011-j2.diff @@ -0,0 +1,349 @@ +diff --git a/gcc/config.gcc b/gcc/config.gcc +index 1d5b23f..ef0a6ab 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -471,7 +471,7 @@ s390*-*-*) + extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h" + ;; + # Note the 'l'; we need to be able to match e.g. "shle" or "shl". +-sh[123456789lbe]*-*-* | sh-*-*) ++sh[123456789lbej]*-*-* | sh-*-*) + 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" +@@ -2624,19 +2624,19 @@ s390x-ibm-tpf*) + extra_options="${extra_options} s390/tpf.opt" + tmake_file="${tmake_file} s390/t-s390" + ;; +-sh-*-elf* | sh[12346l]*-*-elf* | \ +- sh-*-linux* | sh[2346lbe]*-*-linux* | \ ++sh-*-elf* | sh[12346lj]*-*-elf* | \ ++ sh-*-linux* | sh[2346lbej]*-*-linux* | \ + sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \ + sh64-*-netbsd* | sh64l*-*-netbsd*) + tmake_file="${tmake_file} sh/t-sh sh/t-elf" + if test x${with_endian} = x; then + case ${target} in +- sh[1234]*be-*-* | sh[1234]*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* | sh64l* | sh*-*-linux* | \ + sh5l* | sh-superh-elf) with_endian=little,big ;; +- sh[1234]*-*-*) with_endian=big ;; ++ sh[j1234]*-*-*) with_endian=big ;; + *) with_endian=big,little ;; + esac + fi +@@ -2726,6 +2726,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \ + sh2a_nofpu*) sh_cpu_target=sh2a-nofpu ;; + sh2a*) sh_cpu_target=sh2a ;; + sh2e*) sh_cpu_target=sh2e ;; ++ shj2*) sh_cpu_target=shj2;; + sh2*) sh_cpu_target=sh2 ;; + *) sh_cpu_target=sh1 ;; + esac +@@ -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 | \ +- sh3e | sh3 | sh2e | sh2 | sh1) ;; ++ sh3e | sh3 | sh2e | sh2 | sh1 | shj2) ;; + "") sh_cpu_default=${sh_cpu_target} ;; + *) echo "with_cpu=$with_cpu not supported"; exit 1 ;; + esac +@@ -2761,9 +2762,9 @@ sh-*-elf* | sh[12346l]*-*-elf* | \ + sh[1234]*) sh_multilibs=${sh_cpu_target} ;; + sh64* | sh5*) sh_multilibs=m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu ;; + sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;; +- sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4 ;; ++ sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4,mj2 ;; + sh*-*-netbsd*) sh_multilibs=m3,m3e,m4 ;; +- *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;; ++ *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single,mj2 ;; + 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`" +@@ -2781,7 +2782,8 @@ sh-*-elf* | sh[12346l]*-*-elf* | \ + m2a | m2a-single | m2a-single-only | m2a-nofpu | \ + m5-64media | m5-64media-nofpu | \ + m5-32media | m5-32media-nofpu | \ +- m5-compact | m5-compact-nofpu) ++ m5-compact | m5-compact-nofpu | \ ++ mj2) + # 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}" +@@ -2798,7 +2800,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \ + done + TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's:^/::'` + if test x${enable_incomplete_targets} = xyes ; then +- tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1 SUPPORT_SH5_32MEDIA=1 SUPPORT_SH5_32MEDIA_NOFPU=1 SUPPORT_SH5_64MEDIA=1 SUPPORT_SH5_64MEDIA_NOFPU=1" ++ tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1 SUPPORT_SH5_32MEDIA=1 SUPPORT_SH5_32MEDIA_NOFPU=1 SUPPORT_SH5_64MEDIA=1 SUPPORT_SH5_64MEDIA_NOFPU=1 SUPPORT_SHJ2=1" + fi + tm_file="$tm_file ./sysroot-suffix.h" + tmake_file="$tmake_file t-sysroot-suffix" +@@ -4269,6 +4271,8 @@ case "${target}" in + ;; + m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al) + ;; ++ mj2) ++ ;; + *) + 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 +@@ -4478,7 +4482,7 @@ case ${target} in + tmake_file="rs6000/t-rs6000 ${tmake_file}" + ;; + +- sh[123456ble]*-*-* | sh-*-*) ++ sh[123456blej]*-*-* | sh-*-*) + 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 +@@ -45,6 +45,7 @@ struct sh_atomic_model + hard_llcs, + soft_tcb, + soft_imask, ++ hard_cas, + + num_models + }; +@@ -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 +--- a/gcc/config/sh/sh.c ++++ b/gcc/config/sh/sh.c +@@ -692,6 +692,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"; ++ model_names[sh_atomic_model::hard_cas] = "hard-cas"; + + 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) + 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"; ++ model_cdef_names[sh_atomic_model::hard_cas] = "HARD_CAS"; + + sh_atomic_model ret; + ret.type = sh_atomic_model::none; +@@ -780,6 +782,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); + ++ if (ret.type == sh_atomic_model::hard_cas && !TARGET_SHJ2) ++ err_ret ("atomic model %s is only available J2 targets", ret.name); ++ + return ret; + + #undef err_ret +@@ -845,6 +850,8 @@ sh_option_override (void) + sh_cpu = PROCESSOR_SH2E; + if (TARGET_SH2A) + sh_cpu = PROCESSOR_SH2A; ++ if (TARGET_SHJ2) ++ sh_cpu = PROCESSOR_SHJ2; + if (TARGET_SH3) + sh_cpu = PROCESSOR_SH3; + if (TARGET_SH3E) +diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h +index 7187c23..3bc2817 100644 +--- a/gcc/config/sh/sh.h ++++ b/gcc/config/sh/sh.h +@@ -106,6 +106,7 @@ extern int code_for_indirect_jump_scratch; + #define SUPPORT_SH4_SINGLE 1 + #define SUPPORT_SH2A 1 + #define SUPPORT_SH2A_SINGLE 1 ++#define SUPPORT_SHJ2 1 + #endif + + #define TARGET_DIVIDE_INV \ +@@ -157,6 +158,7 @@ extern int code_for_indirect_jump_scratch; + #define SELECT_SH5_32MEDIA_NOFPU (MASK_SH5 | MASK_SH_E) + #define SELECT_SH5_COMPACT (MASK_SH5 | MASK_SH4 | SELECT_SH3E) + #define SELECT_SH5_COMPACT_NOFPU (MASK_SH5 | SELECT_SH3) ++#define SELECT_SHJ2 (MASK_SHJ2 | SELECT_SH2) + + #if SUPPORT_SH1 + #define SUPPORT_SH2 1 +@@ -164,6 +166,7 @@ extern int code_for_indirect_jump_scratch; + #if SUPPORT_SH2 + #define SUPPORT_SH3 1 + #define SUPPORT_SH2A_NOFPU 1 ++#define SUPPORT_SHJ2 1 + #endif + #if SUPPORT_SH3 + #define SUPPORT_SH4_NOFPU 1 +@@ -211,7 +214,7 @@ extern int code_for_indirect_jump_scratch; + #define MASK_ARCH (MASK_SH1 | MASK_SH2 | MASK_SH3 | MASK_SH_E | MASK_SH4 \ + | MASK_HARD_SH2A | MASK_HARD_SH2A_DOUBLE | MASK_SH4A \ + | MASK_HARD_SH4 | MASK_FPU_SINGLE | MASK_SH5 \ +- | MASK_FPU_SINGLE_ONLY) ++ | MASK_FPU_SINGLE_ONLY | MASK_SHJ2) + + /* This defaults us to big-endian. */ + #ifndef TARGET_ENDIAN_DEFAULT +@@ -289,8 +292,8 @@ extern int code_for_indirect_jump_scratch; + %{m5-compact*:--isa=SHcompact} \ + %{m5-32media*:--isa=SHmedia --abi=32} \ + %{m5-64media*:--isa=SHmedia --abi=64} \ +-%{m4al:-dsp} %{mcut2-workaround:-cut2-workaround}" +- ++%{m4al:-dsp} %{mcut2-workaround:-cut2-workaround} \ ++%{mj2:-isa=j2}" + #define ASM_SPEC SH_ASM_SPEC + + #ifndef SUBTARGET_ASM_ENDIAN_SPEC +@@ -1853,7 +1856,7 @@ struct sh_args { + + /* Nonzero if the target supports dynamic shift instructions + like shad and shld. */ +-#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A) ++#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A || TARGET_SHJ2) + + /* 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 +@@ -2185,6 +2188,7 @@ enum processor_type { + PROCESSOR_SH2, + PROCESSOR_SH2E, + PROCESSOR_SH2A, ++ PROCESSOR_SHJ2, + PROCESSOR_SH3, + PROCESSOR_SH3E, + PROCESSOR_SH4, +diff --git a/gcc/config/sh/sh.opt b/gcc/config/sh/sh.opt +index 1026c73..bac47ed 100644 +--- a/gcc/config/sh/sh.opt ++++ b/gcc/config/sh/sh.opt +@@ -71,6 +71,10 @@ m2e + Target RejectNegative Condition(SUPPORT_SH2E) + Generate SH2e code. + ++mj2 ++Target RejectNegative Mask(SHJ2) Condition(SUPPORT_SHJ2) ++Generate J2 code. ++ + m3 + 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 +--- a/gcc/config/sh/sync.md ++++ b/gcc/config/sh/sync.md +@@ -240,6 +240,9 @@ + || (TARGET_SH4A && mode == SImode && !TARGET_ATOMIC_STRICT)) + atomic_insn = gen_atomic_compare_and_swap_hard (old_val, mem, + exp_val, new_val); ++ else if (TARGET_ATOMIC_HARD_CAS && mode == SImode) ++ atomic_insn = gen_atomic_compare_and_swap_cas (old_val, mem, ++ exp_val, new_val); + else if (TARGET_ATOMIC_SOFT_GUSA) + atomic_insn = gen_atomic_compare_and_swap_soft_gusa (old_val, mem, + exp_val, new_val); +@@ -306,6 +309,57 @@ + } + [(set_attr "length" "14")]) + ++(define_expand "atomic_compare_and_swapsi_cas" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI ++ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] ++ UNSPECV_CMPXCHG_1))] ++ "TARGET_ATOMIC_HARD_CAS" ++{ ++ rtx mem = gen_rtx_REG (SImode, 0); ++ emit_move_insn (mem, force_reg (SImode, XEXP (operands[1], 0))); ++ emit_insn (gen_shj2_cas (operands[0], mem, operands[2], operands[3])); ++ DONE; ++}) ++ ++(define_insn "shj2_cas" ++ [(set (match_operand:SI 0 "register_operand" "=&r") ++ (unspec_volatile:SI ++ [(match_operand:SI 1 "register_operand" "=r") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "0")] ++ UNSPECV_CMPXCHG_1)) ++ (set (reg:SI T_REG) ++ (unspec_volatile:SI [(const_int 0)] UNSPECV_CMPXCHG_3))] ++ "TARGET_ATOMIC_HARD_CAS" ++ "cas.l %2,%0,@%1" ++ [(set_attr "length" "2")] ++) ++ ++(define_expand "atomic_compare_and_swapqi_cas" ++ [(set (match_operand:SI 0 "arith_reg_dest" "=&r") ++ (unspec_volatile:SI ++ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra") ++ (match_operand:SI 2 "arith_operand" "rI08") ++ (match_operand:SI 3 "arith_operand" "rI08")] ++ UNSPECV_CMPXCHG_1))] ++ "TARGET_ATOMIC_HARD_CAS" ++{FAIL;} ++) ++ ++(define_expand "atomic_compare_and_swaphi_cas" ++ [(set (match_operand:SI 0 "arith_reg_dest" "=&r") ++ (unspec_volatile:SI ++ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra") ++ (match_operand:SI 2 "arith_operand" "rI08") ++ (match_operand:SI 3 "arith_operand" "rI08")] ++ UNSPECV_CMPXCHG_1))] ++ "TARGET_ATOMIC_HARD_CAS" ++{FAIL;} ++) ++ + ;; The QIHImode llcs patterns modify the address register of the memory + ;; operand. In order to express that, we have to open code the memory + ;; operand. Initially the insn is expanded like every other atomic insn +diff --git a/gcc/config/sh/t-sh b/gcc/config/sh/t-sh +index 348cc0b..8e6bdaf 100644 +--- a/gcc/config/sh/t-sh ++++ b/gcc/config/sh/t-sh +@@ -52,7 +52,7 @@ MULTILIB_MATCHES = $(shell \ + m4-single,m4-100-single,m4-200-single,m4-300-single,m4a-single \ + m4,m4-100,m4-200,m4-300,m4a \ + m5-32media,m5-compact,m5-32media \ +- m5-32media-nofpu,m5-compact-nofpu,m5-32media-nofpu; do \ ++ m5-32media-nofpu,m5-compact-nofpu,m5-32media-nofpu,mj2; do \ + subst= ; \ + for lib in `echo $$abi|tr , ' '` ; do \ + if test "`echo $$multilibs|sed s/$$lib//`" != "$$multilibs"; then \ +@@ -65,9 +65,9 @@ MULTILIB_MATCHES = $(shell \ + + # SH1 and SH2A support big endian only. + ifeq ($(DEFAULT_ENDIAN),ml) +-MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG) ++MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG) + else +-MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG) ++MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG) + endif + + MULTILIB_OSDIRNAMES = \ +@@ -96,6 +96,7 @@ MULTILIB_OSDIRNAMES = \ + m5-compact-nofpu=!m5-compact-nofpu $(OTHER_ENDIAN)/m5-compact-nofpu=!$(OTHER_ENDIAN)/m5-compact-nofpu \ + m5-64media=!m5-64media $(OTHER_ENDIAN)/m5-64media=!$(OTHER_ENDIAN)/m5-64media \ + m5-64media-nofpu=!m5-64media-nofpu $(OTHER_ENDIAN)/m5-64media-nofpu=!$(OTHER_ENDIAN)/m5-64media-nofpu ++ mj2=!j2 + + $(out_object_file): gt-sh.h + gt-sh.h : s-gtype ; @true diff --git a/patches/gcc-6.5.0/0012-s390x-muslldso.diff b/patches/gcc-6.5.0/0012-s390x-muslldso.diff new file mode 100644 index 0000000..62c306b --- /dev/null +++ b/patches/gcc-6.5.0/0012-s390x-muslldso.diff @@ -0,0 +1,14 @@ +diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h +index 9b00af7..3aacde6 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 + #define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1" + #define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1" + ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-s390.so.1" ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-s390x.so.1" ++ + #undef LINK_SPEC + #define LINK_SPEC \ + "%{m31:-m elf_s390}%{m64:-m elf64_s390} \ diff --git a/patches/gcc-6.5.0/0013-microblaze-pr65649.diff b/patches/gcc-6.5.0/0013-microblaze-pr65649.diff new file mode 100644 index 0000000..5604485 --- /dev/null +++ b/patches/gcc-6.5.0/0013-microblaze-pr65649.diff @@ -0,0 +1,20 @@ +--- 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 @@ + unsigned long value_long; + REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (op), + value_long); +- fprintf (file, HOST_WIDE_INT_PRINT_HEX, value_long); ++ fprintf (file, "0x%lx", value_long); + } + else + { +@@ -2423,7 +2423,7 @@ + print_operand_address (file, XEXP (op, 0)); + } + else if (letter == 'm') +- fprintf (file, HOST_WIDE_INT_PRINT_DEC, (1L << INTVAL (op))); ++ fprintf (file, "%ld", (1L << INTVAL (op))); + else + output_addr_const (file, op); + } diff --git a/patches/gcc-6.5.0/0014-m68k.diff b/patches/gcc-6.5.0/0014-m68k.diff new file mode 100644 index 0000000..b3765bf --- /dev/null +++ b/patches/gcc-6.5.0/0014-m68k.diff @@ -0,0 +1,36 @@ +diff -ur gcc-6.4.0/gcc/config/m68k/linux.h gcc-6.4.0.new/gcc/config/m68k/linux.h +--- gcc-6.4.0/gcc/config/m68k/linux.h 2016-01-04 09:30:50.000000000 -0500 ++++ gcc-6.4.0.new/gcc/config/m68k/linux.h 2018-06-12 20:03:47.047502695 -0400 +@@ -73,6 +73,9 @@ + + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" + ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-m68k.so.1" ++ + #undef LINK_SPEC + #define LINK_SPEC "-m m68kelf %{shared} \ + %{!shared: \ +diff -ur gcc-6.4.0/libgcc/config/m68k/linux-atomic.c gcc-6.4.0.new/libgcc/config/m68k/linux-atomic.c +--- gcc-6.4.0/libgcc/config/m68k/linux-atomic.c 2016-01-04 09:30:50.000000000 -0500 ++++ gcc-6.4.0.new/libgcc/config/m68k/linux-atomic.c 2018-06-07 16:15:11.610163418 -0400 +@@ -33,7 +33,6 @@ + using the kernel helper defined below. There is no support for + 64-bit operations yet. */ + +-#include + #include + + #ifndef __NR_atomic_cmpxchg_32 +diff -ur gcc-6.4.0/libgcc/config/m68k/linux-unwind.h gcc-6.4.0.new/libgcc/config/m68k/linux-unwind.h +--- gcc-6.4.0/libgcc/config/m68k/linux-unwind.h 2016-01-04 09:30:50.000000000 -0500 ++++ gcc-6.4.0.new/libgcc/config/m68k/linux-unwind.h 2018-06-07 16:17:16.964591108 -0400 +@@ -37,7 +37,7 @@ + stack_t uc_stack; + mcontext_t uc_mcontext; + unsigned long uc_filler[80]; +- __sigset_t uc_sigmask; ++ sigset_t uc_sigmask; + }; + + #define MD_FALLBACK_FRAME_STATE_FOR m68k_fallback_frame_state diff --git a/patches/gcc-6.5.0/0016-invalid_tls_model.diff b/patches/gcc-6.5.0/0016-invalid_tls_model.diff new file mode 100644 index 0000000..d3b2b8e --- /dev/null +++ b/patches/gcc-6.5.0/0016-invalid_tls_model.diff @@ -0,0 +1,51 @@ +--- gcc-7.3.0/libgomp/configure.tgt.orig 2018-09-25 13:44:16.654561098 -0400 ++++ gcc-7.3.0/libgomp/configure.tgt 2018-09-25 13:44:50.452688100 -0400 +@@ -10,23 +10,6 @@ + # XCFLAGS Add extra compile flags to use. + # XLDFLAGS Add extra link flags to use. + +-# Optimize TLS usage by avoiding the overhead of dynamic allocation. +-if test $gcc_cv_have_tls = yes ; then +- case "${target}" in +- +- *-*-k*bsd*-gnu*) +- ;; +- +- *-*-linux* | *-*-gnu*) +- XCFLAGS="${XCFLAGS} -ftls-model=initial-exec" +- ;; +- +- *-*-rtems*) +- XCFLAGS="${XCFLAGS} -ftls-model=local-exec" +- ;; +- esac +-fi +- + # Since we require POSIX threads, assume a POSIX system by default. + config_path="posix" + +--- gcc-7.3.0/libitm/configure.tgt.orig 2018-09-25 13:47:31.019296903 -0400 ++++ gcc-7.3.0/libitm/configure.tgt 2018-09-25 13:47:37.676322335 -0400 +@@ -27,22 +27,6 @@ + # XCFLAGS Add extra compile flags to use. + # XLDFLAGS Add extra link flags to use. + +-# Optimize TLS usage by avoiding the overhead of dynamic allocation. +-if test "$gcc_cv_have_tls" = yes ; then +- case "${target}" in +- +- # For x86, we use slots in the TCB head for most of our TLS. +- # The setup of those slots in beginTransaction can afford to +- # use the global-dynamic model. +- i[456]86-*-linux* | x86_64-*-linux*) +- ;; +- +- *-*-linux*) +- XCFLAGS="${XCFLAGS} -ftls-model=initial-exec" +- ;; +- esac +-fi +- + # Map the target cpu to an ARCH sub-directory. At the same time, + # work out any special compilation flags as necessary. + case "${target_cpu}" in diff --git a/patches/gcc-6.5.0/0017-c++-abi-break.diff b/patches/gcc-6.5.0/0017-c++-abi-break.diff new file mode 100644 index 0000000..ed5ede2 --- /dev/null +++ b/patches/gcc-6.5.0/0017-c++-abi-break.diff @@ -0,0 +1,43 @@ +From https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87822 +Author: Jonathan Wakely +Date: Wed Oct 31 13:03:25 2018 +0000 + + PR libstdc++/87822 fix layout change for nested std::pair + + The introduction of the empty __pair_base base class for PR 86751 + changed the layout of std::pair, ...>. The outer pair and + its first member both have a base class of the same type, which cannot + exist at the same address. This causes the first member to be at a + non-zero offset. + + The solution is to make the base class depend on the template + parameters, so that each pair type has a different base class type, + which allows the base classes of the outer pair and its first member to + have the same address. + + PR libstdc++/87822 + * include/bits/stl_pair.h (__pair_base): Change to class template. + (pair): Make base class type depend on template parameters. + +diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h +index a30b630b4fd..5a4823ab018 100644 +--- a/libstdc++-v3/include/bits/stl_pair.h ++++ b/libstdc++-v3/include/bits/stl_pair.h +@@ -183,7 +183,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + }; + #endif // C++11 + +- class __pair_base ++ template class __pair_base + { + #if __cplusplus >= 201103L + template friend struct pair; +@@ -202,7 +202,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + */ + template + struct pair +- : private __pair_base ++ : private __pair_base<_T1, _T2> + { + typedef _T1 first_type; /// @c first_type is the first bound type + typedef _T2 second_type; /// @c second_type is the second bound type diff --git a/patches/gcc-6.5.0/0018-Revert-PR-driver-81523-Make-static-override-pie.diff b/patches/gcc-6.5.0/0018-Revert-PR-driver-81523-Make-static-override-pie.diff new file mode 100644 index 0000000..baceb01 --- /dev/null +++ b/patches/gcc-6.5.0/0018-Revert-PR-driver-81523-Make-static-override-pie.diff @@ -0,0 +1,147 @@ +diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h +index de605b0c466..2787a3d16be 100644 +--- a/gcc/config/gnu-user.h ++++ b/gcc/config/gnu-user.h +@@ -50,28 +50,19 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + + #if defined HAVE_LD_PIE + #define GNU_USER_TARGET_STARTFILE_SPEC \ +- "%{shared:; \ +- pg|p|profile:gcrt1.o%s; \ +- static:crt1.o%s; \ +- " PIE_SPEC ":Scrt1.o%s; \ +- :crt1.o%s} \ +- crti.o%s \ +- %{static:crtbeginT.o%s; \ +- shared|" PIE_SPEC ":crtbeginS.o%s; \ +- :crtbegin.o%s} \ ++ "%{!shared: %{pg|p|profile:gcrt1.o%s;: \ ++ %{" PIE_SPEC ":Scrt1.o%s} %{" NO_PIE_SPEC ":crt1.o%s}}} \ ++ crti.o%s %{static:crtbeginT.o%s;: %{shared:crtbeginS.o%s} \ ++ %{" PIE_SPEC ":crtbeginS.o%s} \ ++ %{" NO_PIE_SPEC ":crtbegin.o%s}} \ + %{fvtable-verify=none:%s; \ + fvtable-verify=preinit:vtv_start_preinit.o%s; \ + fvtable-verify=std:vtv_start.o%s} \ + " CRTOFFLOADBEGIN + #else + #define GNU_USER_TARGET_STARTFILE_SPEC \ +- "%{shared:; \ +- pg|p|profile:gcrt1.o%s; \ +- :crt1.o%s} \ +- crti.o%s \ +- %{static:crtbeginT.o%s; \ +- shared|pie:crtbeginS.o%s; \ +- :crtbegin.o%s} \ ++ "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \ ++ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \ + %{fvtable-verify=none:%s; \ + fvtable-verify=preinit:vtv_start_preinit.o%s; \ + fvtable-verify=std:vtv_start.o%s} \ +@@ -91,20 +82,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + "%{fvtable-verify=none:%s; \ + fvtable-verify=preinit:vtv_end_preinit.o%s; \ + fvtable-verify=std:vtv_end.o%s} \ +- %{static:crtend.o%s; \ +- shared|" PIE_SPEC ":crtendS.o%s; \ +- :crtend.o%s} \ +- crtn.o%s \ ++ %{shared:crtendS.o%s;: %{" PIE_SPEC ":crtendS.o%s} \ ++ %{" NO_PIE_SPEC ":crtend.o%s}} crtn.o%s \ + " CRTOFFLOADEND + #else + #define GNU_USER_TARGET_ENDFILE_SPEC \ + "%{fvtable-verify=none:%s; \ + fvtable-verify=preinit:vtv_end_preinit.o%s; \ + fvtable-verify=std:vtv_end.o%s} \ +- %{static:crtend.o%s; \ +- shared|pie:crtendS.o%s; \ +- :crtend.o%s} \ +- crtn.o%s \ ++ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s \ + " CRTOFFLOADEND + #endif + #undef ENDFILE_SPEC +diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h +index d522de03f4a..13b27873719 100644 +--- a/gcc/config/sol2.h ++++ b/gcc/config/sol2.h +@@ -174,9 +174,9 @@ along with GCC; see the file COPYING3. If not see + %{!ansi:values-Xa.o%s}" + + #if defined(HAVE_LD_PIE) && defined(HAVE_SOLARIS_CRTS) +-#define STARTFILE_CRTBEGIN_SPEC "%{static:crtbegin.o%s; \ +- shared|" PIE_SPEC ":crtbeginS.o%s; \ +- :crtbegin.o%s}" ++#define STARTFILE_CRTBEGIN_SPEC "%{shared:crtbeginS.o%s} \ ++ %{" PIE_SPEC ":crtbeginS.o%s} \ ++ %{" NO_PIE_SPEC ":crtbegin.o%s}" + #else + #define STARTFILE_CRTBEGIN_SPEC "crtbegin.o%s" + #endif +@@ -224,9 +224,9 @@ along with GCC; see the file COPYING3. If not see + #endif + + #if defined(HAVE_LD_PIE) && defined(HAVE_SOLARIS_CRTS) +-#define ENDFILE_CRTEND_SPEC "%{static:crtend.o%s; \ +- shared|" PIE_SPEC ":crtendS.o%s; \ +- :crtend.o%s}" ++#define ENDFILE_CRTEND_SPEC "%{shared:crtendS.o%s;: \ ++ %{" PIE_SPEC ":crtendS.o%s} \ ++ %{" NO_PIE_SPEC ":crtend.o%s}}" + #else + #define ENDFILE_CRTEND_SPEC "crtend.o%s" + #endif +diff --git a/gcc/gcc.c b/gcc/gcc.c +index e2fae4ef055..91eb0534722 100644 +--- a/gcc/gcc.c ++++ b/gcc/gcc.c +@@ -873,7 +873,8 @@ proper position among the other output files. */ + #endif + + #ifdef ENABLE_DEFAULT_PIE +-#define PIE_SPEC "!no-pie" ++#define NO_PIE_SPEC "no-pie|static" ++#define PIE_SPEC NO_PIE_SPEC "|r|shared:;" + #define NO_FPIE1_SPEC "fno-pie" + #define FPIE1_SPEC NO_FPIE1_SPEC ":;" + #define NO_FPIE2_SPEC "fno-PIE" +@@ -894,6 +895,7 @@ proper position among the other output files. */ + #define FPIE_OR_FPIC_SPEC NO_FPIE_AND_FPIC_SPEC ":;" + #else + #define PIE_SPEC "pie" ++#define NO_PIE_SPEC PIE_SPEC "|r|shared:;" + #define FPIE1_SPEC "fpie" + #define NO_FPIE1_SPEC FPIE1_SPEC ":;" + #define FPIE2_SPEC "fPIE" +@@ -922,7 +924,7 @@ proper position among the other output files. */ + #else + #define LD_PIE_SPEC "" + #endif +-#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} " ++#define LINK_PIE_SPEC "%{no-pie:} " "%{" PIE_SPEC ":" LD_PIE_SPEC "} " + #endif + + #ifndef LINK_BUILDID_SPEC +@@ -1010,10 +1012,8 @@ proper position among the other output files. */ + #endif + + /* -u* was put back because both BSD and SysV seem to support it. */ +-/* %{static|no-pie:} simply prevents an error message: +- 1. If the target machine doesn't handle -static. +- 2. If PIE isn't enabled by default. +- */ ++/* %{static:} simply prevents an error message if the target machine ++ doesn't handle -static. */ + /* We want %{T*} after %{L*} and %D so that it can be used to specify linker + scripts which exist in user specified directories, or in standard + directories. */ +@@ -1030,7 +1030,7 @@ proper position among the other output files. */ + "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ + "%X %{o*} %{e*} %{N} %{n} %{r}\ + %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} \ +- %{static|no-pie:} %{L*} %(mfwrap) %(link_libgcc) " \ ++ %{static:} %{L*} %(mfwrap) %(link_libgcc) " \ + VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o " CHKP_SPEC " \ + %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ + %:include(libgomp.spec)%(link_gomp)}\ diff --git a/patches/gcc-6.5.0/0019-Revert-RS6000-linux-startfile-endfile.diff b/patches/gcc-6.5.0/0019-Revert-RS6000-linux-startfile-endfile.diff new file mode 100644 index 0000000..c9c5ab0 --- /dev/null +++ b/patches/gcc-6.5.0/0019-Revert-RS6000-linux-startfile-endfile.diff @@ -0,0 +1,57 @@ +diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h +index cbee89140dd..de386291a51 100644 +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -757,34 +757,24 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN) + #define CRTOFFLOADEND "" + #endif + +-/* STARTFILE_LINUX_SPEC should be the same as GNU_USER_TARGET_STARTFILE_SPEC +- but with the mnewlib ecrti.o%s selection substituted for crti.o%s. */ +-#define STARTFILE_LINUX_SPEC \ +- "%{shared:; \ +- pg|p|profile:gcrt1.o%s; \ +- static:crt1.o%s; \ +- " PIE_SPEC ":Scrt1.o%s; \ +- :crt1.o%s} \ +- %{mnewlib:ecrti.o%s;:crti.o%s} \ +- %{static:crtbeginT.o%s; \ +- shared|" PIE_SPEC ":crtbeginS.o%s; \ +- :crtbegin.o%s} \ +- %{fvtable-verify=none:%s; \ +- fvtable-verify=preinit:vtv_start_preinit.o%s; \ +- fvtable-verify=std:vtv_start.o%s} \ +- " CRTOFFLOADBEGIN +- +-/* ENDFILE_LINUX_SPEC should be the same as GNU_USER_TARGET_ENDFILE_SPEC +- but with the mnewlib ecrtn.o%s selection substituted for crtn.o%s. */ +-#define ENDFILE_LINUX_SPEC \ +- "%{fvtable-verify=none:%s; \ +- fvtable-verify=preinit:vtv_end_preinit.o%s; \ +- fvtable-verify=std:vtv_end.o%s} \ +- %{static:crtend.o%s; \ +- shared|" PIE_SPEC ":crtendS.o%s; \ +- :crtend.o%s} \ +- %{mnewlib:ecrtn.o%s;:crtn.o%s} \ +- " CRTOFFLOADEND ++#ifdef HAVE_LD_PIE ++#define STARTFILE_LINUX_SPEC "\ ++%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ ++%{mnewlib:ecrti.o%s;:crti.o%s} \ ++%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \ ++" CRTOFFLOADBEGIN ++#else ++#define STARTFILE_LINUX_SPEC "\ ++%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \ ++%{mnewlib:ecrti.o%s;:crti.o%s} \ ++%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \ ++" CRTOFFLOADBEGIN ++#endif ++ ++#define ENDFILE_LINUX_SPEC "\ ++%{shared|pie:crtendS.o%s;:crtend.o%s} \ ++%{mnewlib:ecrtn.o%s;:crtn.o%s} \ ++" CRTOFFLOADEND + + #define LINK_START_LINUX_SPEC "" + diff --git a/patches/gcc-6.5.0/0020-static-pie-support.diff b/patches/gcc-6.5.0/0020-static-pie-support.diff new file mode 100644 index 0000000..e2a9b9c --- /dev/null +++ b/patches/gcc-6.5.0/0020-static-pie-support.diff @@ -0,0 +1,40 @@ +diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h +index b0bf40a..d4b56fe 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 + #if defined HAVE_LD_PIE + #define GNU_USER_TARGET_STARTFILE_SPEC \ + "%{!shared: %{pg|p|profile:gcrt1.o%s;: \ +- %{" PIE_SPEC ":Scrt1.o%s} %{" NO_PIE_SPEC ":crt1.o%s}}} \ +- crti.o%s %{static:crtbeginT.o%s;: %{shared:crtbeginS.o%s} \ ++ %{" PIE_SPEC ":%{static:rcrt1.o%s;:Scrt1.o%s}} %{" NO_PIE_SPEC ":crt1.o%s}}} \ ++ crti.o%s %{shared:crtbeginS.o%s;: \ + %{" PIE_SPEC ":crtbeginS.o%s} \ +- %{" NO_PIE_SPEC ":crtbegin.o%s}} \ ++ %{" NO_PIE_SPEC ":%{static:crtbeginT.o%s;:crtbegin.o%s}}} \ + %{fvtable-verify=none:%s; \ + 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 +--- a/gcc/gcc.c ++++ b/gcc/gcc.c +@@ -870,7 +870,7 @@ proper position among the other output files. */ + #endif + + #ifdef ENABLE_DEFAULT_PIE +-#define NO_PIE_SPEC "no-pie|static" ++#define NO_PIE_SPEC "no-pie" + #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. */ + #ifndef LINK_PIE_SPEC + #ifdef HAVE_LD_PIE + #ifndef LD_PIE_SPEC +-#define LD_PIE_SPEC "-pie" ++#define LD_PIE_SPEC "-pie %{static:--no-dynamic-linker -Bsymbolic}" + #endif + #else + #define LD_PIE_SPEC ""