summaryrefslogtreecommitdiff
path: root/etc/patches
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2024-05-13 10:39:04 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2024-05-13 18:13:38 +0200
commit89dc13243b7311669e5e4ad0ff8abbc0c7216dfd (patch)
tree3721220e7efbc62be985911fd0f74077b77c55c0 /etc/patches
parenta1512f1ad7a143493d0d38a0b715e06d8ba62759 (diff)
downloadbootstrappable-toolchain-89dc13243b7311669e5e4ad0ff8abbc0c7216dfd.tar.gz
Add gcc 14.1.0
Diffstat (limited to 'etc/patches')
-rw-r--r--etc/patches/TARGETS1
-rw-r--r--etc/patches/gcc-14/reproducibility/0001-strip-build-directory-from-config-arguments.patch42
-rw-r--r--etc/patches/gcc-14/reproducibility/0002-strip-build-directory-from-fixincludes.patch29
-rw-r--r--etc/patches/gcc-14/reproducibility/0003-strip-build-directory-from-mkheaders.conf.patch25
-rw-r--r--etc/patches/gcc-14/reproducibility/0004-compute-reproducible-checksums.patch75
-rw-r--r--etc/patches/gcc-14/reproducibility/0005-do-not-hardcode-rpath-into-cc1-libs.patch26
-rw-r--r--etc/patches/gcc-14/reproducibility/series5
-rw-r--r--etc/patches/musl-cross-make-fe915821/patches/gcc-14/0001-ssp_nonshared.diff14
-rw-r--r--etc/patches/musl-cross-make-fe915821/patches/gcc-14/0002-posix_memalign.diff30
-rw-r--r--etc/patches/musl-cross-make-fe915821/patches/gcc-14/0003-j2.diff346
-rw-r--r--etc/patches/musl-cross-make-fe915821/patches/gcc-14/0004-static-pie.diff92
-rw-r--r--etc/patches/musl-cross-make-fe915821/patches/gcc-14/0005-m68k-sqrt.diff20
12 files changed, 705 insertions, 0 deletions
diff --git a/etc/patches/TARGETS b/etc/patches/TARGETS
index ca310cf..6eab87b 100644
--- a/etc/patches/TARGETS
+++ b/etc/patches/TARGETS
@@ -1,6 +1,7 @@
{ "gcc-4.7.4": {"type": "install", "deps": [["TREE", null, "gcc-4.7.4"]]}
, "gcc-10": {"type": "install", "deps": [["TREE", null, "gcc-10"]]}
, "gcc-13": {"type": "install", "deps": [["TREE", null, "gcc-13"]]}
+, "gcc-14": {"type": "install", "deps": [["TREE", null, "gcc-14"]]}
, "musl-cross-make-fe915821":
{"type": "install", "deps": [["TREE", null, "musl-cross-make-fe915821"]]}
, "clang-16": {"type": "install", "deps": [["TREE", null, "clang-16"]]}
diff --git a/etc/patches/gcc-14/reproducibility/0001-strip-build-directory-from-config-arguments.patch b/etc/patches/gcc-14/reproducibility/0001-strip-build-directory-from-config-arguments.patch
new file mode 100644
index 0000000..6cd1d63
--- /dev/null
+++ b/etc/patches/gcc-14/reproducibility/0001-strip-build-directory-from-config-arguments.patch
@@ -0,0 +1,42 @@
+From 5ff2165c35eeae5df04df564663cadf6a889fb7c Mon Sep 17 00:00:00 2001
+From: Oliver Reiche <oliver.reiche@huawei.com>
+Date: Mon, 14 Aug 2023 12:33:04 +0200
+Subject: [PATCH 1/5] Strip build directory from config arguments
+
+... to achieve a reproducible binary, which contains the
+configure string. For this to work, the user needs to set
+"BUILD_ROOT_DIR" before building.
+---
+ gcc/configure | 2 ++
+ gcc/configure.ac | 2 ++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/gcc/configure b/gcc/configure
+index 23da7d55d..43561c617 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -13370,6 +13370,8 @@ fi
+ sed -e 's/\\/\\\\/g; s/"/\\"/g' <<EOF >conftest.out
+ $gcc_config_arguments
+ EOF
++# Remove host machine's build path from config arguments
++sed -i 's|'${BUILD_ROOT_DIR:-/nonexistent}'|/build|g' conftest.out
+ gcc_config_arguments_str=`cat conftest.out`
+ rm -f conftest.out
+
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index d7cf0b92c..5be002278 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -2200,6 +2200,8 @@ fi
+ sed -e 's/\\/\\\\/g; s/"/\\"/g' <<EOF >conftest.out
+ $gcc_config_arguments
+ EOF
++# Remove host machine's build path from config arguments
++sed -i 's|'${BUILD_ROOT_DIR:-/nonexistent}'|/build|g' conftest.out
+ gcc_config_arguments_str=`cat conftest.out`
+ rm -f conftest.out
+
+--
+2.30.2
+
diff --git a/etc/patches/gcc-14/reproducibility/0002-strip-build-directory-from-fixincludes.patch b/etc/patches/gcc-14/reproducibility/0002-strip-build-directory-from-fixincludes.patch
new file mode 100644
index 0000000..8ce7a8a
--- /dev/null
+++ b/etc/patches/gcc-14/reproducibility/0002-strip-build-directory-from-fixincludes.patch
@@ -0,0 +1,29 @@
+From 561f33bc220ba86947a7f99cc503d4dee13be089 Mon Sep 17 00:00:00 2001
+From: Oliver Reiche <oliver.reiche@huawei.com>
+Date: Fri, 18 Aug 2023 14:36:57 +0200
+Subject: [PATCH 2/5] Strip build directory from fixincludes
+
+... to achieve a reproducible binary, which contains the
+configure string. For this to work, the user needs to set
+"BUILD_ROOT_DIR" before building.
+---
+ fixincludes/configure | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/fixincludes/configure b/fixincludes/configure
+index 662c94dc1..c316bd6f9 100755
+--- a/fixincludes/configure
++++ b/fixincludes/configure
+@@ -6397,6 +6397,9 @@ cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+ BEGIN {
+ _ACEOF
+
++# Remove host machine's build path from confdefs.h
++sed -i 's|'${BUILD_ROOT_DIR:-/nonexistent}'|/build|g' confdefs.h
++
+ # Transform confdefs.h into an awk script `defines.awk', embedded as
+ # here-document in config.status, that substitutes the proper values into
+ # config.h.in to produce config.h.
+--
+2.30.2
+
diff --git a/etc/patches/gcc-14/reproducibility/0003-strip-build-directory-from-mkheaders.conf.patch b/etc/patches/gcc-14/reproducibility/0003-strip-build-directory-from-mkheaders.conf.patch
new file mode 100644
index 0000000..f37fb43
--- /dev/null
+++ b/etc/patches/gcc-14/reproducibility/0003-strip-build-directory-from-mkheaders.conf.patch
@@ -0,0 +1,25 @@
+From fab4c6f6bf312f867ffec0cdf46f31b5e1fe48f9 Mon Sep 17 00:00:00 2001
+From: Oliver Reiche <oliver.reiche@huawei.com>
+Date: Fri, 8 Sep 2023 16:16:29 +0200
+Subject: [PATCH 3/5] Strip build directory from mkheaders.conf
+
+---
+ gcc/Makefile.in | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index a74761b7a..2e656c540 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -4182,6 +4182,8 @@ install-mkheaders: stmp-int-hdrs install-itoolsdirs \
+ >> $(DESTDIR)$(itoolsdatadir)/mkheaders.conf
+ echo 'STMP_FIXINC="$(STMP_FIXINC)"' \
+ >> $(DESTDIR)$(itoolsdatadir)/mkheaders.conf
++ sed -i 's|'$${BUILD_ROOT_DIR:-/nonexistent}'|/build|g' \
++ $(DESTDIR)$(itoolsdatadir)/mkheaders.conf
+
+ # Use this target to install the program `collect2' under the name `collect2'.
+ install-collect2: collect2 installdirs
+--
+2.30.2
+
diff --git a/etc/patches/gcc-14/reproducibility/0004-compute-reproducible-checksums.patch b/etc/patches/gcc-14/reproducibility/0004-compute-reproducible-checksums.patch
new file mode 100644
index 0000000..ad18a34
--- /dev/null
+++ b/etc/patches/gcc-14/reproducibility/0004-compute-reproducible-checksums.patch
@@ -0,0 +1,75 @@
+From 3d2d2999d07cd7425e6a8a96047e72ebbc842ea0 Mon Sep 17 00:00:00 2001
+From: Oliver Reiche <oliver.reiche@huawei.com>
+Date: Mon, 21 Aug 2023 18:03:56 +0200
+Subject: [PATCH 4/5] Compute reproducible checksums
+
+... for variable toolchain paths:
+* remove linker path from gcc's checksum-options
+* disable thin archives (for stripping libbackend.a)
+* strip debug info before computing checksums
+For removing the linker path, the user needs to set
+"BUILD_ROOT_DIR" before building.
+---
+ gcc/Makefile.in | 3 ++-
+ gcc/c/Make-lang.in | 6 +++++-
+ gcc/cp/Make-lang.in | 6 +++++-
+ 3 files changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index 2e656c540..9da99cb5c 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -321,7 +321,7 @@ USE_THIN_ARCHIVES = no
+ ifeq ($(THIN_ARCHIVE_SUPPORT),yes)
+ ifeq ($(AR_FLAGS),rc)
+ ifeq ($(RANLIB_FLAGS),)
+-USE_THIN_ARCHIVES = yes
++#USE_THIN_ARCHIVES = yes
+ endif
+ endif
+ endif
+@@ -2273,6 +2273,7 @@ gcc-cross$(exeext): xgcc$(exeext)
+
+ checksum-options:
+ echo "$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS)" > checksum-options.tmp \
++ && sed -i 's|'$${BUILD_ROOT_DIR:-/nonexistent}'|/build|g' checksum-options.tmp \
+ && $(srcdir)/../move-if-change checksum-options.tmp checksum-options
+
+ #
+diff --git a/gcc/c/Make-lang.in b/gcc/c/Make-lang.in
+index 905ab9e79..583eb1cac 100644
+--- a/gcc/c/Make-lang.in
++++ b/gcc/c/Make-lang.in
+@@ -77,7 +77,11 @@ cc1-checksum.cc : build/genchecksum$(build_exeext) checksum-options \
+ && cmp -s ../stage_current ../stage_final; then \
+ cp ../prev-gcc/cc1-checksum.cc cc1-checksum.cc; \
+ else \
+- build/genchecksum$(build_exeext) $(C_OBJS) $(BACKEND) $(LIBDEPS) \
++ rm -rf stripped_c_checksum_inputs; \
++ mkdir stripped_c_checksum_inputs; \
++ cp $(C_OBJS) $(BACKEND) $(LIBDEPS) stripped_c_checksum_inputs/; \
++ $(STRIP_FOR_TARGET) -g stripped_c_checksum_inputs/*; \
++ build/genchecksum$(build_exeext) $$(ls stripped_c_checksum_inputs/* | LC_ALL=C sort) \
+ checksum-options > cc1-checksum.cc.tmp && \
+ $(srcdir)/../move-if-change cc1-checksum.cc.tmp cc1-checksum.cc; \
+ fi
+diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
+index f153891a1..52cc5d33c 100644
+--- a/gcc/cp/Make-lang.in
++++ b/gcc/cp/Make-lang.in
+@@ -135,7 +135,11 @@ cc1plus-checksum.cc : build/genchecksum$(build_exeext) checksum-options \
+ && cmp -s ../stage_current ../stage_final; then \
+ cp ../prev-gcc/cc1plus-checksum.cc cc1plus-checksum.cc; \
+ else \
+- build/genchecksum$(build_exeext) $(CXX_OBJS) $(BACKEND) $(CODYLIB) $(LIBDEPS) \
++ rm -rf stripped_cp_checksum_inputs; \
++ mkdir stripped_cp_checksum_inputs; \
++ cp $(CXX_OBJS) $(BACKEND) $(CODYLIB) $(LIBDEPS) stripped_cp_checksum_inputs; \
++ $(STRIP_FOR_TARGET) -g stripped_cp_checksum_inputs/*; \
++ build/genchecksum$(build_exeext) $$(ls stripped_cp_checksum_inputs/* | LC_ALL=C sort) \
+ checksum-options > cc1plus-checksum.cc.tmp && \
+ $(srcdir)/../move-if-change cc1plus-checksum.cc.tmp cc1plus-checksum.cc; \
+ fi
+--
+2.30.2
+
diff --git a/etc/patches/gcc-14/reproducibility/0005-do-not-hardcode-rpath-into-cc1-libs.patch b/etc/patches/gcc-14/reproducibility/0005-do-not-hardcode-rpath-into-cc1-libs.patch
new file mode 100644
index 0000000..0387da6
--- /dev/null
+++ b/etc/patches/gcc-14/reproducibility/0005-do-not-hardcode-rpath-into-cc1-libs.patch
@@ -0,0 +1,26 @@
+From 324a42a4cc1b9152ee73c285725038b9a610d7f1 Mon Sep 17 00:00:00 2001
+From: Oliver Reiche <oliver.reiche@huawei.com>
+Date: Fri, 8 Sep 2023 14:59:34 +0200
+Subject: [PATCH 5/5] Do not hardcode rpath into cc1 libs
+
+... which is a temporary path anyway.
+---
+ libcc1/configure | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libcc1/configure b/libcc1/configure
+index ea689a353..07ff4cde4 100755
+--- a/libcc1/configure
++++ b/libcc1/configure
+@@ -17453,7 +17453,7 @@ finish_cmds=$lt_finish_cmds
+ finish_eval=$lt_finish_eval
+
+ # Whether we should hardcode library paths into libraries.
+-hardcode_into_libs=$hardcode_into_libs
++hardcode_into_libs=no #$hardcode_into_libs
+
+ # Compile-time system search path for libraries.
+ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+--
+2.30.2
+
diff --git a/etc/patches/gcc-14/reproducibility/series b/etc/patches/gcc-14/reproducibility/series
new file mode 100644
index 0000000..e5411be
--- /dev/null
+++ b/etc/patches/gcc-14/reproducibility/series
@@ -0,0 +1,5 @@
+0001-strip-build-directory-from-config-arguments.patch
+0002-strip-build-directory-from-fixincludes.patch
+0003-strip-build-directory-from-mkheaders.conf.patch
+0004-compute-reproducible-checksums.patch
+0005-do-not-hardcode-rpath-into-cc1-libs.patch
diff --git a/etc/patches/musl-cross-make-fe915821/patches/gcc-14/0001-ssp_nonshared.diff b/etc/patches/musl-cross-make-fe915821/patches/gcc-14/0001-ssp_nonshared.diff
new file mode 100644
index 0000000..cd6fe1f
--- /dev/null
+++ b/etc/patches/musl-cross-make-fe915821/patches/gcc-14/0001-ssp_nonshared.diff
@@ -0,0 +1,14 @@
+diff --git a/gcc/gcc.cc b/gcc/gcc.cc
+index 728332b81..d4f5b64e1 100644
+--- a/gcc/gcc.cc
++++ b/gcc/gcc.cc
+@@ -987,7 +987,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/etc/patches/musl-cross-make-fe915821/patches/gcc-14/0002-posix_memalign.diff b/etc/patches/musl-cross-make-fe915821/patches/gcc-14/0002-posix_memalign.diff
new file mode 100644
index 0000000..1d80096
--- /dev/null
+++ b/etc/patches/musl-cross-make-fe915821/patches/gcc-14/0002-posix_memalign.diff
@@ -0,0 +1,30 @@
+diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
+index 1b0bfe37852..d7b2b19bb3c 100644
+--- a/gcc/config/i386/pmm_malloc.h
++++ b/gcc/config/i386/pmm_malloc.h
+@@ -27,12 +27,13 @@
+ #include <stdlib.h>
+
+ /* We can't depend on <stdlib.h> 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/etc/patches/musl-cross-make-fe915821/patches/gcc-14/0003-j2.diff b/etc/patches/musl-cross-make-fe915821/patches/gcc-14/0003-j2.diff
new file mode 100644
index 0000000..d2dc1cc
--- /dev/null
+++ b/etc/patches/musl-cross-make-fe915821/patches/gcc-14/0003-j2.diff
@@ -0,0 +1,346 @@
+diff --git a/gcc/config.gcc b/gcc/config.gcc
+index 95c91ee02..9fe2d3bd2 100644
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -579,7 +579,7 @@ s390*-*-*)
+ target_gtfiles="./s390-gen-builtins.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"
+@@ -3265,18 +3265,18 @@ 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*)
+ 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* | sh*-*-linux* | \
+ sh-superh-elf) with_endian=little,big ;;
+- sh[1234]*-*-*) with_endian=big ;;
++ sh[j1234]*-*-*) with_endian=big ;;
+ *) with_endian=big,little ;;
+ esac
+ fi
+@@ -3343,6 +3343,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
+@@ -3364,7 +3365,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
+@@ -3373,9 +3374,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 ;;
+- 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`"
+@@ -3390,7 +3391,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 | \
+- m2a | m2a-single | m2a-single-only | m2a-nofpu)
++ m2a | m2a-single | m2a-single-only | m2a-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}"
+@@ -3407,7 +3409,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"
++ 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_SHJ2=1"
+ fi
+ tm_file="$tm_file ./sysroot-suffix.h"
+ tmake_file="$tmake_file t-sysroot-suffix"
+@@ -5705,6 +5707,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
+@@ -5979,7 +5983,7 @@ case ${target} in
+ tmake_file="${cpu_type}/t-${cpu_type} ${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.cc b/gcc/config/sh/sh.cc
+index ef3c2e679..97f5e633d 100644
+--- a/gcc/config/sh/sh.cc
++++ b/gcc/config/sh/sh.cc
+@@ -686,6 +686,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";
+@@ -693,6 +694,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;
+@@ -771,6 +773,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
+@@ -827,6 +832,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 7d3a3f083..791784814 100644
+--- a/gcc/config/sh/sh.h
++++ b/gcc/config/sh/sh.h
+@@ -85,6 +85,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_CALL_DIV1 (sh_div_strategy == SH_DIV_CALL_DIV1)
+@@ -117,6 +118,7 @@ extern int code_for_indirect_jump_scratch;
+ #define SELECT_SH4A_SINGLE_ONLY (MASK_SH4A | SELECT_SH4_SINGLE_ONLY)
+ #define SELECT_SH4A (MASK_SH4A | SELECT_SH4)
+ #define SELECT_SH4A_SINGLE (MASK_SH4A | SELECT_SH4_SINGLE)
++#define SELECT_SHJ2 (MASK_SHJ2 | SELECT_SH2)
+
+ #if SUPPORT_SH1
+ #define SUPPORT_SH2 1
+@@ -124,6 +126,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
+@@ -156,7 +159,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_FPU_SINGLE_ONLY)
++ | MASK_FPU_SINGLE_ONLY | MASK_SHJ2)
+
+ /* This defaults us to big-endian. */
+ #ifndef TARGET_ENDIAN_DEFAULT
+@@ -231,7 +234,8 @@ extern int code_for_indirect_jump_scratch;
+ %{m2a-single:--isa=sh2a} \
+ %{m2a-single-only:--isa=sh2a} \
+ %{m2a-nofpu:--isa=sh2a-nofpu} \
+-%{m4al:-dsp}"
++%{m4al:-dsp} \
++%{mj2:-isa=j2}"
+
+ #define ASM_SPEC SH_ASM_SPEC
+
+@@ -347,6 +351,7 @@ struct sh_atomic_model
+ hard_llcs,
+ soft_tcb,
+ soft_imask,
++ hard_cas,
+
+ num_models
+ };
+@@ -390,6 +395,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
+@@ -1484,7 +1492,7 @@ extern bool current_function_interrupt;
+
+ /* 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
+@@ -1747,6 +1755,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 c44cfe70c..44e3b9f9c 100644
+--- a/gcc/config/sh/sh.opt
++++ b/gcc/config/sh/sh.opt
+@@ -65,6 +65,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 52b764bde..6cc74918f 100644
+--- a/gcc/config/sh/sync.md
++++ b/gcc/config/sh/sync.md
+@@ -240,6 +240,9 @@
+ || (TARGET_SH4A && <MODE>mode == SImode && !TARGET_ATOMIC_STRICT))
+ atomic_insn = gen_atomic_compare_and_swap<mode>_hard (old_val, mem,
+ exp_val, new_val);
++ else if (TARGET_ATOMIC_HARD_CAS && <MODE>mode == SImode)
++ atomic_insn = gen_atomic_compare_and_swap<mode>_cas (old_val, mem,
++ exp_val, new_val);
+ else if (TARGET_ATOMIC_SOFT_GUSA)
+ atomic_insn = gen_atomic_compare_and_swap<mode>_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 79ecfd815..3a89280e9 100644
+--- a/gcc/config/sh/t-sh
++++ b/gcc/config/sh/t-sh
+@@ -50,7 +50,8 @@ MULTILIB_MATCHES = $(shell \
+ m2e,m3e,m4-single-only,m4-100-single-only,m4-200-single-only,m4-300-single-only,m4a-single-only \
+ m2a-single,m2a-single-only \
+ m4-single,m4-100-single,m4-200-single,m4-300-single,m4a-single \
+- m4,m4-100,m4-200,m4-300,m4a; do \
++ m4,m4-100,m4-200,m4-300,m4a \
++ mj2; do \
+ subst= ; \
+ for lib in `echo $$abi|tr , ' '` ; do \
+ if test "`echo $$multilibs|sed s/$$lib//`" != "$$multilibs"; then \
+@@ -63,9 +64,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 = \
+@@ -87,7 +88,8 @@ MULTILIB_OSDIRNAMES = \
+ m4a-single-only=!m4a-single-only $(OTHER_ENDIAN)/m4a-single-only=!$(OTHER_ENDIAN)/m4a-single-only \
+ m4a-single=!m4a-single $(OTHER_ENDIAN)/m4a-single=!$(OTHER_ENDIAN)/m4a-single \
+ m4a=!m4a $(OTHER_ENDIAN)/m4a=!$(OTHER_ENDIAN)/m4a \
+- m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al
++ m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al \
++ mj2=!j2
+
+ $(out_object_file): gt-sh.h
+ gt-sh.h : s-gtype ; @true
diff --git a/etc/patches/musl-cross-make-fe915821/patches/gcc-14/0004-static-pie.diff b/etc/patches/musl-cross-make-fe915821/patches/gcc-14/0004-static-pie.diff
new file mode 100644
index 0000000..51e4b0d
--- /dev/null
+++ b/etc/patches/musl-cross-make-fe915821/patches/gcc-14/0004-static-pie.diff
@@ -0,0 +1,92 @@
+diff --git a/gcc/common.opt b/gcc/common.opt
+index ad3488447..1a7664cbe 100644
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -3842,11 +3842,11 @@ Driver
+
+ no-pie
+ Driver RejectNegative Negative(shared)
+-Don't create a dynamically linked position independent executable.
++Don't create a position independent executable.
+
+ pie
+ Driver RejectNegative Negative(no-pie)
+-Create a dynamically linked position independent executable.
++Create a position independent executable.
+
+ static-pie
+ Driver RejectNegative Negative(pie)
+diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
+index f7eefdafe..fd45de693 100644
+--- a/gcc/config/gnu-user.h
++++ b/gcc/config/gnu-user.h
+@@ -51,13 +51,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ #define GNU_USER_TARGET_STARTFILE_SPEC \
+ "%{shared:; \
+ pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \
+- static:crt1.o%s; \
+- static-pie:rcrt1.o%s; \
++ static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \
+ " PIE_SPEC ":Scrt1.o%s; \
+ :crt1.o%s} " \
+ GNU_USER_TARGET_CRTI " \
+- %{static:crtbeginT.o%s; \
+- shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
++ %{shared|" PIE_SPEC ":crtbeginS.o%s; \
++ static:crtbeginT.o%s; \
+ :crtbegin.o%s} \
+ %{fvtable-verify=none:%s; \
+ fvtable-verify=preinit:vtv_start_preinit.o%s; \
+@@ -73,11 +72,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ GNU userspace "finalizer" file, `crtn.o'. */
+
+ #define GNU_USER_TARGET_ENDFILE_SPEC \
+- "%{!static:%{fvtable-verify=none:%s; \
++ "%{static|static-pie:; \
++ fvtable-verify=none:%s; \
+ fvtable-verify=preinit:vtv_end_preinit.o%s; \
+- fvtable-verify=std:vtv_end.o%s}} \
+- %{static:crtend.o%s; \
+- shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
++ fvtable-verify=std:vtv_end.o%s} \
++ %{shared|" PIE_SPEC ":crtendS.o%s; \
+ :crtend.o%s} " \
+ GNU_USER_TARGET_CRTN " " \
+ CRTOFFLOADEND
+@@ -106,7 +105,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
+
+ #if defined(HAVE_LD_EH_FRAME_HDR)
+-#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
++#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} "
+ #endif
+
+ #define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \
+diff --git a/gcc/gcc.cc b/gcc/gcc.cc
+index d4f5b64e1..0e278b9a5 100644
+--- a/gcc/gcc.cc
++++ b/gcc/gcc.cc
+@@ -1017,7 +1017,7 @@ proper position among the other output files. */
+ #define NO_FPIE_AND_FPIC_SPEC NO_FPIE_SPEC "|" NO_FPIC_SPEC
+ #define FPIE_OR_FPIC_SPEC NO_FPIE_AND_FPIC_SPEC ":;"
+ #else
+-#define PIE_SPEC "pie"
++#define PIE_SPEC "pie|static-pie"
+ #define FPIE1_SPEC "fpie"
+ #define NO_FPIE1_SPEC FPIE1_SPEC ":;"
+ #define FPIE2_SPEC "fPIE"
+@@ -1041,12 +1041,12 @@ 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|static-pie:--no-dynamic-linker -z text -Bsymbolic}"
+ #endif
+ #else
+ #define LD_PIE_SPEC ""
+ #endif
+-#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
++#define LINK_PIE_SPEC "%{shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
+ #endif
+
+ #ifndef LINK_BUILDID_SPEC
diff --git a/etc/patches/musl-cross-make-fe915821/patches/gcc-14/0005-m68k-sqrt.diff b/etc/patches/musl-cross-make-fe915821/patches/gcc-14/0005-m68k-sqrt.diff
new file mode 100644
index 0000000..49041f2
--- /dev/null
+++ b/etc/patches/musl-cross-make-fe915821/patches/gcc-14/0005-m68k-sqrt.diff
@@ -0,0 +1,20 @@
+diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
+index 037978db4..dcace5a52 100644
+--- a/gcc/config/m68k/m68k.md
++++ b/gcc/config/m68k/m68k.md
+@@ -4174,13 +4174,13 @@
+ (define_expand "sqrt<mode>2"
+ [(set (match_operand:FP 0 "nonimmediate_operand" "")
+ (sqrt:FP (match_operand:FP 1 "general_operand" "")))]
+- "TARGET_HARD_FLOAT"
++ "(TARGET_68881 && TARGET_68040) || TARGET_COLDFIRE_FPU"
+ "")
+
+ (define_insn "sqrt<mode>2_68881"
+ [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
+ (sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
+- "TARGET_68881"
++ "TARGET_68881 && TARGET_68040"
+ {
+ if (FP_REG_P (operands[1]))
+ return "f<FP:round>sqrt%.x %1,%0";