From 29128b0bd43532404d965d22338554fce624db6a Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Thu, 27 Apr 2023 23:03:14 +0200 Subject: [PATCH] toolchain: gcc: add support for GCC 13 Release Notes: https://gcc.gnu.org/pipermail/gcc-announce/2023/000175.html Manually Refreshed: - 910-mbsd_multi.patch - 970-macos_arm64-building-fix.patch Automatically Refreshed: - 010-documentation.patch - 230-musl_libssp.patch - 300-mips_Os_cpu_rtx_cost_model.patch - 820-libgcc_pic.patch - 840-armv4_pass_fix-v4bx_to_ld.patch - 850-use_shared_libgcc.patch - 870-ppc_no_crtsavres.patch - 920-specs_nonfatal_getenv.patch Signed-off-by: Nick Hainke --- toolchain/gcc/Config.in | 3 +++ toolchain/gcc/Config.version | 5 +++++ toolchain/gcc/common.mk | 10 +++++++--- .../gcc/patches-13.x/010-documentation.patch | 2 +- toolchain/gcc/patches-13.x/230-musl_libssp.patch | 2 +- .../300-mips_Os_cpu_rtx_cost_model.patch | 2 +- toolchain/gcc/patches-13.x/820-libgcc_pic.patch | 6 +++--- .../840-armv4_pass_fix-v4bx_to_ld.patch | 2 +- .../gcc/patches-13.x/850-use_shared_libgcc.patch | 8 ++++---- .../gcc/patches-13.x/870-ppc_no_crtsavres.patch | 2 +- toolchain/gcc/patches-13.x/910-mbsd_multi.patch | 16 ++++++++-------- .../patches-13.x/920-specs_nonfatal_getenv.patch | 2 +- .../970-macos_arm64-building-fix.patch | 8 ++++---- 13 files changed, 40 insertions(+), 28 deletions(-) diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in index d150c9cc4b..9156f9c263 100644 --- a/toolchain/gcc/Config.in +++ b/toolchain/gcc/Config.in @@ -11,6 +11,9 @@ choice config GCC_USE_VERSION_12 bool "gcc 12.x" + + config GCC_USE_VERSION_13 + bool "gcc 13.x" endchoice config GCC_USE_GRAPHITE diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version index 7d4bedfbe9..1c1b0a04a1 100644 --- a/toolchain/gcc/Config.version +++ b/toolchain/gcc/Config.version @@ -2,7 +2,12 @@ config GCC_VERSION_11 default y if GCC_USE_VERSION_11 bool +config GCC_VERSION_13 + default y if GCC_USE_VERSION_13 + bool + config GCC_VERSION string default "11.3.0" if GCC_VERSION_11 + default "13.1.0" if GCC_VERSION_13 default "12.2.0" diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk index 25f7e1ef70..ebe4b484cf 100644 --- a/toolchain/gcc/common.mk +++ b/toolchain/gcc/common.mk @@ -37,6 +37,10 @@ ifeq ($(PKG_VERSION),12.2.0) PKG_HASH:=e549cf9cf3594a00e27b6589d4322d70e0720cdd213f39beb4181e06926230ff endif +ifeq ($(PKG_VERSION),13.1.0) + PKG_HASH:=61d684f0aa5e76ac6585ad8898a2427aade8979ed5e7f85492286c4dfc13ee86 +endif + PATCH_DIR=../patches-$(GCC_MAJOR_VERSION).x BUGURL=http://bugs.openwrt.org/ @@ -187,10 +191,10 @@ define Host/SetToolchainInfo endef -ifeq ($(GCC_MAJOR_VERSION),12) - GCC_VERSION_FILE:=gcc/genversion.cc -else +ifeq ($(GCC_MAJOR_VERSION),11) GCC_VERSION_FILE:=gcc/version.c +else + GCC_VERSION_FILE:=gcc/genversion.cc endif ifneq ($(GCC_PREPARE),) diff --git a/toolchain/gcc/patches-13.x/010-documentation.patch b/toolchain/gcc/patches-13.x/010-documentation.patch index 39ee48ed67..9646568afe 100644 --- a/toolchain/gcc/patches-13.x/010-documentation.patch +++ b/toolchain/gcc/patches-13.x/010-documentation.patch @@ -12,7 +12,7 @@ Date: Tue Feb 26 16:16:33 2013 +0000 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in -@@ -3366,18 +3366,10 @@ doc/gcc.info: $(TEXI_GCC_FILES) +@@ -3397,18 +3397,10 @@ doc/gcc.info: $(TEXI_GCC_FILES) doc/gccint.info: $(TEXI_GCCINT_FILES) doc/cppinternals.info: $(TEXI_CPPINT_FILES) diff --git a/toolchain/gcc/patches-13.x/230-musl_libssp.patch b/toolchain/gcc/patches-13.x/230-musl_libssp.patch index 3ce5e49587..fee068e1d6 100644 --- a/toolchain/gcc/patches-13.x/230-musl_libssp.patch +++ b/toolchain/gcc/patches-13.x/230-musl_libssp.patch @@ -1,6 +1,6 @@ --- a/gcc/gcc.cc +++ b/gcc/gcc.cc -@@ -985,7 +985,9 @@ proper position among the other output f +@@ -972,7 +972,9 @@ proper position among the other output f #endif #ifndef LINK_SSP_SPEC diff --git a/toolchain/gcc/patches-13.x/300-mips_Os_cpu_rtx_cost_model.patch b/toolchain/gcc/patches-13.x/300-mips_Os_cpu_rtx_cost_model.patch index 1d223f2a0f..ce21e0433d 100644 --- a/toolchain/gcc/patches-13.x/300-mips_Os_cpu_rtx_cost_model.patch +++ b/toolchain/gcc/patches-13.x/300-mips_Os_cpu_rtx_cost_model.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- a/gcc/config/mips/mips.cc +++ b/gcc/config/mips/mips.cc -@@ -20216,7 +20216,7 @@ mips_option_override (void) +@@ -20213,7 +20213,7 @@ mips_option_override (void) flag_pcc_struct_return = 0; /* Decide which rtx_costs structure to use. */ diff --git a/toolchain/gcc/patches-13.x/820-libgcc_pic.patch b/toolchain/gcc/patches-13.x/820-libgcc_pic.patch index 525a95b565..7d10298190 100644 --- a/toolchain/gcc/patches-13.x/820-libgcc_pic.patch +++ b/toolchain/gcc/patches-13.x/820-libgcc_pic.patch @@ -8,7 +8,7 @@ Date: Mon Oct 19 23:26:09 2009 +0000 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in -@@ -930,11 +930,12 @@ $(libgcov-driver-objects): %$(objext): $ +@@ -933,11 +933,12 @@ $(libgcov-driver-objects): %$(objext): $ # Static libraries. libgcc.a: $(libgcc-objects) @@ -22,7 +22,7 @@ Date: Mon Oct 19 23:26:09 2009 +0000 -rm -f $@ objects="$(objects)"; \ -@@ -958,7 +959,7 @@ all: libunwind.a +@@ -961,7 +962,7 @@ all: libunwind.a endif ifeq ($(enable_shared),yes) @@ -31,7 +31,7 @@ Date: Mon Oct 19 23:26:09 2009 +0000 ifneq ($(LIBUNWIND),) all: libunwind$(SHLIB_EXT) libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT) -@@ -1164,6 +1165,10 @@ install-shared: +@@ -1167,6 +1168,10 @@ install-shared: chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a diff --git a/toolchain/gcc/patches-13.x/840-armv4_pass_fix-v4bx_to_ld.patch b/toolchain/gcc/patches-13.x/840-armv4_pass_fix-v4bx_to_ld.patch index e3cb616c4e..82935f3d1d 100644 --- a/toolchain/gcc/patches-13.x/840-armv4_pass_fix-v4bx_to_ld.patch +++ b/toolchain/gcc/patches-13.x/840-armv4_pass_fix-v4bx_to_ld.patch @@ -9,7 +9,7 @@ Date: Wed Feb 2 19:34:36 2011 +0000 --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h -@@ -91,10 +91,15 @@ +@@ -88,10 +88,15 @@ #define MUSL_DYNAMIC_LINKER \ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1" diff --git a/toolchain/gcc/patches-13.x/850-use_shared_libgcc.patch b/toolchain/gcc/patches-13.x/850-use_shared_libgcc.patch index 7be30f3283..f4505ee70f 100644 --- a/toolchain/gcc/patches-13.x/850-use_shared_libgcc.patch +++ b/toolchain/gcc/patches-13.x/850-use_shared_libgcc.patch @@ -7,8 +7,8 @@ Date: Sun Feb 12 20:25:47 2012 +0000 SVN-Revision: 30486 --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h -@@ -132,10 +132,6 @@ - "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \ +@@ -129,10 +129,6 @@ + "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \ LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC) -/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we @@ -20,8 +20,8 @@ Date: Sun Feb 12 20:25:47 2012 +0000 is used. */ --- a/gcc/config/linux.h +++ b/gcc/config/linux.h -@@ -71,6 +71,10 @@ see the files COPYING3 and COPYING.RUNTI - builtin_version ("CRuntime_Musl"); \ +@@ -58,6 +58,10 @@ see the files COPYING3 and COPYING.RUNTI + builtin_assert ("system=posix"); \ } while (0) +#ifndef LIBGCC_SPEC diff --git a/toolchain/gcc/patches-13.x/870-ppc_no_crtsavres.patch b/toolchain/gcc/patches-13.x/870-ppc_no_crtsavres.patch index e51079dc13..0dca68899e 100644 --- a/toolchain/gcc/patches-13.x/870-ppc_no_crtsavres.patch +++ b/toolchain/gcc/patches-13.x/870-ppc_no_crtsavres.patch @@ -1,6 +1,6 @@ --- a/gcc/config/rs6000/rs6000-logue.cc +++ b/gcc/config/rs6000/rs6000-logue.cc -@@ -348,7 +348,7 @@ rs6000_savres_strategy (rs6000_stack_t * +@@ -344,7 +344,7 @@ rs6000_savres_strategy (rs6000_stack_t * /* Define cutoff for using out-of-line functions to save registers. */ if (DEFAULT_ABI == ABI_V4 || TARGET_ELF) { diff --git a/toolchain/gcc/patches-13.x/910-mbsd_multi.patch b/toolchain/gcc/patches-13.x/910-mbsd_multi.patch index 4033c5b23b..095fc62f69 100644 --- a/toolchain/gcc/patches-13.x/910-mbsd_multi.patch +++ b/toolchain/gcc/patches-13.x/910-mbsd_multi.patch @@ -17,7 +17,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000 --- a/gcc/c-family/c-opts.cc +++ b/gcc/c-family/c-opts.cc -@@ -107,6 +107,9 @@ static dump_flags_t original_dump_flags; +@@ -104,6 +104,9 @@ static size_t include_cursor; /* Whether any standard preincluded header has been preincluded. */ static bool done_preinclude; @@ -27,7 +27,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000 static void handle_OPT_d (const char *); static void set_std_cxx98 (int); static void set_std_cxx11 (int); -@@ -478,6 +481,12 @@ c_common_handle_option (size_t scode, co +@@ -475,6 +478,12 @@ c_common_handle_option (size_t scode, co flag_no_builtin = !value; break; @@ -40,7 +40,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000 case OPT_fconstant_string_class_: constant_string_class_name = arg; break; -@@ -1218,6 +1227,47 @@ c_common_init (void) +@@ -1228,6 +1237,47 @@ c_common_init (void) return false; } @@ -90,7 +90,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt -@@ -1755,6 +1755,9 @@ C++ ObjC++ Optimization Alias(fexception +@@ -1837,6 +1837,9 @@ C++ ObjC++ Optimization Alias(fexception fhonor-std C++ ObjC++ WarnRemoved @@ -102,7 +102,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000 Assume normal C execution environment. --- a/gcc/common.opt +++ b/gcc/common.opt -@@ -1770,6 +1770,9 @@ fharden-conditional-branches +@@ -1801,6 +1801,9 @@ fharden-conditional-branches Common Var(flag_harden_conditional_branches) Optimization Harden conditional branches by checking reversed conditions. @@ -114,7 +114,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000 ; On SVR4 targets, it also controls whether or not to emit a --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi -@@ -9596,6 +9596,17 @@ This option is only supported for C and +@@ -10061,6 +10061,17 @@ This option is only supported for C and @option{-Wall} and by @option{-Wpedantic}, which can be disabled with @option{-Wno-pointer-sign}. @@ -129,12 +129,12 @@ Date: Tue Jul 31 00:52:27 2007 +0000 +The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}. +This flag and environment variable only affect the C language. + - @item -Wstack-protector @opindex Wstack-protector @opindex Wno-stack-protector + @item -Wstack-protector --- a/gcc/opts.cc +++ b/gcc/opts.cc -@@ -2692,6 +2692,9 @@ common_handle_option (struct gcc_options +@@ -2767,6 +2767,9 @@ common_handle_option (struct gcc_options add_comma_separated_to_vector (&opts->x_flag_ignored_attributes, arg); break; diff --git a/toolchain/gcc/patches-13.x/920-specs_nonfatal_getenv.patch b/toolchain/gcc/patches-13.x/920-specs_nonfatal_getenv.patch index 0f7d40b244..265ca22c0c 100644 --- a/toolchain/gcc/patches-13.x/920-specs_nonfatal_getenv.patch +++ b/toolchain/gcc/patches-13.x/920-specs_nonfatal_getenv.patch @@ -7,7 +7,7 @@ Date: Sat Apr 21 03:02:39 2012 +0000 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc -@@ -10213,8 +10213,10 @@ getenv_spec_function (int argc, const ch +@@ -10174,8 +10174,10 @@ getenv_spec_function (int argc, const ch } if (!value) diff --git a/toolchain/gcc/patches-13.x/970-macos_arm64-building-fix.patch b/toolchain/gcc/patches-13.x/970-macos_arm64-building-fix.patch index 86fa68e1b1..7844268e7e 100644 --- a/toolchain/gcc/patches-13.x/970-macos_arm64-building-fix.patch +++ b/toolchain/gcc/patches-13.x/970-macos_arm64-building-fix.patch @@ -17,15 +17,15 @@ Date: Mon Aug 16 13:16:21 2021 +0100 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h -@@ -1290,7 +1290,7 @@ extern const char *aarch64_rewrite_mcpu - #define MCPU_TO_MARCH_SPEC_FUNCTIONS \ - { "rewrite_mcpu", aarch64_rewrite_mcpu }, +@@ -1185,7 +1185,7 @@ extern enum aarch64_code_model aarch64_c + /* Extra specs when building a native AArch64-hosted compiler. + Option rewriting rules based on host system. */ -#if defined(__aarch64__) +#if defined(__aarch64__) && ! defined(__APPLE__) extern const char *host_detect_local_cpu (int argc, const char **argv); #define HAVE_LOCAL_CPU_DETECT - # define EXTRA_SPEC_FUNCTIONS \ + # define EXTRA_SPEC_FUNCTIONS \ --- a/gcc/config/host-darwin.cc +++ b/gcc/config/host-darwin.cc @@ -23,6 +23,8 @@ -- 2.30.2