PKG_CPE_ID:=cpe:/a:gnu:gcc
-ifeq ($(PKG_VERSION),8.4.0)
- PKG_HASH:=e30a6e52d10e1f27ed55104ad233c30bd1e99cfb5ff98ab022dc941edd1b2dd4
+ifeq ($(PKG_VERSION),13.4.0)
+ PKG_HASH:=9c4ce6dbb040568fdc545588ac03c5cbc95a8dbf0c7aa490170843afb59ca8f5
endif
-ifeq ($(PKG_VERSION),10.3.0)
- PKG_HASH:=64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344
-endif
-
-ifeq ($(PKG_VERSION),11.3.0)
- PKG_HASH:=b47cf2818691f5b1e21df2bb38c795fac2cfbd640ede2d0a5e1c89e338a3ac39
-endif
-
-ifeq ($(PKG_VERSION),12.3.0)
- PKG_HASH:=949a5d4f99e786421a93b532b22ffab5578de7321369975b91aec97adfda8c3b
-endif
-
-ifeq ($(PKG_VERSION),13.3.0)
- PKG_HASH:=0845e9621c9543a13f484e94584a49ffc0129970e9914624235fc1d061a0c083
+ifeq ($(PKG_VERSION),14.3.0)
+ PKG_HASH:=e0dc77297625631ac8e50fa92fffefe899a4eb702592da5c32ef04e2293aca3a
endif
-ifeq ($(PKG_VERSION),14.3.0)
- PKG_HASH:=e0dc77297625631ac8e50fa92fffefe899a4eb702592da5c32ef04e2293aca3a
+ifeq ($(PKG_VERSION),15.2.0)
+ PKG_HASH:=438fd996826b0c82485a29da03a72d71d6e3541a83ec702df4271f6fe025d24e
endif
PATCH_DIR:=patches-$(GCC_MAJOR_VERSION).x
+++ /dev/null
-Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790.
-MIPS16 functions have a static assembler prologue which clobbers
-registers v0 and v1. Add these register clobbers to function call
-instructions.
-
---- a/gcc/config/mips/mips.c
-+++ b/gcc/config/mips/mips.c
-@@ -3132,6 +3132,12 @@ mips_emit_call_insn (rtx pattern, rtx or
- emit_insn (gen_update_got_version ());
- }
-
-+ if (TARGET_MIPS16 && TARGET_USE_GOT)
-+ {
-+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS16_PIC_TEMP);
-+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS_PROLOGUE_TEMP (word_mode));
-+ }
-+
- if (TARGET_MIPS16
- && TARGET_EXPLICIT_RELOCS
- && TARGET_CALL_CLOBBERED_GP)
+++ /dev/null
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -875,7 +875,9 @@ proper position among the other output f
- #endif
-
- #ifndef LINK_SSP_SPEC
--#ifdef TARGET_LIBC_PROVIDES_SSP
-+#if DEFAULT_LIBC == LIBC_MUSL
-+#define LINK_SSP_SPEC "-lssp_nonshared"
-+#elif defined(TARGET_LIBC_PROVIDES_SSP)
- #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
- #else
+++ /dev/null
-commit ecf7671b769fe96f7b5134be442089f8bdba55d2
-Author: Felix Fietkau <nbd@nbd.name>
-Date: Thu Aug 4 20:29:45 2016 +0200
-
-gcc: add a patch to generate better code with Os on mips
-
-Also happens to reduce compressed code size a bit
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
-
---- a/gcc/config/mips/mips.c
-+++ b/gcc/config/mips/mips.c
-@@ -20041,7 +20041,7 @@ mips_option_override (void)
- flag_pcc_struct_return = 0;
-
- /* Decide which rtx_costs structure to use. */
-- if (optimize_size)
-+ if (0 && optimize_size)
- mips_cost = &mips_rtx_cost_optimize_size;
- else
- mips_cost = &mips_rtx_cost_data[mips_tune];
+++ /dev/null
-commit c96312958c0621e72c9b32da5bc224ffe2161384
-Author: Felix Fietkau <nbd@openwrt.org>
-Date: Mon Oct 19 23:26:09 2009 +0000
-
- gcc: create a proper libgcc_pic.a static library for relinking (4.3.3+ for now, backport will follow)
-
- SVN-Revision: 18086
-
---- a/libgcc/Makefile.in
-+++ b/libgcc/Makefile.in
-@@ -929,11 +929,12 @@ $(libgcov-driver-objects): %$(objext): $
-
- # Static libraries.
- libgcc.a: $(libgcc-objects)
-+libgcc_pic.a: $(libgcc-s-objects)
- libgcov.a: $(libgcov-objects)
- libunwind.a: $(libunwind-objects)
- libgcc_eh.a: $(libgcc-eh-objects)
-
--libgcc.a libgcov.a libunwind.a libgcc_eh.a:
-+libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
- -rm -f $@
-
- objects="$(objects)"; \
-@@ -957,7 +958,7 @@ all: libunwind.a
- endif
-
- ifeq ($(enable_shared),yes)
--all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
-+all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
- ifneq ($(LIBUNWIND),)
- all: libunwind$(SHLIB_EXT)
- libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
-@@ -1163,6 +1164,10 @@ install-shared:
- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
-
-+ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
-+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
-+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
-+
- $(subst @multilib_dir@,$(MULTIDIR),$(subst \
- @shlib_base_name@,libgcc_s,$(subst \
- @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
+++ /dev/null
-commit dcfc40358b5a3cae7320c17f8d1cebd5ad5540cd
-Author: Felix Fietkau <nbd@openwrt.org>
-Date: Sun Feb 12 20:25:47 2012 +0000
-
- gcc 4.6: port over the missing patch 850-use_shared_libgcc.patch to prevent libgcc crap from leaking into every single binary
-
- 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} " \
- 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
-- do not use -lfloat. */
--#undef LIBGCC_SPEC
--
- /* Clear the instruction cache from `beg' to `end'. This is
- implemented in lib1funcs.S, so ensure an error if this definition
- is used. */
---- a/gcc/config/linux.h
-+++ b/gcc/config/linux.h
-@@ -66,6 +66,10 @@ see the files COPYING3 and COPYING.RUNTI
- builtin_version ("CRuntime_Musl"); \
- } while (0)
-
-+#ifndef LIBGCC_SPEC
-+#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
-+#endif
-+
- /* Determine which dynamic linker to use depending on whether GLIBC or
- uClibc or Bionic or musl is the default C library and whether
- -muclibc or -mglibc or -mbionic or -mmusl has been passed to change
---- a/libgcc/mkmap-symver.awk
-+++ b/libgcc/mkmap-symver.awk
-@@ -136,5 +136,5 @@ function output(lib) {
- else if (inherit[lib])
- printf("} %s;\n", inherit[lib]);
- else
-- printf ("\n local:\n\t*;\n};\n");
-+ printf ("\n\t*;\n};\n");
- }
---- a/gcc/config/rs6000/linux.h
-+++ b/gcc/config/rs6000/linux.h
-@@ -62,6 +62,9 @@
- #undef CPP_OS_DEFAULT_SPEC
- #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
-
-+#undef LIBGCC_SPEC
-+#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
-+
- #undef LINK_SHLIB_SPEC
- #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
- %{static-pie:-static -pie --no-dynamic-linker -z text}"
+++ /dev/null
---- a/gcc/config/rs6000/rs6000-logue.c
-+++ b/gcc/config/rs6000/rs6000-logue.c
-@@ -348,7 +348,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)
- {
-- if (!optimize_size)
-+ if (1)
- {
- strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
- strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
+++ /dev/null
---- a/libgcc/crtstuff.c
-+++ b/libgcc/crtstuff.c
-@@ -152,7 +152,7 @@ call_ ## FUNC (void) \
- #endif
-
- #if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
--# define USE_TM_CLONE_REGISTRY 1
-+# define USE_TM_CLONE_REGISTRY 0
- #elif !defined(USE_TM_CLONE_REGISTRY)
- # define USE_TM_CLONE_REGISTRY 0
- #endif
+++ /dev/null
---- a/libgcc/config/mips/t-mips16
-+++ b/libgcc/config/mips/t-mips16
-@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
-
- # Version these symbols if building libgcc.so.
- SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
-+
-+CRTSTUFF_T_CFLAGS += -mno-mips16
-+CRTSTUFF_T_CFLAGS_S += -mno-mips16
+++ /dev/null
-commit 99368862e44740ff4fd33760893f04e14f9dbdf1
-Author: Felix Fietkau <nbd@openwrt.org>
-Date: Tue Jul 31 00:52:27 2007 +0000
-
- Port the mbsd_multi patch from freewrt, which adds -fhonour-copts. This will emit warnings in packages that don't use our target cflags properly
-
- SVN-Revision: 8256
-
- This patch brings over a feature from MirBSD:
- * -fhonour-copts
- If this option is not given, it's warned (depending
- on environment variables). This is to catch errors
- of misbuilt packages which override CFLAGS themselves.
-
- This patch was authored by Thorsten Glaser <tg at mirbsd.de>
- with copyright assignment to the FSF in effect.
-
---- a/gcc/c-family/c-opts.c
-+++ b/gcc/c-family/c-opts.c
-@@ -107,6 +107,9 @@ static dump_flags_t original_dump_flags;
- /* Whether any standard preincluded header has been preincluded. */
- static bool done_preinclude;
-
-+/* Check if a port honours COPTS. */
-+static int honour_copts = 0;
-+
- static void handle_OPT_d (const char *);
- static void set_std_cxx98 (int);
- static void set_std_cxx11 (int);
-@@ -455,6 +458,12 @@ c_common_handle_option (size_t scode, co
- flag_no_builtin = !value;
- break;
-
-+ case OPT_fhonour_copts:
-+ if (c_language == clk_c) {
-+ honour_copts++;
-+ }
-+ break;
-+
- case OPT_fconstant_string_class_:
- constant_string_class_name = arg;
- break;
-@@ -1168,6 +1177,47 @@ c_common_init (void)
- return false;
- }
-
-+ if (c_language == clk_c) {
-+ char *ev = getenv ("GCC_HONOUR_COPTS");
-+ int evv;
-+ if (ev == NULL)
-+ evv = -1;
-+ else if ((*ev == '0') || (*ev == '\0'))
-+ evv = 0;
-+ else if (*ev == '1')
-+ evv = 1;
-+ else if (*ev == '2')
-+ evv = 2;
-+ else if (*ev == 's')
-+ evv = -1;
-+ else {
-+ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
-+ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
-+ }
-+ if (evv == 1) {
-+ if (honour_copts == 0) {
-+ error ("someone does not honour COPTS at all in lenient mode");
-+ return false;
-+ } else if (honour_copts != 1) {
-+ warning (0, "someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ }
-+ } else if (evv == 2) {
-+ if (honour_copts == 0) {
-+ error ("someone does not honour COPTS at all in strict mode");
-+ return false;
-+ } else if (honour_copts != 1) {
-+ error ("someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ return false;
-+ }
-+ } else if (evv == 0) {
-+ if (honour_copts != 1)
-+ inform (UNKNOWN_LOCATION, "someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ }
-+ }
-+
- return true;
- }
-
---- a/gcc/c-family/c.opt
-+++ b/gcc/c-family/c.opt
-@@ -1590,6 +1590,9 @@ C++ ObjC++ Optimization Alias(fexception
- fhonor-std
- C++ ObjC++ WarnRemoved
-
-+fhonour-copts
-+C ObjC C++ ObjC++ RejectNegative
-+
- fhosted
- C ObjC
- Assume normal C execution environment.
---- a/gcc/common.opt
-+++ b/gcc/common.opt
-@@ -1660,6 +1660,9 @@ fguess-branch-probability
- Common Report Var(flag_guess_branch_prob) Optimization
- Enable guessing of branch probabilities.
-
-+fhonour-copts
-+Common RejectNegative
-+
- ; Nonzero means ignore `#ident' directives. 0 means handle them.
- ; Generate position-independent code for executables if possible
- ; On SVR4 targets, it also controls whether or not to emit a
---- a/gcc/doc/invoke.texi
-+++ b/gcc/doc/invoke.texi
-@@ -8171,6 +8171,17 @@ This option is only supported for C and
- @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
- @option{-Wno-pointer-sign}.
-
-+@item -fhonour-copts
-+@opindex fhonour-copts
-+If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
-+given at least once, and warn if it is given more than once.
-+If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
-+given exactly once.
-+If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
-+is not given exactly once.
-+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
---- a/gcc/opts.c
-+++ b/gcc/opts.c
-@@ -2318,6 +2318,9 @@ common_handle_option (struct gcc_options
- /* Currently handled in a prescan. */
- break;
-
-+ case OPT_fhonour_copts:
-+ break;
-+
- case OPT_Werror:
- dc->warning_as_error_requested = value;
- break;
+++ /dev/null
-Author: Jo-Philipp Wich <jow@openwrt.org>
-Date: Sat Apr 21 03:02:39 2012 +0000
-
- gcc: add patch to make the getenv() spec function nonfatal if requested environment variable is unset
-
- SVN-Revision: 31390
-
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -9396,8 +9396,10 @@ getenv_spec_function (int argc, const ch
- }
-
- if (!value)
-- fatal_error (input_location,
-- "environment variable %qs not defined", varname);
-+ {
-+ warning (input_location, "environment variable %qs not defined", varname);
-+ value = "";
-+ }
-
- /* We have to escape every character of the environment variable so
- they are not interpreted as active spec characters. A
+++ /dev/null
-From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001
-From: Andrew McDonnell <bugs@andrewmcdonnell.net>
-Date: Fri, 3 Oct 2014 19:09:00 +0930
-Subject: Add .note.GNU-stack section
-
-See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html
-Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html
-
-Re: [Patch, MIPS] Add .note.GNU-stack section
-
- From: Steve Ellcey <sellcey at mips dot com>
-
-On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote:
->
->
-> On Wed, Sep 10, 2014 at 9:27 AM, <pinskia@gmail.com> wrote:
-
-> This works except you did not update the assembly files in
-> libgcc or glibc. We (Cavium) have the same patch in our tree
-> for a few released versions.
-
-> Mind just checking yours in then Andrew?
-
-> Thanks!
-> -eric
-
-I talked to Andrew about what files he changed in GCC and created and
-tested this new patch. Andrew also mentioned changing some assembly
-files in glibc but I don't see any use of '.section .note.GNU-stack' in
-any assembly files in glibc (for any platform) so I wasn't planning on
-creating a glibc to add them to mips glibc assembly language files.
-
-OK to check in this patch?
-
-Steve Ellcey
-sellcey@mips.com
-
-
-
-2014-09-26 Steve Ellcey <sellcey@mips.com>
----
- gcc/config/mips/mips.c | 3 +++
- libgcc/config/mips/crti.S | 4 ++++
- libgcc/config/mips/crtn.S | 3 +++
- libgcc/config/mips/mips16.S | 4 ++++
- libgcc/config/mips/vr4120-div.S | 4 ++++
- 5 files changed, 18 insertions(+)
-
---- a/gcc/config/mips/mips.c
-+++ b/gcc/config/mips/mips.c
-@@ -22881,6 +22881,9 @@ mips_asm_file_end (void)
- #define TARGET_ASM_FILE_END mips_asm_file_end
-
-
-+#undef TARGET_ASM_FILE_END
-+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
-+
- struct gcc_target targetm = TARGET_INITIALIZER;
- \f
- #include "gt-mips.h"
---- a/libgcc/config/mips/crti.S
-+++ b/libgcc/config/mips/crti.S
-@@ -24,6 +24,10 @@ see the files COPYING3 and COPYING.RUNTI
- /* An executable stack is *not* required for these functions. */
- #include "gnustack.h"
-
-+
-+/* An executable stack is *not* required for these functions. */
-+ .section .note.GNU-stack,"",%progbits
-+
- /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
- Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
-
---- a/libgcc/config/mips/crtn.S
-+++ b/libgcc/config/mips/crtn.S
-@@ -24,6 +24,9 @@ see the files COPYING3 and COPYING.RUNTI
- /* An executable stack is *not* required for these functions. */
- #include "gnustack.h"
-
-+/* An executable stack is *not* required for these functions. */
-+ .section .note.GNU-stack,"",%progbits
-+
- /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
- Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
-
---- a/libgcc/config/mips/mips16.S
-+++ b/libgcc/config/mips/mips16.S
-@@ -51,6 +51,10 @@ see the files COPYING3 and COPYING.RUNTI
- values using the soft-float calling convention, but do the actual
- operation using the hard floating point instructions. */
-
-+/* An executable stack is *not* required for these functions. */
-+ .section .note.GNU-stack,"",%progbits
-+ .previous
-+
- #if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64)
-
- /* This file contains 32-bit assembly code. */
---- a/libgcc/config/mips/vr4120-div.S
-+++ b/libgcc/config/mips/vr4120-div.S
-@@ -29,6 +29,10 @@ see the files COPYING3 and COPYING.RUNTI
- -mfix-vr4120. div and ddiv do not give the correct result when one
- of the operands is negative. */
-
-+/* An executable stack is *not* required for these functions. */
-+ .section .note.GNU-stack,"",%progbits
-+ .previous
-+
- .set nomips16
-
- #define DIV \
+++ /dev/null
-From c0c62fa4256f805389f16ebfc4a60cf789129b50 Mon Sep 17 00:00:00 2001
-From: BangLang Huang <banglang.huang@foxmail.com>
-Date: Wed, 9 Nov 2016 10:36:49 +0800
-Subject: [PATCH] libffi: fix MIPS softfloat build issue
-
-Backported from github.com/libffi/libffi#272
-
-Signed-off-by: BangLang Huang <banglang.huang@foxmail.com>
-Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
----
- libffi/src/mips/n32.S | 17 +++++++++++++++++
- libffi/src/mips/o32.S | 17 +++++++++++++++++
- 2 files changed, 34 insertions(+)
-
---- a/libffi/src/mips/n32.S
-+++ b/libffi/src/mips/n32.S
-@@ -107,6 +107,16 @@ loadregs:
-
- REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6.
-
-+#ifdef __mips_soft_float
-+ REG_L a0, 0*FFI_SIZEOF_ARG(t9)
-+ REG_L a1, 1*FFI_SIZEOF_ARG(t9)
-+ REG_L a2, 2*FFI_SIZEOF_ARG(t9)
-+ REG_L a3, 3*FFI_SIZEOF_ARG(t9)
-+ REG_L a4, 4*FFI_SIZEOF_ARG(t9)
-+ REG_L a5, 5*FFI_SIZEOF_ARG(t9)
-+ REG_L a6, 6*FFI_SIZEOF_ARG(t9)
-+ REG_L a7, 7*FFI_SIZEOF_ARG(t9)
-+#else
- and t4, t6, ((1<<FFI_FLAG_BITS)-1)
- REG_L a0, 0*FFI_SIZEOF_ARG(t9)
- beqz t4, arg1_next
-@@ -193,6 +203,7 @@ arg7_next:
- arg8_doublep:
- l.d $f19, 7*FFI_SIZEOF_ARG(t9)
- arg8_next:
-+#endif
-
- callit:
- # Load the function pointer
-@@ -214,6 +225,7 @@ retint:
- b epilogue
-
- retfloat:
-+#ifndef __mips_soft_float
- bne t6, FFI_TYPE_FLOAT, retdouble
- jal t9
- REG_L t4, 4*FFI_SIZEOF_ARG($fp)
-@@ -272,6 +284,7 @@ retstruct_f_d:
- s.s $f0, 0(t4)
- s.d $f2, 8(t4)
- b epilogue
-+#endif
-
- retstruct_d_soft:
- bne t6, FFI_TYPE_STRUCT_D_SOFT, retstruct_f_soft
-@@ -429,6 +442,7 @@ ffi_closure_N32:
- REG_S a6, A6_OFF2($sp)
- REG_S a7, A7_OFF2($sp)
-
-+#ifndef __mips_soft_float
- # Store all possible float/double registers.
- s.d $f12, F12_OFF2($sp)
- s.d $f13, F13_OFF2($sp)
-@@ -438,6 +452,7 @@ ffi_closure_N32:
- s.d $f17, F17_OFF2($sp)
- s.d $f18, F18_OFF2($sp)
- s.d $f19, F19_OFF2($sp)
-+#endif
-
- # Call ffi_closure_mips_inner_N32 to do the real work.
- LA t9, ffi_closure_mips_inner_N32
-@@ -458,6 +473,7 @@ cls_retint:
- b cls_epilogue
-
- cls_retfloat:
-+#ifndef __mips_soft_float
- bne v0, FFI_TYPE_FLOAT, cls_retdouble
- l.s $f0, V0_OFF2($sp)
- b cls_epilogue
-@@ -500,6 +516,7 @@ cls_retstruct_f_d:
- l.s $f0, V0_OFF2($sp)
- l.d $f2, V1_OFF2($sp)
- b cls_epilogue
-+#endif
-
- cls_retstruct_small2:
- REG_L v0, V0_OFF2($sp)
---- a/libffi/src/mips/o32.S
-+++ b/libffi/src/mips/o32.S
-@@ -82,13 +82,16 @@ sixteen:
-
- ADDU $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args
-
-+#ifndef __mips_soft_float
- bnez t0, pass_d # make it quick for int
-+#endif
- REG_L a0, 0*FFI_SIZEOF_ARG($sp) # just go ahead and load the
- REG_L a1, 1*FFI_SIZEOF_ARG($sp) # four regs.
- REG_L a2, 2*FFI_SIZEOF_ARG($sp)
- REG_L a3, 3*FFI_SIZEOF_ARG($sp)
- b call_it
-
-+#ifndef __mips_soft_float
- pass_d:
- bne t0, FFI_ARGS_D, pass_f
- l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
-@@ -130,6 +133,7 @@ pass_f_d:
- # bne t0, FFI_ARGS_F_D, call_it
- l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
- l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float
-+#endif
-
- call_it:
- # Load the function pointer
-@@ -158,14 +162,23 @@ retfloat:
- bne t2, FFI_TYPE_FLOAT, retdouble
- jalr t9
- REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
-+#ifndef __mips_soft_float
- s.s $f0, 0(t0)
-+#else
-+ REG_S v0, 0(t0)
-+#endif
- b epilogue
-
- retdouble:
- bne t2, FFI_TYPE_DOUBLE, noretval
- jalr t9
- REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
-+#ifndef __mips_soft_float
- s.d $f0, 0(t0)
-+#else
-+ REG_S v1, 4(t0)
-+ REG_S v0, 0(t0)
-+#endif
- b epilogue
-
- noretval:
-@@ -261,9 +274,11 @@ $LCFI7:
- li $13, 1 # FFI_O32
- bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT
-
-+#ifndef __mips_soft_float
- # Store all possible float/double registers.
- s.d $f12, FA_0_0_OFF2($fp)
- s.d $f14, FA_1_0_OFF2($fp)
-+#endif
- 1:
- # Call ffi_closure_mips_inner_O32 to do the work.
- la t9, ffi_closure_mips_inner_O32
-@@ -281,6 +296,7 @@ $LCFI7:
- li $13, 1 # FFI_O32
- bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT
-
-+#ifndef __mips_soft_float
- li $9, FFI_TYPE_FLOAT
- l.s $f0, V0_OFF2($fp)
- beq $8, $9, closure_done
-@@ -288,6 +304,7 @@ $LCFI7:
- li $9, FFI_TYPE_DOUBLE
- l.d $f0, V0_OFF2($fp)
- beq $8, $9, closure_done
-+#endif
- 1:
- REG_L $3, V1_OFF2($fp)
- REG_L $2, V0_OFF2($fp)
+++ /dev/null
-commit 81cc26c706b2bc8c8c1eb1a322e5c5157900836e
-Author: Felix Fietkau <nbd@openwrt.org>
-Date: Sun Oct 19 21:45:51 2014 +0000
-
- gcc: do not assume that the Mac OS X filesystem is case insensitive
-
- Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-
- SVN-Revision: 42973
-
---- a/include/filenames.h
-+++ b/include/filenames.h
-@@ -44,11 +44,6 @@ extern "C" {
- # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
- # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
- #else /* not DOSish */
--# if defined(__APPLE__)
--# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
--# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
--# endif
--# endif /* __APPLE__ */
- # define HAS_DRIVE_SPEC(f) (0)
- # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
- # define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)
+++ /dev/null
---- a/gcc/real.h
-+++ b/gcc/real.h
-@@ -77,8 +77,10 @@ struct GTY(()) real_value {
- + (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */
-
- /* Verify the guess. */
-+#ifndef __LP64__
- extern char test_real_width
- [sizeof (REAL_VALUE_TYPE) <= REAL_WIDTH * sizeof (HOST_WIDE_INT) ? 1 : -1];
-+#endif
-
- /* Calculate the format for CONST_DOUBLE. We need as many slots as
- are necessary to overlay a REAL_VALUE_TYPE on them. This could be
+++ /dev/null
-commit 098bd91f5eae625c7d2ee621e10930fc4434e5e2
-Author: Luka Perkov <luka@openwrt.org>
-Date: Tue Feb 26 16:16:33 2013 +0000
-
- gcc: don't build documentation
-
- This closes #13039.
-
- Signed-off-by: Luka Perkov <luka@openwrt.org>
-
- SVN-Revision: 35807
-
---- a/gcc/Makefile.in
-+++ b/gcc/Makefile.in
-@@ -3348,18 +3348,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
- doc/gccint.info: $(TEXI_GCCINT_FILES)
- doc/cppinternals.info: $(TEXI_CPPINT_FILES)
-
--doc/%.info: %.texi
-- if [ x$(BUILD_INFO) = xinfo ]; then \
-- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
-- -I $(gcc_docdir)/include -o $@ $<; \
-- fi
-+doc/%.info:
-
- # Duplicate entry to handle renaming of gccinstall.info
--doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
-- if [ x$(BUILD_INFO) = xinfo ]; then \
-- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
-- -I $(gcc_docdir)/include -o $@ $<; \
-- fi
-+doc/gccinstall.info:
-
- doc/cpp.dvi: $(TEXI_CPP_FILES)
- doc/gcc.dvi: $(TEXI_GCC_FILES)
+++ /dev/null
-From ea650cae26da4a8fc04f0c4666f4dd776d0b5fc0 Mon Sep 17 00:00:00 2001
-From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
-Date: Sun, 14 Nov 2021 21:54:25 -0800
-Subject: [PATCH] configure: define TARGET_LIBC_GNUSTACK on musl
-
-musl only uses PT_GNU_STACK to set default thread stack size and has no
-executable stack support[0], so there is no reason not to emit the
-.note.GNU-stack section on musl builds.
-
-[0]: https://lore.kernel.org/all/20190423192534.GN23599@brightrain.aerifal.cx/T/#u
-
-gcc/ChangeLog:
-
- * configure: Regenerate.
- * configure.ac: define TARGET_LIBC_GNUSTACK on musl
-
-Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
----
- gcc/configure | 3 +++
- gcc/configure.ac | 3 +++
- 2 files changed, 6 insertions(+)
-
---- a/gcc/configure
-+++ b/gcc/configure
-@@ -31533,6 +31533,9 @@ fi
- # Check if the target LIBC handles PT_GNU_STACK.
- gcc_cv_libc_gnustack=unknown
- case "$target" in
-+ mips*-*-linux-musl*)
-+ gcc_cv_libc_gnustack=yes
-+ ;;
- mips*-*-linux*)
-
- if test $glibc_version_major -gt 2 \
---- a/gcc/configure.ac
-+++ b/gcc/configure.ac
-@@ -7023,6 +7023,9 @@ fi
- # Check if the target LIBC handles PT_GNU_STACK.
- gcc_cv_libc_gnustack=unknown
- case "$target" in
-+ mips*-*-linux-musl*)
-+ gcc_cv_libc_gnustack=yes
-+ ;;
- mips*-*-linux*)
- GCC_GLIBC_VERSION_GTE_IFELSE([2], [31], [gcc_cv_libc_gnustack=yes], )
- ;;
+++ /dev/null
-Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790.
-MIPS16 functions have a static assembler prologue which clobbers
-registers v0 and v1. Add these register clobbers to function call
-instructions.
-
---- a/gcc/config/mips/mips.c
-+++ b/gcc/config/mips/mips.c
-@@ -3132,6 +3132,12 @@ mips_emit_call_insn (rtx pattern, rtx or
- emit_insn (gen_update_got_version ());
- }
-
-+ if (TARGET_MIPS16 && TARGET_USE_GOT)
-+ {
-+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS16_PIC_TEMP);
-+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS_PROLOGUE_TEMP (word_mode));
-+ }
-+
- if (TARGET_MIPS16
- && TARGET_EXPLICIT_RELOCS
- && TARGET_CALL_CLOBBERED_GP)
+++ /dev/null
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -978,7 +978,9 @@ proper position among the other output f
- #endif
-
- #ifndef LINK_SSP_SPEC
--#ifdef TARGET_LIBC_PROVIDES_SSP
-+#if DEFAULT_LIBC == LIBC_MUSL
-+#define LINK_SSP_SPEC "-lssp_nonshared"
-+#elif defined(TARGET_LIBC_PROVIDES_SSP)
- #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
- #else
+++ /dev/null
-commit ecf7671b769fe96f7b5134be442089f8bdba55d2
-Author: Felix Fietkau <nbd@nbd.name>
-Date: Thu Aug 4 20:29:45 2016 +0200
-
-gcc: add a patch to generate better code with Os on mips
-
-Also happens to reduce compressed code size a bit
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
-
---- a/gcc/config/mips/mips.c
-+++ b/gcc/config/mips/mips.c
-@@ -20041,7 +20041,7 @@ mips_option_override (void)
- flag_pcc_struct_return = 0;
-
- /* Decide which rtx_costs structure to use. */
-- if (optimize_size)
-+ if (0 && optimize_size)
- mips_cost = &mips_rtx_cost_optimize_size;
- else
- mips_cost = &mips_rtx_cost_data[mips_tune];
+++ /dev/null
-commit 8570c4be394cff7282f332f97da2ff569a927ddb
-Author: Imre Kaloz <kaloz@openwrt.org>
-Date: Wed Feb 2 20:06:12 2011 +0000
-
- fixup arm soft-float symbols
-
- SVN-Revision: 25325
-
---- a/libgcc/config/arm/t-linux
-+++ b/libgcc/config/arm/t-linux
-@@ -1,6 +1,10 @@
- LIB1ASMSRC = arm/lib1funcs.S
- LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
-- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
-+ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
-+ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
-+ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
-+ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
-+ _arm_fixsfsi _arm_fixunssfsi
-
- # Just for these, we omit the frame pointer since it makes such a big
- # difference.
---- a/gcc/config/arm/linux-elf.h
-+++ b/gcc/config/arm/linux-elf.h
-@@ -58,8 +58,6 @@
- %{shared:-lc} \
- %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
-
--#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
--
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-
- #define LINUX_TARGET_LINK_SPEC "%{h*} \
+++ /dev/null
-commit 7edc8ca5456d9743dd0075eb3cc5b04f4f24c8cc
-Author: Imre Kaloz <kaloz@openwrt.org>
-Date: Wed Feb 2 19:34:36 2011 +0000
-
- add armv4 fixup patches
-
- SVN-Revision: 25322
-
-
---- a/gcc/config/arm/linux-eabi.h
-+++ b/gcc/config/arm/linux-eabi.h
-@@ -91,10 +91,15 @@
- #define MUSL_DYNAMIC_LINKER \
- "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
-
-+/* For armv4 we pass --fix-v4bx to linker to support EABI */
-+#undef TARGET_FIX_V4BX_SPEC
-+#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
-+ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
-+
- /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
- use the GNU/Linux version, not the generic BPABI version. */
- #undef LINK_SPEC
--#define LINK_SPEC EABI_LINK_SPEC \
-+#define LINK_SPEC EABI_LINK_SPEC TARGET_FIX_V4BX_SPEC \
- LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
- LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
-
+++ /dev/null
-commit dcfc40358b5a3cae7320c17f8d1cebd5ad5540cd
-Author: Felix Fietkau <nbd@openwrt.org>
-Date: Sun Feb 12 20:25:47 2012 +0000
-
- gcc 4.6: port over the missing patch 850-use_shared_libgcc.patch to prevent libgcc crap from leaking into every single binary
-
- 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} " \
- 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
-- do not use -lfloat. */
--#undef LIBGCC_SPEC
--
- /* Clear the instruction cache from `beg' to `end'. This is
- implemented in lib1funcs.S, so ensure an error if this definition
- is used. */
---- a/gcc/config/linux.h
-+++ b/gcc/config/linux.h
-@@ -66,6 +66,10 @@ see the files COPYING3 and COPYING.RUNTI
- builtin_version ("CRuntime_Musl"); \
- } while (0)
-
-+#ifndef LIBGCC_SPEC
-+#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
-+#endif
-+
- /* Determine which dynamic linker to use depending on whether GLIBC or
- uClibc or Bionic or musl is the default C library and whether
- -muclibc or -mglibc or -mbionic or -mmusl has been passed to change
---- a/libgcc/mkmap-symver.awk
-+++ b/libgcc/mkmap-symver.awk
-@@ -136,5 +136,5 @@ function output(lib) {
- else if (inherit[lib])
- printf("} %s;\n", inherit[lib]);
- else
-- printf ("\n local:\n\t*;\n};\n");
-+ printf ("\n\t*;\n};\n");
- }
---- a/gcc/config/rs6000/linux.h
-+++ b/gcc/config/rs6000/linux.h
-@@ -62,6 +62,9 @@
- #undef CPP_OS_DEFAULT_SPEC
- #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
-
-+#undef LIBGCC_SPEC
-+#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
-+
- #undef LINK_SHLIB_SPEC
- #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
- %{static-pie:-static -pie --no-dynamic-linker -z text}"
+++ /dev/null
-commit 64661de100da1ec1061ef3e5e400285dce115e6b
-Author: Felix Fietkau <nbd@openwrt.org>
-Date: Sun May 10 13:16:35 2015 +0000
-
- gcc: add some size optimization patches
-
- Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-
- SVN-Revision: 45664
-
---- a/libgcc/config/t-libunwind
-+++ b/libgcc/config/t-libunwind
-@@ -2,8 +2,7 @@
-
- HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
-
--LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
-- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
-+LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
- LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
-
- # Override the default value from t-slibgcc-elf-ver and mention -lunwind
+++ /dev/null
---- a/gcc/config/rs6000/rs6000-logue.c
-+++ b/gcc/config/rs6000/rs6000-logue.c
-@@ -348,7 +348,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)
- {
-- if (!optimize_size)
-+ if (1)
- {
- strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
- strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
+++ /dev/null
---- a/libgcc/crtstuff.c
-+++ b/libgcc/crtstuff.c
-@@ -152,7 +152,7 @@ call_ ## FUNC (void) \
- #endif
-
- #if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
--# define USE_TM_CLONE_REGISTRY 1
-+# define USE_TM_CLONE_REGISTRY 0
- #elif !defined(USE_TM_CLONE_REGISTRY)
- # define USE_TM_CLONE_REGISTRY 0
- #endif
+++ /dev/null
---- a/libgcc/config/mips/t-mips16
-+++ b/libgcc/config/mips/t-mips16
-@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
-
- # Version these symbols if building libgcc.so.
- SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
-+
-+CRTSTUFF_T_CFLAGS += -mno-mips16
-+CRTSTUFF_T_CFLAGS_S += -mno-mips16
+++ /dev/null
-commit 99368862e44740ff4fd33760893f04e14f9dbdf1
-Author: Felix Fietkau <nbd@openwrt.org>
-Date: Tue Jul 31 00:52:27 2007 +0000
-
- Port the mbsd_multi patch from freewrt, which adds -fhonour-copts. This will emit warnings in packages that don't use our target cflags properly
-
- SVN-Revision: 8256
-
- This patch brings over a feature from MirBSD:
- * -fhonour-copts
- If this option is not given, it's warned (depending
- on environment variables). This is to catch errors
- of misbuilt packages which override CFLAGS themselves.
-
- This patch was authored by Thorsten Glaser <tg at mirbsd.de>
- with copyright assignment to the FSF in effect.
-
---- a/gcc/c-family/c-opts.c
-+++ b/gcc/c-family/c-opts.c
-@@ -107,6 +107,9 @@ static dump_flags_t original_dump_flags;
- /* Whether any standard preincluded header has been preincluded. */
- static bool done_preinclude;
-
-+/* Check if a port honours COPTS. */
-+static int honour_copts = 0;
-+
- static void handle_OPT_d (const char *);
- static void set_std_cxx98 (int);
- static void set_std_cxx11 (int);
-@@ -469,6 +472,12 @@ c_common_handle_option (size_t scode, co
- flag_no_builtin = !value;
- break;
-
-+ case OPT_fhonour_copts:
-+ if (c_language == clk_c) {
-+ honour_copts++;
-+ }
-+ break;
-+
- case OPT_fconstant_string_class_:
- constant_string_class_name = arg;
- break;
-@@ -1198,6 +1207,47 @@ c_common_init (void)
- return false;
- }
-
-+ if (c_language == clk_c) {
-+ char *ev = getenv ("GCC_HONOUR_COPTS");
-+ int evv;
-+ if (ev == NULL)
-+ evv = -1;
-+ else if ((*ev == '0') || (*ev == '\0'))
-+ evv = 0;
-+ else if (*ev == '1')
-+ evv = 1;
-+ else if (*ev == '2')
-+ evv = 2;
-+ else if (*ev == 's')
-+ evv = -1;
-+ else {
-+ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
-+ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
-+ }
-+ if (evv == 1) {
-+ if (honour_copts == 0) {
-+ error ("someone does not honour COPTS at all in lenient mode");
-+ return false;
-+ } else if (honour_copts != 1) {
-+ warning (0, "someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ }
-+ } else if (evv == 2) {
-+ if (honour_copts == 0) {
-+ error ("someone does not honour COPTS at all in strict mode");
-+ return false;
-+ } else if (honour_copts != 1) {
-+ error ("someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ return false;
-+ }
-+ } else if (evv == 0) {
-+ if (honour_copts != 1)
-+ inform (UNKNOWN_LOCATION, "someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ }
-+ }
-+
- return true;
- }
-
---- a/gcc/c-family/c.opt
-+++ b/gcc/c-family/c.opt
-@@ -1663,6 +1663,9 @@ C++ ObjC++ Optimization Alias(fexception
- fhonor-std
- C++ ObjC++ WarnRemoved
-
-+fhonour-copts
-+C ObjC C++ ObjC++ RejectNegative
-+
- fhosted
- C ObjC
- Assume normal C execution environment.
---- a/gcc/common.opt
-+++ b/gcc/common.opt
-@@ -1698,6 +1698,9 @@ fguess-branch-probability
- Common Var(flag_guess_branch_prob) Optimization
- Enable guessing of branch probabilities.
-
-+fhonour-copts
-+Common RejectNegative
-+
- ; Nonzero means ignore `#ident' directives. 0 means handle them.
- ; Generate position-independent code for executables if possible
- ; On SVR4 targets, it also controls whether or not to emit a
---- a/gcc/doc/invoke.texi
-+++ b/gcc/doc/invoke.texi
-@@ -9058,6 +9058,17 @@ This option is only supported for C and
- @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
- @option{-Wno-pointer-sign}.
-
-+@item -fhonour-copts
-+@opindex fhonour-copts
-+If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
-+given at least once, and warn if it is given more than once.
-+If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
-+given exactly once.
-+If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
-+is not given exactly once.
-+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
---- a/gcc/opts.c
-+++ b/gcc/opts.c
-@@ -2448,6 +2448,9 @@ common_handle_option (struct gcc_options
- /* Currently handled in a prescan. */
- break;
-
-+ case OPT_fhonour_copts:
-+ break;
-+
- case OPT_Werror:
- dc->warning_as_error_requested = value;
- break;
+++ /dev/null
-Author: Jo-Philipp Wich <jow@openwrt.org>
-Date: Sat Apr 21 03:02:39 2012 +0000
-
- gcc: add patch to make the getenv() spec function nonfatal if requested environment variable is unset
-
- SVN-Revision: 31390
-
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -10106,8 +10106,10 @@ getenv_spec_function (int argc, const ch
- }
-
- if (!value)
-- fatal_error (input_location,
-- "environment variable %qs not defined", varname);
-+ {
-+ warning (input_location, "environment variable %qs not defined", varname);
-+ value = "";
-+ }
-
- /* We have to escape every character of the environment variable so
- they are not interpreted as active spec characters. A
+++ /dev/null
-From c0c62fa4256f805389f16ebfc4a60cf789129b50 Mon Sep 17 00:00:00 2001
-From: BangLang Huang <banglang.huang@foxmail.com>
-Date: Wed, 9 Nov 2016 10:36:49 +0800
-Subject: [PATCH] libffi: fix MIPS softfloat build issue
-
-Backported from github.com/libffi/libffi#272
-
-Signed-off-by: BangLang Huang <banglang.huang@foxmail.com>
-Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
----
- libffi/src/mips/n32.S | 17 +++++++++++++++++
- libffi/src/mips/o32.S | 17 +++++++++++++++++
- 2 files changed, 34 insertions(+)
-
---- a/libffi/src/mips/n32.S
-+++ b/libffi/src/mips/n32.S
-@@ -107,6 +107,16 @@ loadregs:
-
- REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6.
-
-+#ifdef __mips_soft_float
-+ REG_L a0, 0*FFI_SIZEOF_ARG(t9)
-+ REG_L a1, 1*FFI_SIZEOF_ARG(t9)
-+ REG_L a2, 2*FFI_SIZEOF_ARG(t9)
-+ REG_L a3, 3*FFI_SIZEOF_ARG(t9)
-+ REG_L a4, 4*FFI_SIZEOF_ARG(t9)
-+ REG_L a5, 5*FFI_SIZEOF_ARG(t9)
-+ REG_L a6, 6*FFI_SIZEOF_ARG(t9)
-+ REG_L a7, 7*FFI_SIZEOF_ARG(t9)
-+#else
- and t4, t6, ((1<<FFI_FLAG_BITS)-1)
- REG_L a0, 0*FFI_SIZEOF_ARG(t9)
- beqz t4, arg1_next
-@@ -193,6 +203,7 @@ arg7_next:
- arg8_doublep:
- l.d $f19, 7*FFI_SIZEOF_ARG(t9)
- arg8_next:
-+#endif
-
- callit:
- # Load the function pointer
-@@ -214,6 +225,7 @@ retint:
- b epilogue
-
- retfloat:
-+#ifndef __mips_soft_float
- bne t6, FFI_TYPE_FLOAT, retdouble
- jal t9
- REG_L t4, 4*FFI_SIZEOF_ARG($fp)
-@@ -272,6 +284,7 @@ retstruct_f_d:
- s.s $f0, 0(t4)
- s.d $f2, 8(t4)
- b epilogue
-+#endif
-
- retstruct_d_soft:
- bne t6, FFI_TYPE_STRUCT_D_SOFT, retstruct_f_soft
-@@ -429,6 +442,7 @@ ffi_closure_N32:
- REG_S a6, A6_OFF2($sp)
- REG_S a7, A7_OFF2($sp)
-
-+#ifndef __mips_soft_float
- # Store all possible float/double registers.
- s.d $f12, F12_OFF2($sp)
- s.d $f13, F13_OFF2($sp)
-@@ -438,6 +452,7 @@ ffi_closure_N32:
- s.d $f17, F17_OFF2($sp)
- s.d $f18, F18_OFF2($sp)
- s.d $f19, F19_OFF2($sp)
-+#endif
-
- # Call ffi_closure_mips_inner_N32 to do the real work.
- LA t9, ffi_closure_mips_inner_N32
-@@ -458,6 +473,7 @@ cls_retint:
- b cls_epilogue
-
- cls_retfloat:
-+#ifndef __mips_soft_float
- bne v0, FFI_TYPE_FLOAT, cls_retdouble
- l.s $f0, V0_OFF2($sp)
- b cls_epilogue
-@@ -500,6 +516,7 @@ cls_retstruct_f_d:
- l.s $f0, V0_OFF2($sp)
- l.d $f2, V1_OFF2($sp)
- b cls_epilogue
-+#endif
-
- cls_retstruct_small2:
- REG_L v0, V0_OFF2($sp)
---- a/libffi/src/mips/o32.S
-+++ b/libffi/src/mips/o32.S
-@@ -82,13 +82,16 @@ sixteen:
-
- ADDU $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args
-
-+#ifndef __mips_soft_float
- bnez t0, pass_d # make it quick for int
-+#endif
- REG_L a0, 0*FFI_SIZEOF_ARG($sp) # just go ahead and load the
- REG_L a1, 1*FFI_SIZEOF_ARG($sp) # four regs.
- REG_L a2, 2*FFI_SIZEOF_ARG($sp)
- REG_L a3, 3*FFI_SIZEOF_ARG($sp)
- b call_it
-
-+#ifndef __mips_soft_float
- pass_d:
- bne t0, FFI_ARGS_D, pass_f
- l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
-@@ -130,6 +133,7 @@ pass_f_d:
- # bne t0, FFI_ARGS_F_D, call_it
- l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
- l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float
-+#endif
-
- call_it:
- # Load the function pointer
-@@ -158,14 +162,23 @@ retfloat:
- bne t2, FFI_TYPE_FLOAT, retdouble
- jalr t9
- REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
-+#ifndef __mips_soft_float
- s.s $f0, 0(t0)
-+#else
-+ REG_S v0, 0(t0)
-+#endif
- b epilogue
-
- retdouble:
- bne t2, FFI_TYPE_DOUBLE, noretval
- jalr t9
- REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
-+#ifndef __mips_soft_float
- s.d $f0, 0(t0)
-+#else
-+ REG_S v1, 4(t0)
-+ REG_S v0, 0(t0)
-+#endif
- b epilogue
-
- noretval:
-@@ -261,9 +274,11 @@ $LCFI7:
- li $13, 1 # FFI_O32
- bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT
-
-+#ifndef __mips_soft_float
- # Store all possible float/double registers.
- s.d $f12, FA_0_0_OFF2($fp)
- s.d $f14, FA_1_0_OFF2($fp)
-+#endif
- 1:
- # Call ffi_closure_mips_inner_O32 to do the work.
- la t9, ffi_closure_mips_inner_O32
-@@ -281,6 +296,7 @@ $LCFI7:
- li $13, 1 # FFI_O32
- bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT
-
-+#ifndef __mips_soft_float
- li $9, FFI_TYPE_FLOAT
- l.s $f0, V0_OFF2($fp)
- beq $8, $9, closure_done
-@@ -288,6 +304,7 @@ $LCFI7:
- li $9, FFI_TYPE_DOUBLE
- l.d $f0, V0_OFF2($fp)
- beq $8, $9, closure_done
-+#endif
- 1:
- REG_L $3, V1_OFF2($fp)
- REG_L $2, V0_OFF2($fp)
+++ /dev/null
-From dda6b050cd74a352670787a294596a9c56c21327 Mon Sep 17 00:00:00 2001
-From: Yousong Zhou <yszhou4tech@gmail.com>
-Date: Fri, 4 May 2018 18:20:53 +0800
-Subject: [PATCH] gotools: fix compilation when making cross compiler
-
-libgo is "the runtime support library for the Go programming language.
-This library is intended for use with the Go frontend."
-
-gccgo will link target files with libgo.so which depends on libgcc_s.so.1, but
-the linker will complain that it cannot find it. That's because shared libgcc
-is not present in the install directory yet. libgo.so was made without problem
-because gcc will emit -lgcc_s when compiled with -shared option. When gotools
-were being made, it was supplied with -static-libgcc thus no link option was
-provided. Check LIBGO in gcc/go/gcc-spec.c for how gccgo make a builtin spec
-for linking with libgo.so
-
-- GccgoCrossCompilation, https://github.com/golang/go/wiki/GccgoCrossCompilation
-- Cross-building instructions, http://www.eglibc.org/archives/patches/msg00078.html
-
-When 3-pass GCC compilation is used, shared libgcc runtime libraries will be
-available after gcc pass2 completed and will meet the gotools link requirement
-at gcc pass3
----
- gotools/Makefile.am | 4 +++-
- gotools/Makefile.in | 4 +++-
- 2 files changed, 6 insertions(+), 2 deletions(-)
-
---- a/gotools/Makefile.am
-+++ b/gotools/Makefile.am
-@@ -26,6 +26,7 @@ PWD_COMMAND = $${PWDCMD-pwd}
- STAMP = echo timestamp >
-
- libgodir = ../$(target_noncanonical)/libgo
-+libgccdir = ../$(target_noncanonical)/libgcc
- LIBGODEP = $(libgodir)/libgo.la
-
- LIBGOTOOL = $(libgodir)/libgotool.a
-@@ -41,7 +42,8 @@ GOCFLAGS = $(CFLAGS_FOR_TARGET)
- GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
-
- AM_GOCFLAGS = -I $(libgodir)
--AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
-+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
-+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
- GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
-
- libgosrcdir = $(srcdir)/../libgo/go
---- a/gotools/Makefile.in
-+++ b/gotools/Makefile.in
-@@ -337,6 +337,7 @@ mkinstalldirs = $(SHELL) $(toplevel_srcd
- PWD_COMMAND = $${PWDCMD-pwd}
- STAMP = echo timestamp >
- libgodir = ../$(target_noncanonical)/libgo
-+libgccdir = ../$(target_noncanonical)/libgcc
- LIBGODEP = $(libgodir)/libgo.la
- LIBGOTOOL = $(libgodir)/libgotool.a
- @NATIVE_FALSE@GOCOMPILER = $(GOC)
-@@ -346,7 +347,8 @@ LIBGOTOOL = $(libgodir)/libgotool.a
- GOCFLAGS = $(CFLAGS_FOR_TARGET)
- GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
- AM_GOCFLAGS = -I $(libgodir)
--AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
-+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
-+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
- GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
- libgosrcdir = $(srcdir)/../libgo/go
- cmdsrcdir = $(libgosrcdir)/cmd
+++ /dev/null
-commit 9c6e71079b46ad5433165feaa2001450f2017b56
-Author: Przemysław Buczkowski <prem@prem.moe>
-Date: Mon Aug 16 13:16:21 2021 +0100
-
- GCC: Patch for Apple Silicon compatibility
-
- This patch fixes a linker error occuring when compiling
- the cross-compiler on macOS and ARM64 architecture.
-
- Adapted from:
- https://github.com/richfelker/musl-cross-make/issues/116#issuecomment-823612404
-
- Change-Id: Ia3ee98a163bbb62689f42e2da83a5ef36beb0913
- Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4329
- Reviewed-by: John Scipione <jscipione@gmail.com>
- Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
-
---- a/gcc/config/aarch64/aarch64.h
-+++ b/gcc/config/aarch64/aarch64.h
-@@ -1236,7 +1236,7 @@ extern const char *aarch64_rewrite_mcpu
- #define MCPU_TO_MARCH_SPEC_FUNCTIONS \
- { "rewrite_mcpu", aarch64_rewrite_mcpu },
-
--#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 \
---- a/gcc/config/host-darwin.c
-+++ b/gcc/config/host-darwin.c
-@@ -22,6 +22,8 @@
- #include "coretypes.h"
- #include "diagnostic-core.h"
- #include "config/host-darwin.h"
-+#include "hosthooks.h"
-+#include "hosthooks-def.h"
-
- /* Yes, this is really supposed to work. */
- /* This allows for a pagesize of 16384, which we have on Darwin20, but should
-@@ -79,3 +81,5 @@ darwin_gt_pch_use_address (void *addr, s
-
- return ret;
- }
-+
-+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
+++ /dev/null
-commit 81cc26c706b2bc8c8c1eb1a322e5c5157900836e
-Author: Felix Fietkau <nbd@openwrt.org>
-Date: Sun Oct 19 21:45:51 2014 +0000
-
- gcc: do not assume that the Mac OS X filesystem is case insensitive
-
- Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-
- SVN-Revision: 42973
-
---- a/include/filenames.h
-+++ b/include/filenames.h
-@@ -44,11 +44,6 @@ extern "C" {
- # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
- # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
- #else /* not DOSish */
--# if defined(__APPLE__)
--# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
--# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
--# endif
--# endif /* __APPLE__ */
- # define HAS_DRIVE_SPEC(f) (0)
- # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
- # define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)
+++ /dev/null
---- a/gcc/real.h
-+++ b/gcc/real.h
-@@ -77,8 +77,10 @@ struct GTY(()) real_value {
- + (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */
-
- /* Verify the guess. */
-+#ifndef __LP64__
- extern char test_real_width
- [sizeof (REAL_VALUE_TYPE) <= REAL_WIDTH * sizeof (HOST_WIDE_INT) ? 1 : -1];
-+#endif
-
- /* Calculate the format for CONST_DOUBLE. We need as many slots as
- are necessary to overlay a REAL_VALUE_TYPE on them. This could be
+++ /dev/null
-commit 098bd91f5eae625c7d2ee621e10930fc4434e5e2
-Author: Luka Perkov <luka@openwrt.org>
-Date: Tue Feb 26 16:16:33 2013 +0000
-
- gcc: don't build documentation
-
- This closes #13039.
-
- Signed-off-by: Luka Perkov <luka@openwrt.org>
-
- SVN-Revision: 35807
-
---- a/gcc/Makefile.in
-+++ b/gcc/Makefile.in
-@@ -3366,18 +3366,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
- doc/gccint.info: $(TEXI_GCCINT_FILES)
- doc/cppinternals.info: $(TEXI_CPPINT_FILES)
-
--doc/%.info: %.texi
-- if [ x$(BUILD_INFO) = xinfo ]; then \
-- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
-- -I $(gcc_docdir)/include -o $@ $<; \
-- fi
-+doc/%.info:
-
- # Duplicate entry to handle renaming of gccinstall.info
--doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
-- if [ x$(BUILD_INFO) = xinfo ]; then \
-- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
-- -I $(gcc_docdir)/include -o $@ $<; \
-- fi
-+doc/gccinstall.info:
-
- doc/cpp.dvi: $(TEXI_CPP_FILES)
- doc/gcc.dvi: $(TEXI_GCC_FILES)
+++ /dev/null
-Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790.
-MIPS16 functions have a static assembler prologue which clobbers
-registers v0 and v1. Add these register clobbers to function call
-instructions.
-
---- a/gcc/config/mips/mips.cc
-+++ b/gcc/config/mips/mips.cc
-@@ -3134,6 +3134,12 @@ mips_emit_call_insn (rtx pattern, rtx or
- emit_insn (gen_update_got_version ());
- }
-
-+ if (TARGET_MIPS16 && TARGET_USE_GOT)
-+ {
-+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS16_PIC_TEMP);
-+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS_PROLOGUE_TEMP (word_mode));
-+ }
-+
- if (TARGET_MIPS16
- && TARGET_EXPLICIT_RELOCS
- && TARGET_CALL_CLOBBERED_GP)
+++ /dev/null
-From f797260adaf52bee0ec0e16190bbefbe1bfc3692 Mon Sep 17 00:00:00 2001
-From: Patrick O'Neill <patrick@rivosinc.com>
-Date: Tue, 18 Apr 2023 14:33:13 -0700
-Subject: [PATCH] RISCV: Inline subword atomic ops
-
-RISC-V has no support for subword atomic operations; code currently
-generates libatomic library calls.
-
-This patch changes the default behavior to inline subword atomic calls
-(using the same logic as the existing library call).
-Behavior can be specified using the -minline-atomics and
--mno-inline-atomics command line flags.
-
-gcc/libgcc/config/riscv/atomic.c has the same logic implemented in asm.
-This will need to stay for backwards compatibility and the
--mno-inline-atomics flag.
-
-2023-04-18 Patrick O'Neill <patrick@rivosinc.com>
-
-gcc/ChangeLog:
- PR target/104338
- * config/riscv/riscv-protos.h: Add helper function stubs.
- * config/riscv/riscv.cc: Add helper functions for subword masking.
- * config/riscv/riscv.opt: Add command-line flag.
- * config/riscv/sync.md: Add masking logic and inline asm for fetch_and_op,
- fetch_and_nand, CAS, and exchange ops.
- * doc/invoke.texi: Add blurb regarding command-line flag.
-
-libgcc/ChangeLog:
- PR target/104338
- * config/riscv/atomic.c: Add reference to duplicate logic.
-
-gcc/testsuite/ChangeLog:
- PR target/104338
- * gcc.target/riscv/inline-atomics-1.c: New test.
- * gcc.target/riscv/inline-atomics-2.c: New test.
- * gcc.target/riscv/inline-atomics-3.c: New test.
- * gcc.target/riscv/inline-atomics-4.c: New test.
- * gcc.target/riscv/inline-atomics-5.c: New test.
- * gcc.target/riscv/inline-atomics-6.c: New test.
- * gcc.target/riscv/inline-atomics-7.c: New test.
- * gcc.target/riscv/inline-atomics-8.c: New test.
-
-Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
-Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
----
- gcc/config/riscv/riscv-protos.h | 2 +
- gcc/config/riscv/riscv.cc | 49 ++
- gcc/config/riscv/riscv.opt | 4 +
- gcc/config/riscv/sync.md | 301 +++++++++
- gcc/doc/invoke.texi | 10 +-
- .../gcc.target/riscv/inline-atomics-1.c | 18 +
- .../gcc.target/riscv/inline-atomics-2.c | 9 +
- .../gcc.target/riscv/inline-atomics-3.c | 569 ++++++++++++++++++
- .../gcc.target/riscv/inline-atomics-4.c | 566 +++++++++++++++++
- .../gcc.target/riscv/inline-atomics-5.c | 87 +++
- .../gcc.target/riscv/inline-atomics-6.c | 87 +++
- .../gcc.target/riscv/inline-atomics-7.c | 69 +++
- .../gcc.target/riscv/inline-atomics-8.c | 69 +++
- libgcc/config/riscv/atomic.c | 2 +
- 14 files changed, 1841 insertions(+), 1 deletion(-)
- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-1.c
- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-2.c
- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-3.c
- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-4.c
- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-5.c
- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-6.c
- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-7.c
- create mode 100644 gcc/testsuite/gcc.target/riscv/inline-atomics-8.c
-
---- a/gcc/config/riscv/riscv-protos.h
-+++ b/gcc/config/riscv/riscv-protos.h
-@@ -74,6 +74,8 @@ extern bool riscv_expand_block_move (rtx
- extern bool riscv_store_data_bypass_p (rtx_insn *, rtx_insn *);
- extern rtx riscv_gen_gpr_save_insn (struct riscv_frame_info *);
- extern bool riscv_gpr_save_operation_p (rtx);
-+extern void riscv_subword_address (rtx, rtx *, rtx *, rtx *, rtx *);
-+extern void riscv_lshift_subword (machine_mode, rtx, rtx, rtx *);
-
- /* Routines implemented in riscv-c.cc. */
- void riscv_cpu_cpp_builtins (cpp_reader *);
---- a/gcc/config/riscv/riscv.cc
-+++ b/gcc/config/riscv/riscv.cc
-@@ -5605,6 +5605,55 @@ riscv_asan_shadow_offset (void)
- return TARGET_64BIT ? (HOST_WIDE_INT_1 << 29) : 0;
- }
-
-+/* Given memory reference MEM, expand code to compute the aligned
-+ memory address, shift and mask values and store them into
-+ *ALIGNED_MEM, *SHIFT, *MASK and *NOT_MASK. */
-+
-+void
-+riscv_subword_address (rtx mem, rtx *aligned_mem, rtx *shift, rtx *mask,
-+ rtx *not_mask)
-+{
-+ /* Align the memory address to a word. */
-+ rtx addr = force_reg (Pmode, XEXP (mem, 0));
-+
-+ rtx addr_mask = gen_int_mode (-4, Pmode);
-+
-+ rtx aligned_addr = gen_reg_rtx (Pmode);
-+ emit_move_insn (aligned_addr, gen_rtx_AND (Pmode, addr, addr_mask));
-+
-+ *aligned_mem = change_address (mem, SImode, aligned_addr);
-+
-+ /* Calculate the shift amount. */
-+ emit_move_insn (*shift, gen_rtx_AND (SImode, gen_lowpart (SImode, addr),
-+ gen_int_mode (3, SImode)));
-+ emit_move_insn (*shift, gen_rtx_ASHIFT (SImode, *shift,
-+ gen_int_mode (3, SImode)));
-+
-+ /* Calculate the mask. */
-+ int unshifted_mask = GET_MODE_MASK (GET_MODE (mem));
-+
-+ emit_move_insn (*mask, gen_int_mode (unshifted_mask, SImode));
-+
-+ emit_move_insn (*mask, gen_rtx_ASHIFT (SImode, *mask,
-+ gen_lowpart (QImode, *shift)));
-+
-+ emit_move_insn (*not_mask, gen_rtx_NOT(SImode, *mask));
-+}
-+
-+/* Leftshift a subword within an SImode register. */
-+
-+void
-+riscv_lshift_subword (machine_mode mode, rtx value, rtx shift,
-+ rtx *shifted_value)
-+{
-+ rtx value_reg = gen_reg_rtx (SImode);
-+ emit_move_insn (value_reg, simplify_gen_subreg (SImode, value,
-+ mode, 0));
-+
-+ emit_move_insn(*shifted_value, gen_rtx_ASHIFT (SImode, value_reg,
-+ gen_lowpart (QImode, shift)));
-+}
-+
- /* Initialize the GCC target structure. */
- #undef TARGET_ASM_ALIGNED_HI_OP
- #define TARGET_ASM_ALIGNED_HI_OP "\t.half\t"
---- a/gcc/config/riscv/riscv.opt
-+++ b/gcc/config/riscv/riscv.opt
-@@ -209,6 +209,10 @@ int riscv_vector_elen_flags
- TargetVariable
- int riscv_zvl_flags
-
-+minline-atomics
-+Target Var(TARGET_INLINE_SUBWORD_ATOMIC) Init(1)
-+Always inline subword atomic operations.
-+
- Enum
- Name(isa_spec_class) Type(enum riscv_isa_spec_class)
- Supported ISA specs (for use with the -misa-spec= option):
---- a/gcc/config/riscv/sync.md
-+++ b/gcc/config/riscv/sync.md
-@@ -21,8 +21,11 @@
-
- (define_c_enum "unspec" [
- UNSPEC_COMPARE_AND_SWAP
-+ UNSPEC_COMPARE_AND_SWAP_SUBWORD
- UNSPEC_SYNC_OLD_OP
-+ UNSPEC_SYNC_OLD_OP_SUBWORD
- UNSPEC_SYNC_EXCHANGE
-+ UNSPEC_SYNC_EXCHANGE_SUBWORD
- UNSPEC_ATOMIC_STORE
- UNSPEC_MEMORY_BARRIER
- ])
-@@ -92,6 +95,135 @@
- "%F3amo<insn>.<amo>%A3 %0,%z2,%1"
- [(set (attr "length") (const_int 8))])
-
-+(define_insn "subword_atomic_fetch_strong_<atomic_optab>"
-+ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem
-+ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location
-+ (set (match_dup 1)
-+ (unspec_volatile:SI
-+ [(any_atomic:SI (match_dup 1)
-+ (match_operand:SI 2 "register_operand" "rI")) ;; value for op
-+ (match_operand:SI 3 "register_operand" "rI")] ;; mask
-+ UNSPEC_SYNC_OLD_OP_SUBWORD))
-+ (match_operand:SI 4 "register_operand" "rI") ;; not_mask
-+ (clobber (match_scratch:SI 5 "=&r")) ;; tmp_1
-+ (clobber (match_scratch:SI 6 "=&r"))] ;; tmp_2
-+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
-+ {
-+ return "1:\;"
-+ "lr.w.aq\t%0, %1\;"
-+ "<insn>\t%5, %0, %2\;"
-+ "and\t%5, %5, %3\;"
-+ "and\t%6, %0, %4\;"
-+ "or\t%6, %6, %5\;"
-+ "sc.w.rl\t%5, %6, %1\;"
-+ "bnez\t%5, 1b";
-+ }
-+ [(set (attr "length") (const_int 28))])
-+
-+(define_expand "atomic_fetch_nand<mode>"
-+ [(match_operand:SHORT 0 "register_operand") ;; old value at mem
-+ (not:SHORT (and:SHORT (match_operand:SHORT 1 "memory_operand") ;; mem location
-+ (match_operand:SHORT 2 "reg_or_0_operand"))) ;; value for op
-+ (match_operand:SI 3 "const_int_operand")] ;; model
-+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
-+{
-+ /* We have no QImode/HImode atomics, so form a mask, then use
-+ subword_atomic_fetch_strong_nand to implement a LR/SC version of the
-+ operation. */
-+
-+ /* Logic duplicated in gcc/libgcc/config/riscv/atomic.c for use when inlining
-+ is disabled */
-+
-+ rtx old = gen_reg_rtx (SImode);
-+ rtx mem = operands[1];
-+ rtx value = operands[2];
-+ rtx aligned_mem = gen_reg_rtx (SImode);
-+ rtx shift = gen_reg_rtx (SImode);
-+ rtx mask = gen_reg_rtx (SImode);
-+ rtx not_mask = gen_reg_rtx (SImode);
-+
-+ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask);
-+
-+ rtx shifted_value = gen_reg_rtx (SImode);
-+ riscv_lshift_subword (<MODE>mode, value, shift, &shifted_value);
-+
-+ emit_insn (gen_subword_atomic_fetch_strong_nand (old, aligned_mem,
-+ shifted_value,
-+ mask, not_mask));
-+
-+ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old,
-+ gen_lowpart (QImode, shift)));
-+
-+ emit_move_insn (operands[0], gen_lowpart (<MODE>mode, old));
-+
-+ DONE;
-+})
-+
-+(define_insn "subword_atomic_fetch_strong_nand"
-+ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem
-+ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location
-+ (set (match_dup 1)
-+ (unspec_volatile:SI
-+ [(not:SI (and:SI (match_dup 1)
-+ (match_operand:SI 2 "register_operand" "rI"))) ;; value for op
-+ (match_operand:SI 3 "register_operand" "rI")] ;; mask
-+ UNSPEC_SYNC_OLD_OP_SUBWORD))
-+ (match_operand:SI 4 "register_operand" "rI") ;; not_mask
-+ (clobber (match_scratch:SI 5 "=&r")) ;; tmp_1
-+ (clobber (match_scratch:SI 6 "=&r"))] ;; tmp_2
-+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
-+ {
-+ return "1:\;"
-+ "lr.w.aq\t%0, %1\;"
-+ "and\t%5, %0, %2\;"
-+ "not\t%5, %5\;"
-+ "and\t%5, %5, %3\;"
-+ "and\t%6, %0, %4\;"
-+ "or\t%6, %6, %5\;"
-+ "sc.w.rl\t%5, %6, %1\;"
-+ "bnez\t%5, 1b";
-+ }
-+ [(set (attr "length") (const_int 32))])
-+
-+(define_expand "atomic_fetch_<atomic_optab><mode>"
-+ [(match_operand:SHORT 0 "register_operand") ;; old value at mem
-+ (any_atomic:SHORT (match_operand:SHORT 1 "memory_operand") ;; mem location
-+ (match_operand:SHORT 2 "reg_or_0_operand")) ;; value for op
-+ (match_operand:SI 3 "const_int_operand")] ;; model
-+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
-+{
-+ /* We have no QImode/HImode atomics, so form a mask, then use
-+ subword_atomic_fetch_strong_<mode> to implement a LR/SC version of the
-+ operation. */
-+
-+ /* Logic duplicated in gcc/libgcc/config/riscv/atomic.c for use when inlining
-+ is disabled */
-+
-+ rtx old = gen_reg_rtx (SImode);
-+ rtx mem = operands[1];
-+ rtx value = operands[2];
-+ rtx aligned_mem = gen_reg_rtx (SImode);
-+ rtx shift = gen_reg_rtx (SImode);
-+ rtx mask = gen_reg_rtx (SImode);
-+ rtx not_mask = gen_reg_rtx (SImode);
-+
-+ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask);
-+
-+ rtx shifted_value = gen_reg_rtx (SImode);
-+ riscv_lshift_subword (<MODE>mode, value, shift, &shifted_value);
-+
-+ emit_insn (gen_subword_atomic_fetch_strong_<atomic_optab> (old, aligned_mem,
-+ shifted_value,
-+ mask, not_mask));
-+
-+ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old,
-+ gen_lowpart (QImode, shift)));
-+
-+ emit_move_insn (operands[0], gen_lowpart (<MODE>mode, old));
-+
-+ DONE;
-+})
-+
- (define_insn "atomic_exchange<mode>"
- [(set (match_operand:GPR 0 "register_operand" "=&r")
- (unspec_volatile:GPR
-@@ -104,6 +236,56 @@
- "%F3amoswap.<amo>%A3 %0,%z2,%1"
- [(set (attr "length") (const_int 8))])
-
-+(define_expand "atomic_exchange<mode>"
-+ [(match_operand:SHORT 0 "register_operand") ;; old value at mem
-+ (match_operand:SHORT 1 "memory_operand") ;; mem location
-+ (match_operand:SHORT 2 "register_operand") ;; value
-+ (match_operand:SI 3 "const_int_operand")] ;; model
-+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
-+{
-+ rtx old = gen_reg_rtx (SImode);
-+ rtx mem = operands[1];
-+ rtx value = operands[2];
-+ rtx aligned_mem = gen_reg_rtx (SImode);
-+ rtx shift = gen_reg_rtx (SImode);
-+ rtx mask = gen_reg_rtx (SImode);
-+ rtx not_mask = gen_reg_rtx (SImode);
-+
-+ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask);
-+
-+ rtx shifted_value = gen_reg_rtx (SImode);
-+ riscv_lshift_subword (<MODE>mode, value, shift, &shifted_value);
-+
-+ emit_insn (gen_subword_atomic_exchange_strong (old, aligned_mem,
-+ shifted_value, not_mask));
-+
-+ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old,
-+ gen_lowpart (QImode, shift)));
-+
-+ emit_move_insn (operands[0], gen_lowpart (<MODE>mode, old));
-+ DONE;
-+})
-+
-+(define_insn "subword_atomic_exchange_strong"
-+ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem
-+ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location
-+ (set (match_dup 1)
-+ (unspec_volatile:SI
-+ [(match_operand:SI 2 "reg_or_0_operand" "rI") ;; value
-+ (match_operand:SI 3 "reg_or_0_operand" "rI")] ;; not_mask
-+ UNSPEC_SYNC_EXCHANGE_SUBWORD))
-+ (clobber (match_scratch:SI 4 "=&r"))] ;; tmp_1
-+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
-+ {
-+ return "1:\;"
-+ "lr.w.aq\t%0, %1\;"
-+ "and\t%4, %0, %3\;"
-+ "or\t%4, %4, %2\;"
-+ "sc.w.rl\t%4, %4, %1\;"
-+ "bnez\t%4, 1b";
-+ }
-+ [(set (attr "length") (const_int 20))])
-+
- (define_insn "atomic_cas_value_strong<mode>"
- [(set (match_operand:GPR 0 "register_operand" "=&r")
- (match_operand:GPR 1 "memory_operand" "+A"))
-@@ -152,6 +334,125 @@
- DONE;
- })
-
-+(define_expand "atomic_compare_and_swap<mode>"
-+ [(match_operand:SI 0 "register_operand") ;; bool output
-+ (match_operand:SHORT 1 "register_operand") ;; val output
-+ (match_operand:SHORT 2 "memory_operand") ;; memory
-+ (match_operand:SHORT 3 "reg_or_0_operand") ;; expected value
-+ (match_operand:SHORT 4 "reg_or_0_operand") ;; desired value
-+ (match_operand:SI 5 "const_int_operand") ;; is_weak
-+ (match_operand:SI 6 "const_int_operand") ;; mod_s
-+ (match_operand:SI 7 "const_int_operand")] ;; mod_f
-+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
-+{
-+ emit_insn (gen_atomic_cas_value_strong<mode> (operands[1], operands[2],
-+ operands[3], operands[4],
-+ operands[6], operands[7]));
-+
-+ rtx val = gen_reg_rtx (SImode);
-+ if (operands[1] != const0_rtx)
-+ emit_move_insn (val, gen_rtx_SIGN_EXTEND (SImode, operands[1]));
-+ else
-+ emit_move_insn (val, const0_rtx);
-+
-+ rtx exp = gen_reg_rtx (SImode);
-+ if (operands[3] != const0_rtx)
-+ emit_move_insn (exp, gen_rtx_SIGN_EXTEND (SImode, operands[3]));
-+ else
-+ emit_move_insn (exp, const0_rtx);
-+
-+ rtx compare = val;
-+ if (exp != const0_rtx)
-+ {
-+ rtx difference = gen_rtx_MINUS (SImode, val, exp);
-+ compare = gen_reg_rtx (SImode);
-+ emit_move_insn (compare, difference);
-+ }
-+
-+ if (word_mode != SImode)
-+ {
-+ rtx reg = gen_reg_rtx (word_mode);
-+ emit_move_insn (reg, gen_rtx_SIGN_EXTEND (word_mode, compare));
-+ compare = reg;
-+ }
-+
-+ emit_move_insn (operands[0], gen_rtx_EQ (SImode, compare, const0_rtx));
-+ DONE;
-+})
-+
-+(define_expand "atomic_cas_value_strong<mode>"
-+ [(match_operand:SHORT 0 "register_operand") ;; val output
-+ (match_operand:SHORT 1 "memory_operand") ;; memory
-+ (match_operand:SHORT 2 "reg_or_0_operand") ;; expected value
-+ (match_operand:SHORT 3 "reg_or_0_operand") ;; desired value
-+ (match_operand:SI 4 "const_int_operand") ;; mod_s
-+ (match_operand:SI 5 "const_int_operand") ;; mod_f
-+ (match_scratch:SHORT 6)]
-+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
-+{
-+ /* We have no QImode/HImode atomics, so form a mask, then use
-+ subword_atomic_cas_strong<mode> to implement a LR/SC version of the
-+ operation. */
-+
-+ /* Logic duplicated in gcc/libgcc/config/riscv/atomic.c for use when inlining
-+ is disabled */
-+
-+ rtx old = gen_reg_rtx (SImode);
-+ rtx mem = operands[1];
-+ rtx aligned_mem = gen_reg_rtx (SImode);
-+ rtx shift = gen_reg_rtx (SImode);
-+ rtx mask = gen_reg_rtx (SImode);
-+ rtx not_mask = gen_reg_rtx (SImode);
-+
-+ riscv_subword_address (mem, &aligned_mem, &shift, &mask, ¬_mask);
-+
-+ rtx o = operands[2];
-+ rtx n = operands[3];
-+ rtx shifted_o = gen_reg_rtx (SImode);
-+ rtx shifted_n = gen_reg_rtx (SImode);
-+
-+ riscv_lshift_subword (<MODE>mode, o, shift, &shifted_o);
-+ riscv_lshift_subword (<MODE>mode, n, shift, &shifted_n);
-+
-+ emit_move_insn (shifted_o, gen_rtx_AND (SImode, shifted_o, mask));
-+ emit_move_insn (shifted_n, gen_rtx_AND (SImode, shifted_n, mask));
-+
-+ emit_insn (gen_subword_atomic_cas_strong (old, aligned_mem,
-+ shifted_o, shifted_n,
-+ mask, not_mask));
-+
-+ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old,
-+ gen_lowpart (QImode, shift)));
-+
-+ emit_move_insn (operands[0], gen_lowpart (<MODE>mode, old));
-+
-+ DONE;
-+})
-+
-+(define_insn "subword_atomic_cas_strong"
-+ [(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem
-+ (match_operand:SI 1 "memory_operand" "+A")) ;; mem location
-+ (set (match_dup 1)
-+ (unspec_volatile:SI [(match_operand:SI 2 "reg_or_0_operand" "rJ") ;; expected value
-+ (match_operand:SI 3 "reg_or_0_operand" "rJ")] ;; desired value
-+ UNSPEC_COMPARE_AND_SWAP_SUBWORD))
-+ (match_operand:SI 4 "register_operand" "rI") ;; mask
-+ (match_operand:SI 5 "register_operand" "rI") ;; not_mask
-+ (clobber (match_scratch:SI 6 "=&r"))] ;; tmp_1
-+ "TARGET_ATOMIC && TARGET_INLINE_SUBWORD_ATOMIC"
-+ {
-+ return "1:\;"
-+ "lr.w.aq\t%0, %1\;"
-+ "and\t%6, %0, %4\;"
-+ "bne\t%6, %z2, 1f\;"
-+ "and\t%6, %0, %5\;"
-+ "or\t%6, %6, %3\;"
-+ "sc.w.rl\t%6, %6, %1\;"
-+ "bnez\t%6, 1b\;"
-+ "1:";
-+ }
-+ [(set (attr "length") (const_int 28))])
-+
- (define_expand "atomic_test_and_set"
- [(match_operand:QI 0 "register_operand" "") ;; bool output
- (match_operand:QI 1 "memory_operand" "+A") ;; memory
---- a/gcc/doc/invoke.texi
-+++ b/gcc/doc/invoke.texi
-@@ -753,7 +753,8 @@ Objective-C and Objective-C++ Dialects}.
- -moverride=@var{string} -mverbose-cost-dump @gol
- -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
- -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
---moutline-atomics }
-+-moutline-atomics
-+-minline-atomics -mno-inline-atomics}
-
- @emph{Adapteva Epiphany Options}
- @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
-@@ -28035,6 +28036,13 @@ Do or don't use smaller but slower prolo
- library function calls. The default is to use fast inline prologues and
- epilogues.
-
-+@opindex minline-atomics
-+@item -minline-atomics
-+@itemx -mno-inline-atomics
-+Do or don't use smaller but slower subword atomic emulation code that uses
-+libatomic function calls. The default is to use fast inline subword atomics
-+that do not require libatomic.
-+
- @item -mshorten-memrefs
- @itemx -mno-shorten-memrefs
- @opindex mshorten-memrefs
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-1.c
-@@ -0,0 +1,18 @@
-+/* { dg-do compile } */
-+/* { dg-options "-mno-inline-atomics" } */
-+/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "fetch_and_nand" { target *-*-* } 0 } */
-+/* { dg-final { scan-assembler "\tcall\t__sync_fetch_and_add_1" } } */
-+/* { dg-final { scan-assembler "\tcall\t__sync_fetch_and_nand_1" } } */
-+/* { dg-final { scan-assembler "\tcall\t__sync_bool_compare_and_swap_1" } } */
-+
-+char foo;
-+char bar;
-+char baz;
-+
-+int
-+main ()
-+{
-+ __sync_fetch_and_add(&foo, 1);
-+ __sync_fetch_and_nand(&bar, 1);
-+ __sync_bool_compare_and_swap (&baz, 1, 2);
-+}
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-2.c
-@@ -0,0 +1,9 @@
-+/* { dg-do compile } */
-+/* Verify that subword atomics do not generate calls. */
-+/* { dg-options "-minline-atomics" } */
-+/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "fetch_and_nand" { target *-*-* } 0 } */
-+/* { dg-final { scan-assembler-not "\tcall\t__sync_fetch_and_add_1" } } */
-+/* { dg-final { scan-assembler-not "\tcall\t__sync_fetch_and_nand_1" } } */
-+/* { dg-final { scan-assembler-not "\tcall\t__sync_bool_compare_and_swap_1" } } */
-+
-+#include "inline-atomics-1.c"
-\ No newline at end of file
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-3.c
-@@ -0,0 +1,569 @@
-+/* Check all char alignments. */
-+/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-op-1.c */
-+/* Test __atomic routines for existence and proper execution on 1 byte
-+ values with each valid memory model. */
-+/* { dg-do run } */
-+/* { dg-options "-minline-atomics -Wno-address-of-packed-member" } */
-+
-+/* Test the execution of the __atomic_*OP builtin routines for a char. */
-+
-+extern void abort(void);
-+
-+char count, res;
-+const char init = ~0;
-+
-+struct A
-+{
-+ char a;
-+ char b;
-+ char c;
-+ char d;
-+} __attribute__ ((packed)) A;
-+
-+/* The fetch_op routines return the original value before the operation. */
-+
-+void
-+test_fetch_add (char* v)
-+{
-+ *v = 0;
-+ count = 1;
-+
-+ if (__atomic_fetch_add (v, count, __ATOMIC_RELAXED) != 0)
-+ abort ();
-+
-+ if (__atomic_fetch_add (v, 1, __ATOMIC_CONSUME) != 1)
-+ abort ();
-+
-+ if (__atomic_fetch_add (v, count, __ATOMIC_ACQUIRE) != 2)
-+ abort ();
-+
-+ if (__atomic_fetch_add (v, 1, __ATOMIC_RELEASE) != 3)
-+ abort ();
-+
-+ if (__atomic_fetch_add (v, count, __ATOMIC_ACQ_REL) != 4)
-+ abort ();
-+
-+ if (__atomic_fetch_add (v, 1, __ATOMIC_SEQ_CST) != 5)
-+ abort ();
-+}
-+
-+
-+void
-+test_fetch_sub (char* v)
-+{
-+ *v = res = 20;
-+ count = 0;
-+
-+ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_RELAXED) != res--)
-+ abort ();
-+
-+ if (__atomic_fetch_sub (v, 1, __ATOMIC_CONSUME) != res--)
-+ abort ();
-+
-+ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQUIRE) != res--)
-+ abort ();
-+
-+ if (__atomic_fetch_sub (v, 1, __ATOMIC_RELEASE) != res--)
-+ abort ();
-+
-+ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQ_REL) != res--)
-+ abort ();
-+
-+ if (__atomic_fetch_sub (v, 1, __ATOMIC_SEQ_CST) != res--)
-+ abort ();
-+}
-+
-+void
-+test_fetch_and (char* v)
-+{
-+ *v = init;
-+
-+ if (__atomic_fetch_and (v, 0, __ATOMIC_RELAXED) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_and (v, init, __ATOMIC_CONSUME) != 0)
-+ abort ();
-+
-+ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQUIRE) != 0)
-+ abort ();
-+
-+ *v = ~*v;
-+ if (__atomic_fetch_and (v, init, __ATOMIC_RELEASE) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQ_REL) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST) != 0)
-+ abort ();
-+}
-+
-+void
-+test_fetch_nand (char* v)
-+{
-+ *v = init;
-+
-+ if (__atomic_fetch_nand (v, 0, __ATOMIC_RELAXED) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_nand (v, init, __ATOMIC_CONSUME) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_nand (v, 0, __ATOMIC_ACQUIRE) != 0 )
-+ abort ();
-+
-+ if (__atomic_fetch_nand (v, init, __ATOMIC_RELEASE) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL) != 0)
-+ abort ();
-+
-+ if (__atomic_fetch_nand (v, 0, __ATOMIC_SEQ_CST) != init)
-+ abort ();
-+}
-+
-+void
-+test_fetch_xor (char* v)
-+{
-+ *v = init;
-+ count = 0;
-+
-+ if (__atomic_fetch_xor (v, count, __ATOMIC_RELAXED) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQUIRE) != 0)
-+ abort ();
-+
-+ if (__atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE) != 0)
-+ abort ();
-+
-+ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_xor (v, ~count, __ATOMIC_SEQ_CST) != init)
-+ abort ();
-+}
-+
-+void
-+test_fetch_or (char* v)
-+{
-+ *v = 0;
-+ count = 1;
-+
-+ if (__atomic_fetch_or (v, count, __ATOMIC_RELAXED) != 0)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_fetch_or (v, 2, __ATOMIC_CONSUME) != 1)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_fetch_or (v, count, __ATOMIC_ACQUIRE) != 3)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_fetch_or (v, 8, __ATOMIC_RELEASE) != 7)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_fetch_or (v, count, __ATOMIC_ACQ_REL) != 15)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_fetch_or (v, count, __ATOMIC_SEQ_CST) != 31)
-+ abort ();
-+}
-+
-+/* The OP_fetch routines return the new value after the operation. */
-+
-+void
-+test_add_fetch (char* v)
-+{
-+ *v = 0;
-+ count = 1;
-+
-+ if (__atomic_add_fetch (v, count, __ATOMIC_RELAXED) != 1)
-+ abort ();
-+
-+ if (__atomic_add_fetch (v, 1, __ATOMIC_CONSUME) != 2)
-+ abort ();
-+
-+ if (__atomic_add_fetch (v, count, __ATOMIC_ACQUIRE) != 3)
-+ abort ();
-+
-+ if (__atomic_add_fetch (v, 1, __ATOMIC_RELEASE) != 4)
-+ abort ();
-+
-+ if (__atomic_add_fetch (v, count, __ATOMIC_ACQ_REL) != 5)
-+ abort ();
-+
-+ if (__atomic_add_fetch (v, count, __ATOMIC_SEQ_CST) != 6)
-+ abort ();
-+}
-+
-+
-+void
-+test_sub_fetch (char* v)
-+{
-+ *v = res = 20;
-+ count = 0;
-+
-+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED) != --res)
-+ abort ();
-+
-+ if (__atomic_sub_fetch (v, 1, __ATOMIC_CONSUME) != --res)
-+ abort ();
-+
-+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQUIRE) != --res)
-+ abort ();
-+
-+ if (__atomic_sub_fetch (v, 1, __ATOMIC_RELEASE) != --res)
-+ abort ();
-+
-+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL) != --res)
-+ abort ();
-+
-+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_SEQ_CST) != --res)
-+ abort ();
-+}
-+
-+void
-+test_and_fetch (char* v)
-+{
-+ *v = init;
-+
-+ if (__atomic_and_fetch (v, 0, __ATOMIC_RELAXED) != 0)
-+ abort ();
-+
-+ *v = init;
-+ if (__atomic_and_fetch (v, init, __ATOMIC_CONSUME) != init)
-+ abort ();
-+
-+ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE) != 0)
-+ abort ();
-+
-+ *v = ~*v;
-+ if (__atomic_and_fetch (v, init, __ATOMIC_RELEASE) != init)
-+ abort ();
-+
-+ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL) != 0)
-+ abort ();
-+
-+ *v = ~*v;
-+ if (__atomic_and_fetch (v, 0, __ATOMIC_SEQ_CST) != 0)
-+ abort ();
-+}
-+
-+void
-+test_nand_fetch (char* v)
-+{
-+ *v = init;
-+
-+ if (__atomic_nand_fetch (v, 0, __ATOMIC_RELAXED) != init)
-+ abort ();
-+
-+ if (__atomic_nand_fetch (v, init, __ATOMIC_CONSUME) != 0)
-+ abort ();
-+
-+ if (__atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE) != init)
-+ abort ();
-+
-+ if (__atomic_nand_fetch (v, init, __ATOMIC_RELEASE) != 0)
-+ abort ();
-+
-+ if (__atomic_nand_fetch (v, init, __ATOMIC_ACQ_REL) != init)
-+ abort ();
-+
-+ if (__atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST) != init)
-+ abort ();
-+}
-+
-+
-+
-+void
-+test_xor_fetch (char* v)
-+{
-+ *v = init;
-+ count = 0;
-+
-+ if (__atomic_xor_fetch (v, count, __ATOMIC_RELAXED) != init)
-+ abort ();
-+
-+ if (__atomic_xor_fetch (v, ~count, __ATOMIC_CONSUME) != 0)
-+ abort ();
-+
-+ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE) != 0)
-+ abort ();
-+
-+ if (__atomic_xor_fetch (v, ~count, __ATOMIC_RELEASE) != init)
-+ abort ();
-+
-+ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQ_REL) != init)
-+ abort ();
-+
-+ if (__atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST) != 0)
-+ abort ();
-+}
-+
-+void
-+test_or_fetch (char* v)
-+{
-+ *v = 0;
-+ count = 1;
-+
-+ if (__atomic_or_fetch (v, count, __ATOMIC_RELAXED) != 1)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_or_fetch (v, 2, __ATOMIC_CONSUME) != 3)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_or_fetch (v, count, __ATOMIC_ACQUIRE) != 7)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_or_fetch (v, 8, __ATOMIC_RELEASE) != 15)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_or_fetch (v, count, __ATOMIC_ACQ_REL) != 31)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_or_fetch (v, count, __ATOMIC_SEQ_CST) != 63)
-+ abort ();
-+}
-+
-+
-+/* Test the OP routines with a result which isn't used. Use both variations
-+ within each function. */
-+
-+void
-+test_add (char* v)
-+{
-+ *v = 0;
-+ count = 1;
-+
-+ __atomic_add_fetch (v, count, __ATOMIC_RELAXED);
-+ if (*v != 1)
-+ abort ();
-+
-+ __atomic_fetch_add (v, count, __ATOMIC_CONSUME);
-+ if (*v != 2)
-+ abort ();
-+
-+ __atomic_add_fetch (v, 1 , __ATOMIC_ACQUIRE);
-+ if (*v != 3)
-+ abort ();
-+
-+ __atomic_fetch_add (v, 1, __ATOMIC_RELEASE);
-+ if (*v != 4)
-+ abort ();
-+
-+ __atomic_add_fetch (v, count, __ATOMIC_ACQ_REL);
-+ if (*v != 5)
-+ abort ();
-+
-+ __atomic_fetch_add (v, count, __ATOMIC_SEQ_CST);
-+ if (*v != 6)
-+ abort ();
-+}
-+
-+
-+void
-+test_sub (char* v)
-+{
-+ *v = res = 20;
-+ count = 0;
-+
-+ __atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED);
-+ if (*v != --res)
-+ abort ();
-+
-+ __atomic_fetch_sub (v, count + 1, __ATOMIC_CONSUME);
-+ if (*v != --res)
-+ abort ();
-+
-+ __atomic_sub_fetch (v, 1, __ATOMIC_ACQUIRE);
-+ if (*v != --res)
-+ abort ();
-+
-+ __atomic_fetch_sub (v, 1, __ATOMIC_RELEASE);
-+ if (*v != --res)
-+ abort ();
-+
-+ __atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL);
-+ if (*v != --res)
-+ abort ();
-+
-+ __atomic_fetch_sub (v, count + 1, __ATOMIC_SEQ_CST);
-+ if (*v != --res)
-+ abort ();
-+}
-+
-+void
-+test_and (char* v)
-+{
-+ *v = init;
-+
-+ __atomic_and_fetch (v, 0, __ATOMIC_RELAXED);
-+ if (*v != 0)
-+ abort ();
-+
-+ *v = init;
-+ __atomic_fetch_and (v, init, __ATOMIC_CONSUME);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE);
-+ if (*v != 0)
-+ abort ();
-+
-+ *v = ~*v;
-+ __atomic_fetch_and (v, init, __ATOMIC_RELEASE);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL);
-+ if (*v != 0)
-+ abort ();
-+
-+ *v = ~*v;
-+ __atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST);
-+ if (*v != 0)
-+ abort ();
-+}
-+
-+void
-+test_nand (char* v)
-+{
-+ *v = init;
-+
-+ __atomic_fetch_nand (v, 0, __ATOMIC_RELAXED);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_fetch_nand (v, init, __ATOMIC_CONSUME);
-+ if (*v != 0)
-+ abort ();
-+
-+ __atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_nand_fetch (v, init, __ATOMIC_RELEASE);
-+ if (*v != 0)
-+ abort ();
-+
-+ __atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST);
-+ if (*v != init)
-+ abort ();
-+}
-+
-+
-+
-+void
-+test_xor (char* v)
-+{
-+ *v = init;
-+ count = 0;
-+
-+ __atomic_xor_fetch (v, count, __ATOMIC_RELAXED);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME);
-+ if (*v != 0)
-+ abort ();
-+
-+ __atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE);
-+ if (*v != 0)
-+ abort ();
-+
-+ __atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST);
-+ if (*v != 0)
-+ abort ();
-+}
-+
-+void
-+test_or (char* v)
-+{
-+ *v = 0;
-+ count = 1;
-+
-+ __atomic_or_fetch (v, count, __ATOMIC_RELAXED);
-+ if (*v != 1)
-+ abort ();
-+
-+ count *= 2;
-+ __atomic_fetch_or (v, count, __ATOMIC_CONSUME);
-+ if (*v != 3)
-+ abort ();
-+
-+ count *= 2;
-+ __atomic_or_fetch (v, 4, __ATOMIC_ACQUIRE);
-+ if (*v != 7)
-+ abort ();
-+
-+ count *= 2;
-+ __atomic_fetch_or (v, 8, __ATOMIC_RELEASE);
-+ if (*v != 15)
-+ abort ();
-+
-+ count *= 2;
-+ __atomic_or_fetch (v, count, __ATOMIC_ACQ_REL);
-+ if (*v != 31)
-+ abort ();
-+
-+ count *= 2;
-+ __atomic_fetch_or (v, count, __ATOMIC_SEQ_CST);
-+ if (*v != 63)
-+ abort ();
-+}
-+
-+int
-+main ()
-+{
-+ char* V[] = {&A.a, &A.b, &A.c, &A.d};
-+
-+ for (int i = 0; i < 4; i++) {
-+ test_fetch_add (V[i]);
-+ test_fetch_sub (V[i]);
-+ test_fetch_and (V[i]);
-+ test_fetch_nand (V[i]);
-+ test_fetch_xor (V[i]);
-+ test_fetch_or (V[i]);
-+
-+ test_add_fetch (V[i]);
-+ test_sub_fetch (V[i]);
-+ test_and_fetch (V[i]);
-+ test_nand_fetch (V[i]);
-+ test_xor_fetch (V[i]);
-+ test_or_fetch (V[i]);
-+
-+ test_add (V[i]);
-+ test_sub (V[i]);
-+ test_and (V[i]);
-+ test_nand (V[i]);
-+ test_xor (V[i]);
-+ test_or (V[i]);
-+ }
-+
-+ return 0;
-+}
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-4.c
-@@ -0,0 +1,566 @@
-+/* Check all short alignments. */
-+/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-op-2.c */
-+/* Test __atomic routines for existence and proper execution on 2 byte
-+ values with each valid memory model. */
-+/* { dg-do run } */
-+/* { dg-options "-minline-atomics -Wno-address-of-packed-member" } */
-+
-+/* Test the execution of the __atomic_*OP builtin routines for a short. */
-+
-+extern void abort(void);
-+
-+short count, res;
-+const short init = ~0;
-+
-+struct A
-+{
-+ short a;
-+ short b;
-+} __attribute__ ((packed)) A;
-+
-+/* The fetch_op routines return the original value before the operation. */
-+
-+void
-+test_fetch_add (short* v)
-+{
-+ *v = 0;
-+ count = 1;
-+
-+ if (__atomic_fetch_add (v, count, __ATOMIC_RELAXED) != 0)
-+ abort ();
-+
-+ if (__atomic_fetch_add (v, 1, __ATOMIC_CONSUME) != 1)
-+ abort ();
-+
-+ if (__atomic_fetch_add (v, count, __ATOMIC_ACQUIRE) != 2)
-+ abort ();
-+
-+ if (__atomic_fetch_add (v, 1, __ATOMIC_RELEASE) != 3)
-+ abort ();
-+
-+ if (__atomic_fetch_add (v, count, __ATOMIC_ACQ_REL) != 4)
-+ abort ();
-+
-+ if (__atomic_fetch_add (v, 1, __ATOMIC_SEQ_CST) != 5)
-+ abort ();
-+}
-+
-+
-+void
-+test_fetch_sub (short* v)
-+{
-+ *v = res = 20;
-+ count = 0;
-+
-+ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_RELAXED) != res--)
-+ abort ();
-+
-+ if (__atomic_fetch_sub (v, 1, __ATOMIC_CONSUME) != res--)
-+ abort ();
-+
-+ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQUIRE) != res--)
-+ abort ();
-+
-+ if (__atomic_fetch_sub (v, 1, __ATOMIC_RELEASE) != res--)
-+ abort ();
-+
-+ if (__atomic_fetch_sub (v, count + 1, __ATOMIC_ACQ_REL) != res--)
-+ abort ();
-+
-+ if (__atomic_fetch_sub (v, 1, __ATOMIC_SEQ_CST) != res--)
-+ abort ();
-+}
-+
-+void
-+test_fetch_and (short* v)
-+{
-+ *v = init;
-+
-+ if (__atomic_fetch_and (v, 0, __ATOMIC_RELAXED) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_and (v, init, __ATOMIC_CONSUME) != 0)
-+ abort ();
-+
-+ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQUIRE) != 0)
-+ abort ();
-+
-+ *v = ~*v;
-+ if (__atomic_fetch_and (v, init, __ATOMIC_RELEASE) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_and (v, 0, __ATOMIC_ACQ_REL) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST) != 0)
-+ abort ();
-+}
-+
-+void
-+test_fetch_nand (short* v)
-+{
-+ *v = init;
-+
-+ if (__atomic_fetch_nand (v, 0, __ATOMIC_RELAXED) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_nand (v, init, __ATOMIC_CONSUME) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_nand (v, 0, __ATOMIC_ACQUIRE) != 0 )
-+ abort ();
-+
-+ if (__atomic_fetch_nand (v, init, __ATOMIC_RELEASE) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL) != 0)
-+ abort ();
-+
-+ if (__atomic_fetch_nand (v, 0, __ATOMIC_SEQ_CST) != init)
-+ abort ();
-+}
-+
-+void
-+test_fetch_xor (short* v)
-+{
-+ *v = init;
-+ count = 0;
-+
-+ if (__atomic_fetch_xor (v, count, __ATOMIC_RELAXED) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQUIRE) != 0)
-+ abort ();
-+
-+ if (__atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE) != 0)
-+ abort ();
-+
-+ if (__atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL) != init)
-+ abort ();
-+
-+ if (__atomic_fetch_xor (v, ~count, __ATOMIC_SEQ_CST) != init)
-+ abort ();
-+}
-+
-+void
-+test_fetch_or (short* v)
-+{
-+ *v = 0;
-+ count = 1;
-+
-+ if (__atomic_fetch_or (v, count, __ATOMIC_RELAXED) != 0)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_fetch_or (v, 2, __ATOMIC_CONSUME) != 1)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_fetch_or (v, count, __ATOMIC_ACQUIRE) != 3)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_fetch_or (v, 8, __ATOMIC_RELEASE) != 7)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_fetch_or (v, count, __ATOMIC_ACQ_REL) != 15)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_fetch_or (v, count, __ATOMIC_SEQ_CST) != 31)
-+ abort ();
-+}
-+
-+/* The OP_fetch routines return the new value after the operation. */
-+
-+void
-+test_add_fetch (short* v)
-+{
-+ *v = 0;
-+ count = 1;
-+
-+ if (__atomic_add_fetch (v, count, __ATOMIC_RELAXED) != 1)
-+ abort ();
-+
-+ if (__atomic_add_fetch (v, 1, __ATOMIC_CONSUME) != 2)
-+ abort ();
-+
-+ if (__atomic_add_fetch (v, count, __ATOMIC_ACQUIRE) != 3)
-+ abort ();
-+
-+ if (__atomic_add_fetch (v, 1, __ATOMIC_RELEASE) != 4)
-+ abort ();
-+
-+ if (__atomic_add_fetch (v, count, __ATOMIC_ACQ_REL) != 5)
-+ abort ();
-+
-+ if (__atomic_add_fetch (v, count, __ATOMIC_SEQ_CST) != 6)
-+ abort ();
-+}
-+
-+
-+void
-+test_sub_fetch (short* v)
-+{
-+ *v = res = 20;
-+ count = 0;
-+
-+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED) != --res)
-+ abort ();
-+
-+ if (__atomic_sub_fetch (v, 1, __ATOMIC_CONSUME) != --res)
-+ abort ();
-+
-+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQUIRE) != --res)
-+ abort ();
-+
-+ if (__atomic_sub_fetch (v, 1, __ATOMIC_RELEASE) != --res)
-+ abort ();
-+
-+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL) != --res)
-+ abort ();
-+
-+ if (__atomic_sub_fetch (v, count + 1, __ATOMIC_SEQ_CST) != --res)
-+ abort ();
-+}
-+
-+void
-+test_and_fetch (short* v)
-+{
-+ *v = init;
-+
-+ if (__atomic_and_fetch (v, 0, __ATOMIC_RELAXED) != 0)
-+ abort ();
-+
-+ *v = init;
-+ if (__atomic_and_fetch (v, init, __ATOMIC_CONSUME) != init)
-+ abort ();
-+
-+ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE) != 0)
-+ abort ();
-+
-+ *v = ~*v;
-+ if (__atomic_and_fetch (v, init, __ATOMIC_RELEASE) != init)
-+ abort ();
-+
-+ if (__atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL) != 0)
-+ abort ();
-+
-+ *v = ~*v;
-+ if (__atomic_and_fetch (v, 0, __ATOMIC_SEQ_CST) != 0)
-+ abort ();
-+}
-+
-+void
-+test_nand_fetch (short* v)
-+{
-+ *v = init;
-+
-+ if (__atomic_nand_fetch (v, 0, __ATOMIC_RELAXED) != init)
-+ abort ();
-+
-+ if (__atomic_nand_fetch (v, init, __ATOMIC_CONSUME) != 0)
-+ abort ();
-+
-+ if (__atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE) != init)
-+ abort ();
-+
-+ if (__atomic_nand_fetch (v, init, __ATOMIC_RELEASE) != 0)
-+ abort ();
-+
-+ if (__atomic_nand_fetch (v, init, __ATOMIC_ACQ_REL) != init)
-+ abort ();
-+
-+ if (__atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST) != init)
-+ abort ();
-+}
-+
-+
-+
-+void
-+test_xor_fetch (short* v)
-+{
-+ *v = init;
-+ count = 0;
-+
-+ if (__atomic_xor_fetch (v, count, __ATOMIC_RELAXED) != init)
-+ abort ();
-+
-+ if (__atomic_xor_fetch (v, ~count, __ATOMIC_CONSUME) != 0)
-+ abort ();
-+
-+ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE) != 0)
-+ abort ();
-+
-+ if (__atomic_xor_fetch (v, ~count, __ATOMIC_RELEASE) != init)
-+ abort ();
-+
-+ if (__atomic_xor_fetch (v, 0, __ATOMIC_ACQ_REL) != init)
-+ abort ();
-+
-+ if (__atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST) != 0)
-+ abort ();
-+}
-+
-+void
-+test_or_fetch (short* v)
-+{
-+ *v = 0;
-+ count = 1;
-+
-+ if (__atomic_or_fetch (v, count, __ATOMIC_RELAXED) != 1)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_or_fetch (v, 2, __ATOMIC_CONSUME) != 3)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_or_fetch (v, count, __ATOMIC_ACQUIRE) != 7)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_or_fetch (v, 8, __ATOMIC_RELEASE) != 15)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_or_fetch (v, count, __ATOMIC_ACQ_REL) != 31)
-+ abort ();
-+
-+ count *= 2;
-+ if (__atomic_or_fetch (v, count, __ATOMIC_SEQ_CST) != 63)
-+ abort ();
-+}
-+
-+
-+/* Test the OP routines with a result which isn't used. Use both variations
-+ within each function. */
-+
-+void
-+test_add (short* v)
-+{
-+ *v = 0;
-+ count = 1;
-+
-+ __atomic_add_fetch (v, count, __ATOMIC_RELAXED);
-+ if (*v != 1)
-+ abort ();
-+
-+ __atomic_fetch_add (v, count, __ATOMIC_CONSUME);
-+ if (*v != 2)
-+ abort ();
-+
-+ __atomic_add_fetch (v, 1 , __ATOMIC_ACQUIRE);
-+ if (*v != 3)
-+ abort ();
-+
-+ __atomic_fetch_add (v, 1, __ATOMIC_RELEASE);
-+ if (*v != 4)
-+ abort ();
-+
-+ __atomic_add_fetch (v, count, __ATOMIC_ACQ_REL);
-+ if (*v != 5)
-+ abort ();
-+
-+ __atomic_fetch_add (v, count, __ATOMIC_SEQ_CST);
-+ if (*v != 6)
-+ abort ();
-+}
-+
-+
-+void
-+test_sub (short* v)
-+{
-+ *v = res = 20;
-+ count = 0;
-+
-+ __atomic_sub_fetch (v, count + 1, __ATOMIC_RELAXED);
-+ if (*v != --res)
-+ abort ();
-+
-+ __atomic_fetch_sub (v, count + 1, __ATOMIC_CONSUME);
-+ if (*v != --res)
-+ abort ();
-+
-+ __atomic_sub_fetch (v, 1, __ATOMIC_ACQUIRE);
-+ if (*v != --res)
-+ abort ();
-+
-+ __atomic_fetch_sub (v, 1, __ATOMIC_RELEASE);
-+ if (*v != --res)
-+ abort ();
-+
-+ __atomic_sub_fetch (v, count + 1, __ATOMIC_ACQ_REL);
-+ if (*v != --res)
-+ abort ();
-+
-+ __atomic_fetch_sub (v, count + 1, __ATOMIC_SEQ_CST);
-+ if (*v != --res)
-+ abort ();
-+}
-+
-+void
-+test_and (short* v)
-+{
-+ *v = init;
-+
-+ __atomic_and_fetch (v, 0, __ATOMIC_RELAXED);
-+ if (*v != 0)
-+ abort ();
-+
-+ *v = init;
-+ __atomic_fetch_and (v, init, __ATOMIC_CONSUME);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_and_fetch (v, 0, __ATOMIC_ACQUIRE);
-+ if (*v != 0)
-+ abort ();
-+
-+ *v = ~*v;
-+ __atomic_fetch_and (v, init, __ATOMIC_RELEASE);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_and_fetch (v, 0, __ATOMIC_ACQ_REL);
-+ if (*v != 0)
-+ abort ();
-+
-+ *v = ~*v;
-+ __atomic_fetch_and (v, 0, __ATOMIC_SEQ_CST);
-+ if (*v != 0)
-+ abort ();
-+}
-+
-+void
-+test_nand (short* v)
-+{
-+ *v = init;
-+
-+ __atomic_fetch_nand (v, 0, __ATOMIC_RELAXED);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_fetch_nand (v, init, __ATOMIC_CONSUME);
-+ if (*v != 0)
-+ abort ();
-+
-+ __atomic_nand_fetch (v, 0, __ATOMIC_ACQUIRE);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_nand_fetch (v, init, __ATOMIC_RELEASE);
-+ if (*v != 0)
-+ abort ();
-+
-+ __atomic_fetch_nand (v, init, __ATOMIC_ACQ_REL);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_nand_fetch (v, 0, __ATOMIC_SEQ_CST);
-+ if (*v != init)
-+ abort ();
-+}
-+
-+
-+
-+void
-+test_xor (short* v)
-+{
-+ *v = init;
-+ count = 0;
-+
-+ __atomic_xor_fetch (v, count, __ATOMIC_RELAXED);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_fetch_xor (v, ~count, __ATOMIC_CONSUME);
-+ if (*v != 0)
-+ abort ();
-+
-+ __atomic_xor_fetch (v, 0, __ATOMIC_ACQUIRE);
-+ if (*v != 0)
-+ abort ();
-+
-+ __atomic_fetch_xor (v, ~count, __ATOMIC_RELEASE);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_fetch_xor (v, 0, __ATOMIC_ACQ_REL);
-+ if (*v != init)
-+ abort ();
-+
-+ __atomic_xor_fetch (v, ~count, __ATOMIC_SEQ_CST);
-+ if (*v != 0)
-+ abort ();
-+}
-+
-+void
-+test_or (short* v)
-+{
-+ *v = 0;
-+ count = 1;
-+
-+ __atomic_or_fetch (v, count, __ATOMIC_RELAXED);
-+ if (*v != 1)
-+ abort ();
-+
-+ count *= 2;
-+ __atomic_fetch_or (v, count, __ATOMIC_CONSUME);
-+ if (*v != 3)
-+ abort ();
-+
-+ count *= 2;
-+ __atomic_or_fetch (v, 4, __ATOMIC_ACQUIRE);
-+ if (*v != 7)
-+ abort ();
-+
-+ count *= 2;
-+ __atomic_fetch_or (v, 8, __ATOMIC_RELEASE);
-+ if (*v != 15)
-+ abort ();
-+
-+ count *= 2;
-+ __atomic_or_fetch (v, count, __ATOMIC_ACQ_REL);
-+ if (*v != 31)
-+ abort ();
-+
-+ count *= 2;
-+ __atomic_fetch_or (v, count, __ATOMIC_SEQ_CST);
-+ if (*v != 63)
-+ abort ();
-+}
-+
-+int
-+main () {
-+ short* V[] = {&A.a, &A.b};
-+
-+ for (int i = 0; i < 2; i++) {
-+ test_fetch_add (V[i]);
-+ test_fetch_sub (V[i]);
-+ test_fetch_and (V[i]);
-+ test_fetch_nand (V[i]);
-+ test_fetch_xor (V[i]);
-+ test_fetch_or (V[i]);
-+
-+ test_add_fetch (V[i]);
-+ test_sub_fetch (V[i]);
-+ test_and_fetch (V[i]);
-+ test_nand_fetch (V[i]);
-+ test_xor_fetch (V[i]);
-+ test_or_fetch (V[i]);
-+
-+ test_add (V[i]);
-+ test_sub (V[i]);
-+ test_and (V[i]);
-+ test_nand (V[i]);
-+ test_xor (V[i]);
-+ test_or (V[i]);
-+ }
-+
-+ return 0;
-+}
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-5.c
-@@ -0,0 +1,87 @@
-+/* Test __atomic routines for existence and proper execution on 1 byte
-+ values with each valid memory model. */
-+/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-compare-exchange-1.c */
-+/* { dg-do run } */
-+/* { dg-options "-minline-atomics" } */
-+
-+/* Test the execution of the __atomic_compare_exchange_n builtin for a char. */
-+
-+extern void abort(void);
-+
-+char v = 0;
-+char expected = 0;
-+char max = ~0;
-+char desired = ~0;
-+char zero = 0;
-+
-+#define STRONG 0
-+#define WEAK 1
-+
-+int
-+main ()
-+{
-+
-+ if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED))
-+ abort ();
-+ if (expected != 0)
-+ abort ();
-+
-+ if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
-+ abort ();
-+ if (expected != max)
-+ abort ();
-+
-+ if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
-+ abort ();
-+ if (expected != max)
-+ abort ();
-+ if (v != 0)
-+ abort ();
-+
-+ if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
-+ abort ();
-+ if (expected != 0)
-+ abort ();
-+
-+ if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
-+ abort ();
-+ if (expected != 0)
-+ abort ();
-+ if (v != max)
-+ abort ();
-+
-+ /* Now test the generic version. */
-+
-+ v = 0;
-+
-+ if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED))
-+ abort ();
-+ if (expected != 0)
-+ abort ();
-+
-+ if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
-+ abort ();
-+ if (expected != max)
-+ abort ();
-+
-+ if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
-+ abort ();
-+ if (expected != max)
-+ abort ();
-+ if (v != 0)
-+ abort ();
-+
-+ if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
-+ abort ();
-+ if (expected != 0)
-+ abort ();
-+
-+ if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
-+ abort ();
-+ if (expected != 0)
-+ abort ();
-+ if (v != max)
-+ abort ();
-+
-+ return 0;
-+}
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-6.c
-@@ -0,0 +1,87 @@
-+/* Test __atomic routines for existence and proper execution on 2 byte
-+ values with each valid memory model. */
-+/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-compare-exchange-2.c */
-+/* { dg-do run } */
-+/* { dg-options "-minline-atomics" } */
-+
-+/* Test the execution of the __atomic_compare_exchange_n builtin for a short. */
-+
-+extern void abort(void);
-+
-+short v = 0;
-+short expected = 0;
-+short max = ~0;
-+short desired = ~0;
-+short zero = 0;
-+
-+#define STRONG 0
-+#define WEAK 1
-+
-+int
-+main ()
-+{
-+
-+ if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED))
-+ abort ();
-+ if (expected != 0)
-+ abort ();
-+
-+ if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
-+ abort ();
-+ if (expected != max)
-+ abort ();
-+
-+ if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
-+ abort ();
-+ if (expected != max)
-+ abort ();
-+ if (v != 0)
-+ abort ();
-+
-+ if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
-+ abort ();
-+ if (expected != 0)
-+ abort ();
-+
-+ if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
-+ abort ();
-+ if (expected != 0)
-+ abort ();
-+ if (v != max)
-+ abort ();
-+
-+ /* Now test the generic version. */
-+
-+ v = 0;
-+
-+ if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED))
-+ abort ();
-+ if (expected != 0)
-+ abort ();
-+
-+ if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
-+ abort ();
-+ if (expected != max)
-+ abort ();
-+
-+ if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
-+ abort ();
-+ if (expected != max)
-+ abort ();
-+ if (v != 0)
-+ abort ();
-+
-+ if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
-+ abort ();
-+ if (expected != 0)
-+ abort ();
-+
-+ if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
-+ abort ();
-+ if (expected != 0)
-+ abort ();
-+ if (v != max)
-+ abort ();
-+
-+ return 0;
-+}
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-7.c
-@@ -0,0 +1,69 @@
-+/* Test __atomic routines for existence and proper execution on 1 byte
-+ values with each valid memory model. */
-+/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-exchange-1.c */
-+/* { dg-do run } */
-+/* { dg-options "-minline-atomics" } */
-+
-+/* Test the execution of the __atomic_exchange_n builtin for a char. */
-+
-+extern void abort(void);
-+
-+char v, count, ret;
-+
-+int
-+main ()
-+{
-+ v = 0;
-+ count = 0;
-+
-+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count)
-+ abort ();
-+ count++;
-+
-+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count)
-+ abort ();
-+ count++;
-+
-+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count)
-+ abort ();
-+ count++;
-+
-+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count)
-+ abort ();
-+ count++;
-+
-+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count)
-+ abort ();
-+ count++;
-+
-+ /* Now test the generic version. */
-+
-+ count++;
-+
-+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED);
-+ if (ret != count - 1 || v != count)
-+ abort ();
-+ count++;
-+
-+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE);
-+ if (ret != count - 1 || v != count)
-+ abort ();
-+ count++;
-+
-+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE);
-+ if (ret != count - 1 || v != count)
-+ abort ();
-+ count++;
-+
-+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL);
-+ if (ret != count - 1 || v != count)
-+ abort ();
-+ count++;
-+
-+ __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST);
-+ if (ret != count - 1 || v != count)
-+ abort ();
-+ count++;
-+
-+ return 0;
-+}
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/riscv/inline-atomics-8.c
-@@ -0,0 +1,69 @@
-+/* Test __atomic routines for existence and proper execution on 2 byte
-+ values with each valid memory model. */
-+/* Duplicate logic as libatomic/testsuite/libatomic.c/atomic-exchange-2.c */
-+/* { dg-do run } */
-+/* { dg-options "-minline-atomics" } */
-+
-+/* Test the execution of the __atomic_X builtin for a short. */
-+
-+extern void abort(void);
-+
-+short v, count, ret;
-+
-+int
-+main ()
-+{
-+ v = 0;
-+ count = 0;
-+
-+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count)
-+ abort ();
-+ count++;
-+
-+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count)
-+ abort ();
-+ count++;
-+
-+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count)
-+ abort ();
-+ count++;
-+
-+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count)
-+ abort ();
-+ count++;
-+
-+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count)
-+ abort ();
-+ count++;
-+
-+ /* Now test the generic version. */
-+
-+ count++;
-+
-+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED);
-+ if (ret != count - 1 || v != count)
-+ abort ();
-+ count++;
-+
-+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE);
-+ if (ret != count - 1 || v != count)
-+ abort ();
-+ count++;
-+
-+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE);
-+ if (ret != count - 1 || v != count)
-+ abort ();
-+ count++;
-+
-+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL);
-+ if (ret != count - 1 || v != count)
-+ abort ();
-+ count++;
-+
-+ __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST);
-+ if (ret != count - 1 || v != count)
-+ abort ();
-+ count++;
-+
-+ return 0;
-+}
---- a/libgcc/config/riscv/atomic.c
-+++ b/libgcc/config/riscv/atomic.c
-@@ -30,6 +30,8 @@ see the files COPYING3 and COPYING.RUNTI
- #define INVERT "not %[tmp1], %[tmp1]\n\t"
- #define DONT_INVERT ""
-
-+/* Logic duplicated in gcc/gcc/config/riscv/sync.md for use when inlining is enabled */
-+
- #define GENERATE_FETCH_AND_OP(type, size, opname, insn, invert, cop) \
- type __sync_fetch_and_ ## opname ## _ ## size (type *p, type v) \
- { \
+++ /dev/null
-From 203f3060dd363361b172f7295f42bb6bf5ac0b3b Mon Sep 17 00:00:00 2001
-From: Andreas Schwab <schwab@suse.de>
-Date: Sat, 23 Apr 2022 15:48:42 +0200
-Subject: [PATCH] riscv/linux: Don't add -latomic with -pthread
-
-Now that we have support for inline subword atomic operations, it is no
-longer necessary to link against libatomic. This also fixes testsuite
-failures because the framework does not properly set up the linker flags
-for finding libatomic.
-The use of atomic operations is also independent of the use of libpthread.
-
-gcc/
- * config/riscv/linux.h (LIB_SPEC): Don't redefine.
----
- gcc/config/riscv/linux.h | 10 ----------
- 1 file changed, 10 deletions(-)
-
---- a/gcc/config/riscv/linux.h
-+++ b/gcc/config/riscv/linux.h
-@@ -35,16 +35,6 @@ along with GCC; see the file COPYING3.
- #undef MUSL_DYNAMIC_LINKER
- #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1"
-
--/* Because RISC-V only has word-sized atomics, it requries libatomic where
-- others do not. So link libatomic by default, as needed. */
--#undef LIB_SPEC
--#ifdef LD_AS_NEEDED_OPTION
--#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC \
-- " %{pthread:" LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION "}"
--#else
--#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC " -latomic "
--#endif
--
- #define ICACHE_FLUSH_FUNC "__riscv_flush_icache"
-
- #define CPP_SPEC "%{pthread:-D_REENTRANT}"
+++ /dev/null
-commit 8570c4be394cff7282f332f97da2ff569a927ddb
-Author: Imre Kaloz <kaloz@openwrt.org>
-Date: Wed Feb 2 20:06:12 2011 +0000
-
- fixup arm soft-float symbols
-
- SVN-Revision: 25325
-
---- a/libgcc/config/arm/t-linux
-+++ b/libgcc/config/arm/t-linux
-@@ -1,6 +1,10 @@
- LIB1ASMSRC = arm/lib1funcs.S
- LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
-- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
-+ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
-+ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
-+ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
-+ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
-+ _arm_fixsfsi _arm_fixunssfsi
-
- # Just for these, we omit the frame pointer since it makes such a big
- # difference.
---- a/gcc/config/arm/linux-elf.h
-+++ b/gcc/config/arm/linux-elf.h
-@@ -58,8 +58,6 @@
- %{shared:-lc} \
- %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
-
--#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
--
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-
- #define LINUX_TARGET_LINK_SPEC "%{h*} \
+++ /dev/null
-commit c96312958c0621e72c9b32da5bc224ffe2161384
-Author: Felix Fietkau <nbd@openwrt.org>
-Date: Mon Oct 19 23:26:09 2009 +0000
-
- gcc: create a proper libgcc_pic.a static library for relinking (4.3.3+ for now, backport will follow)
-
- SVN-Revision: 18086
-
---- a/libgcc/Makefile.in
-+++ b/libgcc/Makefile.in
-@@ -930,11 +930,12 @@ $(libgcov-driver-objects): %$(objext): $
-
- # Static libraries.
- libgcc.a: $(libgcc-objects)
-+libgcc_pic.a: $(libgcc-s-objects)
- libgcov.a: $(libgcov-objects)
- libunwind.a: $(libunwind-objects)
- libgcc_eh.a: $(libgcc-eh-objects)
-
--libgcc.a libgcov.a libunwind.a libgcc_eh.a:
-+libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
- -rm -f $@
-
- objects="$(objects)"; \
-@@ -958,7 +959,7 @@ all: libunwind.a
- endif
-
- ifeq ($(enable_shared),yes)
--all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
-+all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
- ifneq ($(LIBUNWIND),)
- all: libunwind$(SHLIB_EXT)
- libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
-@@ -1164,6 +1165,10 @@ install-shared:
- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
-
-+ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
-+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
-+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
-+
- $(subst @multilib_dir@,$(MULTIDIR),$(subst \
- @shlib_base_name@,libgcc_s,$(subst \
- @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
+++ /dev/null
-commit 7edc8ca5456d9743dd0075eb3cc5b04f4f24c8cc
-Author: Imre Kaloz <kaloz@openwrt.org>
-Date: Wed Feb 2 19:34:36 2011 +0000
-
- add armv4 fixup patches
-
- SVN-Revision: 25322
-
-
---- a/gcc/config/arm/linux-eabi.h
-+++ b/gcc/config/arm/linux-eabi.h
-@@ -91,10 +91,15 @@
- #define MUSL_DYNAMIC_LINKER \
- "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
-
-+/* For armv4 we pass --fix-v4bx to linker to support EABI */
-+#undef TARGET_FIX_V4BX_SPEC
-+#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
-+ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
-+
- /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
- use the GNU/Linux version, not the generic BPABI version. */
- #undef LINK_SPEC
--#define LINK_SPEC EABI_LINK_SPEC \
-+#define LINK_SPEC EABI_LINK_SPEC TARGET_FIX_V4BX_SPEC \
- LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
- LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
-
+++ /dev/null
-commit dcfc40358b5a3cae7320c17f8d1cebd5ad5540cd
-Author: Felix Fietkau <nbd@openwrt.org>
-Date: Sun Feb 12 20:25:47 2012 +0000
-
- gcc 4.6: port over the missing patch 850-use_shared_libgcc.patch to prevent libgcc crap from leaking into every single binary
-
- 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} " \
- 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
-- do not use -lfloat. */
--#undef LIBGCC_SPEC
--
- /* Clear the instruction cache from `beg' to `end'. This is
- implemented in lib1funcs.S, so ensure an error if this definition
- 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"); \
- } while (0)
-
-+#ifndef LIBGCC_SPEC
-+#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
-+#endif
-+
- /* Determine which dynamic linker to use depending on whether GLIBC or
- uClibc or Bionic or musl is the default C library and whether
- -muclibc or -mglibc or -mbionic or -mmusl has been passed to change
---- a/libgcc/mkmap-symver.awk
-+++ b/libgcc/mkmap-symver.awk
-@@ -136,5 +136,5 @@ function output(lib) {
- else if (inherit[lib])
- printf("} %s;\n", inherit[lib]);
- else
-- printf ("\n local:\n\t*;\n};\n");
-+ printf ("\n\t*;\n};\n");
- }
---- a/gcc/config/rs6000/linux.h
-+++ b/gcc/config/rs6000/linux.h
-@@ -67,6 +67,9 @@
- #undef CPP_OS_DEFAULT_SPEC
- #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
-
-+#undef LIBGCC_SPEC
-+#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
-+
- #undef LINK_SHLIB_SPEC
- #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
- %{static-pie:-static -pie --no-dynamic-linker -z text}"
+++ /dev/null
-commit 64661de100da1ec1061ef3e5e400285dce115e6b
-Author: Felix Fietkau <nbd@openwrt.org>
-Date: Sun May 10 13:16:35 2015 +0000
-
- gcc: add some size optimization patches
-
- Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-
- SVN-Revision: 45664
-
---- a/libgcc/config/t-libunwind
-+++ b/libgcc/config/t-libunwind
-@@ -2,8 +2,7 @@
-
- HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
-
--LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
-- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
-+LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
- LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
-
- # Override the default value from t-slibgcc-elf-ver and mention -lunwind
+++ /dev/null
---- a/libgcc/crtstuff.c
-+++ b/libgcc/crtstuff.c
-@@ -152,7 +152,7 @@ call_ ## FUNC (void) \
- #endif
-
- #if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
--# define USE_TM_CLONE_REGISTRY 1
-+# define USE_TM_CLONE_REGISTRY 0
- #elif !defined(USE_TM_CLONE_REGISTRY)
- # define USE_TM_CLONE_REGISTRY 0
- #endif
+++ /dev/null
-From dda6b050cd74a352670787a294596a9c56c21327 Mon Sep 17 00:00:00 2001
-From: Yousong Zhou <yszhou4tech@gmail.com>
-Date: Fri, 4 May 2018 18:20:53 +0800
-Subject: [PATCH] gotools: fix compilation when making cross compiler
-
-libgo is "the runtime support library for the Go programming language.
-This library is intended for use with the Go frontend."
-
-gccgo will link target files with libgo.so which depends on libgcc_s.so.1, but
-the linker will complain that it cannot find it. That's because shared libgcc
-is not present in the install directory yet. libgo.so was made without problem
-because gcc will emit -lgcc_s when compiled with -shared option. When gotools
-were being made, it was supplied with -static-libgcc thus no link option was
-provided. Check LIBGO in gcc/go/gcc-spec.c for how gccgo make a builtin spec
-for linking with libgo.so
-
-- GccgoCrossCompilation, https://github.com/golang/go/wiki/GccgoCrossCompilation
-- Cross-building instructions, http://www.eglibc.org/archives/patches/msg00078.html
-
-When 3-pass GCC compilation is used, shared libgcc runtime libraries will be
-available after gcc pass2 completed and will meet the gotools link requirement
-at gcc pass3
----
- gotools/Makefile.am | 4 +++-
- gotools/Makefile.in | 4 +++-
- 2 files changed, 6 insertions(+), 2 deletions(-)
-
---- a/gotools/Makefile.am
-+++ b/gotools/Makefile.am
-@@ -26,6 +26,7 @@ PWD_COMMAND = $${PWDCMD-pwd}
- STAMP = echo timestamp >
-
- libgodir = ../$(target_noncanonical)/libgo
-+libgccdir = ../$(target_noncanonical)/libgcc
- LIBGODEP = $(libgodir)/libgo.la
-
- LIBGOTOOL = $(libgodir)/libgotool.a
-@@ -41,7 +42,8 @@ GOCFLAGS = $(CFLAGS_FOR_TARGET)
- GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
-
- AM_GOCFLAGS = -I $(libgodir)
--AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
-+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
-+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
- GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
-
- libgosrcdir = $(srcdir)/../libgo/go
---- a/gotools/Makefile.in
-+++ b/gotools/Makefile.in
-@@ -337,6 +337,7 @@ mkinstalldirs = $(SHELL) $(toplevel_srcd
- PWD_COMMAND = $${PWDCMD-pwd}
- STAMP = echo timestamp >
- libgodir = ../$(target_noncanonical)/libgo
-+libgccdir = ../$(target_noncanonical)/libgcc
- LIBGODEP = $(libgodir)/libgo.la
- LIBGOTOOL = $(libgodir)/libgotool.a
- @NATIVE_FALSE@GOCOMPILER = $(GOC)
-@@ -346,7 +347,8 @@ LIBGOTOOL = $(libgodir)/libgotool.a
- GOCFLAGS = $(CFLAGS_FOR_TARGET)
- GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
- AM_GOCFLAGS = -I $(libgodir)
--AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
-+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
-+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
- GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
- libgosrcdir = $(srcdir)/../libgo/go
- cmdsrcdir = $(libgosrcdir)/cmd
+++ /dev/null
---- a/gcc/real.h
-+++ b/gcc/real.h
-@@ -77,8 +77,10 @@ struct GTY(()) real_value {
- + (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */
-
- /* Verify the guess. */
-+#ifndef __LP64__
- extern char test_real_width
- [sizeof (REAL_VALUE_TYPE) <= REAL_WIDTH * sizeof (HOST_WIDE_INT) ? 1 : -1];
-+#endif
-
- /* Calculate the format for CONST_DOUBLE. We need as many slots as
- are necessary to overlay a REAL_VALUE_TYPE on them. This could be
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
-@@ -3397,18 +3397,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
+@@ -3398,18 +3398,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
doc/gccint.info: $(TEXI_GCCINT_FILES)
doc/cppinternals.info: $(TEXI_CPPINT_FILES)
+++ /dev/null
-Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790.
-MIPS16 functions have a static assembler prologue which clobbers
-registers v0 and v1. Add these register clobbers to function call
-instructions.
-
---- a/gcc/config/mips/mips.cc
-+++ b/gcc/config/mips/mips.cc
-@@ -3134,6 +3134,12 @@ mips_emit_call_insn (rtx pattern, rtx or
- emit_insn (gen_update_got_version ());
- }
-
-+ if (TARGET_MIPS16 && TARGET_USE_GOT)
-+ {
-+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS16_PIC_TEMP);
-+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS_PROLOGUE_TEMP (word_mode));
-+ }
-+
- if (TARGET_MIPS16
- && TARGET_EXPLICIT_RELOCS
- && TARGET_CALL_CLOBBERED_GP)
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
-@@ -972,7 +972,9 @@ proper position among the other output f
+@@ -975,7 +975,9 @@ proper position among the other output f
#endif
#ifndef LINK_SSP_SPEC
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
-@@ -20219,7 +20219,7 @@ mips_option_override (void)
+@@ -20222,7 +20222,7 @@ mips_option_override (void)
flag_pcc_struct_return = 0;
/* Decide which rtx_costs structure to use. */
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
-@@ -155,7 +155,7 @@ extern tree arm_fp16_type_node;
+@@ -165,7 +165,7 @@ emission of floating point pcs attribute
/* Thumb-1 only. */
#define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)
--#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN \
+-#define TARGET_LDRD (arm_arch5te && ARM_DOUBLEWORD_ALIGN \
+#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \
&& !TARGET_THUMB1)
+++ /dev/null
---- a/libgcc/crtstuff.c
-+++ b/libgcc/crtstuff.c
-@@ -152,7 +152,7 @@ call_ ## FUNC (void) \
- #endif
-
- #if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
--# define USE_TM_CLONE_REGISTRY 1
-+# define USE_TM_CLONE_REGISTRY 0
- #elif !defined(USE_TM_CLONE_REGISTRY)
- # define USE_TM_CLONE_REGISTRY 0
- #endif
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
-@@ -10174,8 +10174,10 @@ getenv_spec_function (int argc, const ch
+@@ -10184,8 +10184,10 @@ getenv_spec_function (int argc, const ch
}
if (!value)
--- /dev/null
+From 93954654b87552c4fe0273cab99d0f42f213f7f8 Mon Sep 17 00:00:00 2001
+From: Georgi Valkov <gvalkov@gmail.com>
+Date: Mon, 14 Apr 2025 15:45:59 +0300
+Subject: [PATCH] zlib: fix build error with Xcode 16.3
+
+Xcode 16.3 defines TARGET_OS_MAC, it was not defined in prior versions.
+zutil.h conditionally defines fdopen as NULL when this macro is defined,
+resulting in the following build error:
+
+/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected identifier or '('
+ 318 | FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
+ | ^
+./zutil.h:147:33: note: expanded from macro 'fdopen'
+ 147 | # define fdopen(fd,mode) NULL /* No fdopen() */
+
+In Xcode 16.2 and earlier, TARGET_OS_MAC was not defined so this entire
+block was ignored, gcc and gdb used to compile and work fine.
+
+This may have been used for compatibility with older versions of macOS,
+but is no longer needed. By pure luck, the build worked fine for a long
+time, because it did not properly detect macOS.
+Fixed by removing the check for TARGET_OS_MAC.
+
+Note that since Xcode 16.3, an entire set of TARGET_OS macros
+are now defined, most of which are set to 0:
+TARGET_OS_LINUX 0
+TARGET_OS_MAC 1
+TARGET_OS_OSX 1
+
+[1] https://github.com/openwrt/openwrt/pull/18467
+
+Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
+---
+ zlib/zutil.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/zlib/zutil.h
++++ b/zlib/zutil.h
+@@ -130,7 +130,7 @@ extern z_const char * const z_errmsg[10]
+ # endif
+ #endif
+
+-#if defined(MACOS) || defined(TARGET_OS_MAC)
++#if defined(MACOS)
+ # define OS_CODE 7
+ # ifndef Z_SOLO
+ # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
--- /dev/null
+From daa3e1ead791bc58208043cfc4595ba1a78cdd34 Mon Sep 17 00:00:00 2001
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Fri, 21 Nov 2025 16:25:58 +0100
+Subject: [PATCH] libcody: Make it buildable by C++11 to C++26
+
+The following builds with -std=c++11 and c++14 and c++17 and c++20 and c++23
+and c++26.
+
+I see the u8 string literals are mixed e.g. with strerror, so in
+-fexec-charset=IBM1047 there will still be garbage, so am not 100% sure if
+the u8 literals everywhere are worth it either.
+
+2025-11-21 Jakub Jelinek <jakub@redhat.com>
+
+ * cody.hh (S2C): For __cpp_char8_t >= 201811 use char8_t instead of
+ char in argument type.
+ (MessageBuffer::Space): Revert 2025-11-15 change.
+ (MessageBuffer::Append): For __cpp_char8_t >= 201811 add overload
+ with char8_t const * type of first argument.
+ (Packet::Packet): Similarly for first argument.
+ * client.cc (CommunicationError, Client::ProcessResponse,
+ Client::Connect, ConnectResponse, PathnameResponse, OKResponse,
+ IncludeTranslateResponse): Cast u8 string literals to (const char *)
+ where needed.
+ * server.cc (Server::ProcessRequests, ConnectRequest): Likewise.
+
+(cherry picked from commit 07a767c7a50d1daae8ef7d4aba73fe53ad40c0b7)
+---
+ libcody/client.cc | 36 +++++++++++++++++++-----------------
+ libcody/cody.hh | 22 ++++++++++++++++++++++
+ libcody/server.cc | 28 ++++++++++++++--------------
+ 3 files changed, 55 insertions(+), 31 deletions(-)
+
+--- a/libcody/client.cc
++++ b/libcody/client.cc
+@@ -97,7 +97,7 @@ int Client::CommunicateWithServer ()
+
+ static Packet CommunicationError (int err)
+ {
+- std::string e {u8"communication error:"};
++ std::string e {(const char *) u8"communication error:"};
+ e.append (strerror (err));
+
+ return Packet (Client::PC_ERROR, std::move (e));
+@@ -110,33 +110,34 @@ Packet Client::ProcessResponse (std::vec
+ {
+ if (e == EINVAL)
+ {
+- std::string msg (u8"malformed string '");
++ std::string msg ((const char *) u8"malformed string '");
+ msg.append (words[0]);
+- msg.append (u8"'");
++ msg.append ((const char *) u8"'");
+ return Packet (Client::PC_ERROR, std::move (msg));
+ }
+ else
+- return Packet (Client::PC_ERROR, u8"missing response");
++ return Packet (Client::PC_ERROR, (const char *) u8"missing response");
+ }
+
+ Assert (!words.empty ());
+- if (words[0] == u8"ERROR")
++ if (words[0] == (const char *) u8"ERROR")
+ return Packet (Client::PC_ERROR,
+- words.size () == 2 ? words[1]: u8"malformed error response");
++ words.size () == 2 ? words[1]
++ : (const char *) u8"malformed error response");
+
+ if (isLast && !read.IsAtEnd ())
+ return Packet (Client::PC_ERROR,
+- std::string (u8"unexpected extra response"));
++ std::string ((const char *) u8"unexpected extra response"));
+
+ Assert (code < Detail::RC_HWM);
+ Packet result (responseTable[code] (words));
+ result.SetRequest (code);
+ if (result.GetCode () == Client::PC_ERROR && result.GetString ().empty ())
+ {
+- std::string msg {u8"malformed response '"};
++ std::string msg {(const char *) u8"malformed response '"};
+
+ read.LexedLine (msg);
+- msg.append (u8"'");
++ msg.append ((const char *) u8"'");
+ result.GetString () = std::move (msg);
+ }
+ else if (result.GetCode () == Client::PC_CONNECT)
+@@ -199,7 +200,7 @@ Packet Client::Connect (char const *agen
+ size_t alen, size_t ilen)
+ {
+ write.BeginLine ();
+- write.AppendWord (u8"HELLO");
++ write.AppendWord ((const char *) u8"HELLO");
+ write.AppendInteger (Version);
+ write.AppendWord (agent, true, alen);
+ write.AppendWord (ident, true, ilen);
+@@ -211,7 +212,8 @@ Packet Client::Connect (char const *agen
+ // HELLO $version $agent [$flags]
+ Packet ConnectResponse (std::vector<std::string> &words)
+ {
+- if (words[0] == u8"HELLO" && (words.size () == 3 || words.size () == 4))
++ if (words[0] == (const char *) u8"HELLO"
++ && (words.size () == 3 || words.size () == 4))
+ {
+ char *eptr;
+ unsigned long val = strtoul (words[1].c_str (), &eptr, 10);
+@@ -247,7 +249,7 @@ Packet Client::ModuleRepo ()
+ // PATHNAME $dir | ERROR
+ Packet PathnameResponse (std::vector<std::string> &words)
+ {
+- if (words[0] == u8"PATHNAME" && words.size () == 2)
++ if (words[0] == (const char *) u8"PATHNAME" && words.size () == 2)
+ return Packet (Client::PC_PATHNAME, std::move (words[1]));
+
+ return Packet (Client::PC_ERROR, u8"");
+@@ -256,7 +258,7 @@ Packet PathnameResponse (std::vector<std
+ // OK or ERROR
+ Packet OKResponse (std::vector<std::string> &words)
+ {
+- if (words[0] == u8"OK")
++ if (words[0] == (const char *) u8"OK")
+ return Packet (Client::PC_OK);
+ else
+ return Packet (Client::PC_ERROR,
+@@ -319,11 +321,11 @@ Packet Client::IncludeTranslate (char co
+ // PATHNAME $cmifile
+ Packet IncludeTranslateResponse (std::vector<std::string> &words)
+ {
+- if (words[0] == u8"BOOL" && words.size () == 2)
++ if (words[0] == (const char *) u8"BOOL" && words.size () == 2)
+ {
+- if (words[1] == u8"FALSE")
+- return Packet (Client::PC_BOOL, 0);
+- else if (words[1] == u8"TRUE")
++ if (words[1] == (const char *) u8"FALSE")
++ return Packet (Client::PC_BOOL);
++ else if (words[1] == (const char *) u8"TRUE")
+ return Packet (Client::PC_BOOL, 1);
+ else
+ return Packet (Client::PC_ERROR, u8"");
+--- a/libcody/cody.hh
++++ b/libcody/cody.hh
+@@ -47,12 +47,21 @@ namespace Detail {
+
+ // C++11 doesn't have utf8 character literals :(
+
++#if __cpp_char8_t >= 201811
++template<unsigned I>
++constexpr char S2C (char8_t const (&s)[I])
++{
++ static_assert (I == 2, "only single octet strings may be converted");
++ return s[0];
++}
++#else
+ template<unsigned I>
+ constexpr char S2C (char const (&s)[I])
+ {
+ static_assert (I == 2, "only single octet strings may be converted");
+ return s[0];
+ }
++#endif
+
+ /// Internal buffering class. Used to concatenate outgoing messages
+ /// and Lex incoming ones.
+@@ -123,6 +132,13 @@ public:
+ Space ();
+ Append (str, maybe_quote, len);
+ }
++#if __cpp_char8_t >= 201811
++ void AppendWord (char8_t const *str, bool maybe_quote = false,
++ size_t len = ~size_t (0))
++ {
++ AppendWord ((const char *) str, maybe_quote, len);
++ }
++#endif
+ /// Add a word as with AppendWord
+ /// @param str the string to append
+ /// @param maybe_quote string might need quoting, as for Append
+@@ -264,6 +280,12 @@ public:
+ : string (s), cat (STRING), code (c)
+ {
+ }
++#if __cpp_char8_t >= 201811
++ Packet (unsigned c, const char8_t *s)
++ : string ((const char *) s), cat (STRING), code (c)
++ {
++ }
++#endif
+ Packet (unsigned c, std::vector<std::string> &&v)
+ : vector (std::move (v)), cat (VECTOR), code (c)
+ {
+--- a/libcody/server.cc
++++ b/libcody/server.cc
+@@ -36,12 +36,12 @@ static RequestPair
+ const requestTable[Detail::RC_HWM] =
+ {
+ // Same order as enum RequestCode
+- RequestPair {u8"HELLO", nullptr},
+- RequestPair {u8"MODULE-REPO", ModuleRepoRequest},
+- RequestPair {u8"MODULE-EXPORT", ModuleExportRequest},
+- RequestPair {u8"MODULE-IMPORT", ModuleImportRequest},
+- RequestPair {u8"MODULE-COMPILED", ModuleCompiledRequest},
+- RequestPair {u8"INCLUDE-TRANSLATE", IncludeTranslateRequest},
++ RequestPair {(const char *) u8"HELLO", nullptr},
++ RequestPair {(const char *) u8"MODULE-REPO", ModuleRepoRequest},
++ RequestPair {(const char *) u8"MODULE-EXPORT", ModuleExportRequest},
++ RequestPair {(const char *) u8"MODULE-IMPORT", ModuleImportRequest},
++ RequestPair {(const char *) u8"MODULE-COMPILED", ModuleCompiledRequest},
++ RequestPair {(const char *) u8"INCLUDE-TRANSLATE", IncludeTranslateRequest},
+ };
+ }
+
+@@ -135,21 +135,21 @@ void Server::ProcessRequests (void)
+ std::string msg;
+
+ if (err > 0)
+- msg = u8"error processing '";
++ msg = (const char *) u8"error processing '";
+ else if (ix >= Detail::RC_HWM)
+- msg = u8"unrecognized '";
++ msg = (const char *) u8"unrecognized '";
+ else if (IsConnected () && ix == Detail::RC_CONNECT)
+- msg = u8"already connected '";
++ msg = (const char *) u8"already connected '";
+ else if (!IsConnected () && ix != Detail::RC_CONNECT)
+- msg = u8"not connected '";
++ msg = (const char *) u8"not connected '";
+ else
+- msg = u8"malformed '";
++ msg = (const char *) u8"malformed '";
+
+ read.LexedLine (msg);
+- msg.append (u8"'");
++ msg.append ((const char *) u8"'");
+ if (err > 0)
+ {
+- msg.append (u8" ");
++ msg.append ((const char *) u8" ");
+ msg.append (strerror (err));
+ }
+ resolver->ErrorResponse (this, std::move (msg));
+@@ -176,7 +176,7 @@ Resolver *ConnectRequest (Server *s, Res
+ return nullptr;
+
+ if (words.size () == 3)
+- words.emplace_back (u8"");
++ words.emplace_back ((const char *) u8"");
+ unsigned version = ParseUnsigned (words[1]);
+ if (version == ~0u)
+ return nullptr;
--- /dev/null
+From: Lars Gierth <larsg@systemli.org>
+
+This patch backports a small but important part of the upstream commit:
+
+b3f1b9e2aa07 build: Remove INCLUDE_MEMORY [PR117737]
+
+Its original commit message fails to mention that the commit also moves
+the `#include <memory>` to an earlier position within system.h,
+which is the actual change that we're after in this patch.
+
+Building our GCC 14.3 with host GCC 16, the inclusion order starts to matter,
+which is an issue that was also touched upon by the upstream commits:
+
+9970b576b7e4 Include safe-ctype.h after C++ standard headers, to avoid over-poisoning
+f6e00226a4ca build: Move sstream include above safe-ctype.h {PR117771]
+
+Error log:
+
+ > gcc -v
+ Using built-in specs.
+ COLLECT_GCC=gcc
+ COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/16/lto-wrapper
+ OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
+ OFFLOAD_TARGET_DEFAULT=1
+ Target: x86_64-redhat-linux
+ Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,cobol,algol68,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugzilla.redhat.com/ --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-libstdcxx-zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-16.0.1-build/gcc-16.0.1-20260321/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none,amdgcn-amdhsa --enable-offload-defaulted --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-tls=gnu2 --with-arch_32=i686 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1 --disable-libssp
+ Thread model: posix
+ Supported LTO compression algorithms: zlib zstd
+ gcc version 16.0.1 20260321 (Red Hat 16.0.1-0) (GCC)
+ > git clean -fdx
+ > make defconfig
+ > make V=s
+ [...]
+ make[5]: Entering directory '/home/user/w/ow/openwrt/build_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/gcc-14.3.0-initial/gcc'
+ g++ -fno-PIE -c -DIN_GCC_FRONTEND -O2 -I/home/user/w/ow/openwrt/staging_dir/host/include -pipe -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -fno-PIE -I. -Ic -I/home/user/w/ow/openwrt/build_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/gcc-14.3.0/gcc -I/home/user/w/ow/openwrt/build_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/gcc-14.3.0/gcc/c -I/home/user/w/ow/openwrt/build_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/gcc-14.3.0/gcc/../include -I/home/user/w/ow/openwrt/build_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/gcc-14.3.0/gcc/../libcpp/include -I/home/user/w/ow/openwrt/build_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/gcc-14.3.0/gcc/../libcody -I/home/user/w/ow/openwrt/staging_dir/host/include -I/home/user/w/ow/openwrt/staging_dir/host/include -I/home/user/w/ow/openwrt/staging_dir/host/include -I/home/user/w/ow/openwrt/build_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/gcc-14.3.0/gcc/../libdecnumber -I/home/user/w/ow/openwrt/build_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/gcc-14.3.0/gcc/../libdecnumber/dpd -I../libdecnumber -I/home/user/w/ow/openwrt/build_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/gcc-14.3.0/gcc/../libbacktrace -o c/c-decl.o -MT c/c-decl.o -MMD -MP -MF c/.deps/c-decl.TPo /home/user/w/ow/openwrt/build_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/gcc-14.3.0/gcc/c/c-decl.cc
+ In file included from /usr/include/c++/16/bits/basic_ios.h:40,
+ from /usr/include/c++/16/ios:48,
+ from /usr/include/c++/16/bits/ostream.h:43,
+ from /usr/include/c++/16/bits/unique_ptr.h:42,
+ from /usr/include/c++/16/memory:80,
+ from /home/user/w/ow/openwrt/build_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/gcc-14.3.0/gcc/system.h:766,
+ from /home/user/w/ow/openwrt/build_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/gcc-14.3.0/gcc/c/c-decl.cc:30:
+ /usr/include/c++/16/bits/locale_facets.h:252:53: error: macro 'toupper' passed 2 arguments, but takes just 1
+ 252 | toupper(char_type *__lo, const char_type* __hi) const
+ | ^
+ [...]
+
+
+--- a/gcc/system.h
++++ b/gcc/system.h
+@@ -222,6 +222,7 @@ extern int fprintf_unlocked (FILE *, con
+ #ifdef INCLUDE_FUNCTIONAL
+ # include <functional>
+ #endif
++# include <memory>
+ # include <cstring>
+ # include <initializer_list>
+ # include <new>
+@@ -758,13 +759,6 @@ private:
+ #define LIKELY(x) (__builtin_expect ((x), 1))
+ #define UNLIKELY(x) (__builtin_expect ((x), 0))
+
+-/* Some of the headers included by <memory> can use "abort" within a
+- namespace, e.g. "_VSTD::abort();", which fails after we use the
+- preprocessor to redefine "abort" as "fancy_abort" below. */
+-
+-#ifdef INCLUDE_MEMORY
+-# include <memory>
+-#endif
+
+ #ifdef INCLUDE_MUTEX
+ # include <mutex>
--- /dev/null
+--- a/gcc/config/arm/arm.h
++++ b/gcc/config/arm/arm.h
+@@ -165,7 +165,7 @@ emission of floating point pcs attribute
+ /* Thumb-1 only. */
+ #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)
+
+-#define TARGET_LDRD (arm_arch5te && ARM_DOUBLEWORD_ALIGN \
++#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \
+ && !TARGET_THUMB1)
+
+ #define TARGET_CRC32 (arm_arch_crc)
+++ /dev/null
---- a/libgcc/crtstuff.c
-+++ b/libgcc/crtstuff.c
-@@ -152,7 +152,7 @@ call_ ## FUNC (void) \
- #endif
-
- #if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
--# define USE_TM_CLONE_REGISTRY 1
-+# define USE_TM_CLONE_REGISTRY 0
- #elif !defined(USE_TM_CLONE_REGISTRY)
- # define USE_TM_CLONE_REGISTRY 0
- #endif
--- /dev/null
+From daa3e1ead791bc58208043cfc4595ba1a78cdd34 Mon Sep 17 00:00:00 2001
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Fri, 21 Nov 2025 16:25:58 +0100
+Subject: [PATCH] libcody: Make it buildable by C++11 to C++26
+
+The following builds with -std=c++11 and c++14 and c++17 and c++20 and c++23
+and c++26.
+
+I see the u8 string literals are mixed e.g. with strerror, so in
+-fexec-charset=IBM1047 there will still be garbage, so am not 100% sure if
+the u8 literals everywhere are worth it either.
+
+2025-11-21 Jakub Jelinek <jakub@redhat.com>
+
+ * cody.hh (S2C): For __cpp_char8_t >= 201811 use char8_t instead of
+ char in argument type.
+ (MessageBuffer::Space): Revert 2025-11-15 change.
+ (MessageBuffer::Append): For __cpp_char8_t >= 201811 add overload
+ with char8_t const * type of first argument.
+ (Packet::Packet): Similarly for first argument.
+ * client.cc (CommunicationError, Client::ProcessResponse,
+ Client::Connect, ConnectResponse, PathnameResponse, OKResponse,
+ IncludeTranslateResponse): Cast u8 string literals to (const char *)
+ where needed.
+ * server.cc (Server::ProcessRequests, ConnectRequest): Likewise.
+
+(cherry picked from commit 07a767c7a50d1daae8ef7d4aba73fe53ad40c0b7)
+---
+ libcody/client.cc | 36 +++++++++++++++++++-----------------
+ libcody/cody.hh | 22 ++++++++++++++++++++++
+ libcody/server.cc | 28 ++++++++++++++--------------
+ 3 files changed, 55 insertions(+), 31 deletions(-)
+
+--- a/libcody/client.cc
++++ b/libcody/client.cc
+@@ -97,7 +97,7 @@ int Client::CommunicateWithServer ()
+
+ static Packet CommunicationError (int err)
+ {
+- std::string e {u8"communication error:"};
++ std::string e {(const char *) u8"communication error:"};
+ e.append (strerror (err));
+
+ return Packet (Client::PC_ERROR, std::move (e));
+@@ -110,33 +110,34 @@ Packet Client::ProcessResponse (std::vec
+ {
+ if (e == EINVAL)
+ {
+- std::string msg (u8"malformed string '");
++ std::string msg ((const char *) u8"malformed string '");
+ msg.append (words[0]);
+- msg.append (u8"'");
++ msg.append ((const char *) u8"'");
+ return Packet (Client::PC_ERROR, std::move (msg));
+ }
+ else
+- return Packet (Client::PC_ERROR, u8"missing response");
++ return Packet (Client::PC_ERROR, (const char *) u8"missing response");
+ }
+
+ Assert (!words.empty ());
+- if (words[0] == u8"ERROR")
++ if (words[0] == (const char *) u8"ERROR")
+ return Packet (Client::PC_ERROR,
+- words.size () == 2 ? words[1]: u8"malformed error response");
++ words.size () == 2 ? words[1]
++ : (const char *) u8"malformed error response");
+
+ if (isLast && !read.IsAtEnd ())
+ return Packet (Client::PC_ERROR,
+- std::string (u8"unexpected extra response"));
++ std::string ((const char *) u8"unexpected extra response"));
+
+ Assert (code < Detail::RC_HWM);
+ Packet result (responseTable[code] (words));
+ result.SetRequest (code);
+ if (result.GetCode () == Client::PC_ERROR && result.GetString ().empty ())
+ {
+- std::string msg {u8"malformed response '"};
++ std::string msg {(const char *) u8"malformed response '"};
+
+ read.LexedLine (msg);
+- msg.append (u8"'");
++ msg.append ((const char *) u8"'");
+ result.GetString () = std::move (msg);
+ }
+ else if (result.GetCode () == Client::PC_CONNECT)
+@@ -199,7 +200,7 @@ Packet Client::Connect (char const *agen
+ size_t alen, size_t ilen)
+ {
+ write.BeginLine ();
+- write.AppendWord (u8"HELLO");
++ write.AppendWord ((const char *) u8"HELLO");
+ write.AppendInteger (Version);
+ write.AppendWord (agent, true, alen);
+ write.AppendWord (ident, true, ilen);
+@@ -211,7 +212,8 @@ Packet Client::Connect (char const *agen
+ // HELLO $version $agent [$flags]
+ Packet ConnectResponse (std::vector<std::string> &words)
+ {
+- if (words[0] == u8"HELLO" && (words.size () == 3 || words.size () == 4))
++ if (words[0] == (const char *) u8"HELLO"
++ && (words.size () == 3 || words.size () == 4))
+ {
+ char *eptr;
+ unsigned long val = strtoul (words[1].c_str (), &eptr, 10);
+@@ -247,7 +249,7 @@ Packet Client::ModuleRepo ()
+ // PATHNAME $dir | ERROR
+ Packet PathnameResponse (std::vector<std::string> &words)
+ {
+- if (words[0] == u8"PATHNAME" && words.size () == 2)
++ if (words[0] == (const char *) u8"PATHNAME" && words.size () == 2)
+ return Packet (Client::PC_PATHNAME, std::move (words[1]));
+
+ return Packet (Client::PC_ERROR, u8"");
+@@ -256,7 +258,7 @@ Packet PathnameResponse (std::vector<std
+ // OK or ERROR
+ Packet OKResponse (std::vector<std::string> &words)
+ {
+- if (words[0] == u8"OK")
++ if (words[0] == (const char *) u8"OK")
+ return Packet (Client::PC_OK);
+ else
+ return Packet (Client::PC_ERROR,
+@@ -319,11 +321,11 @@ Packet Client::IncludeTranslate (char co
+ // PATHNAME $cmifile
+ Packet IncludeTranslateResponse (std::vector<std::string> &words)
+ {
+- if (words[0] == u8"BOOL" && words.size () == 2)
++ if (words[0] == (const char *) u8"BOOL" && words.size () == 2)
+ {
+- if (words[1] == u8"FALSE")
+- return Packet (Client::PC_BOOL, 0);
+- else if (words[1] == u8"TRUE")
++ if (words[1] == (const char *) u8"FALSE")
++ return Packet (Client::PC_BOOL);
++ else if (words[1] == (const char *) u8"TRUE")
+ return Packet (Client::PC_BOOL, 1);
+ else
+ return Packet (Client::PC_ERROR, u8"");
+--- a/libcody/cody.hh
++++ b/libcody/cody.hh
+@@ -47,12 +47,21 @@ namespace Detail {
+
+ // C++11 doesn't have utf8 character literals :(
+
++#if __cpp_char8_t >= 201811
++template<unsigned I>
++constexpr char S2C (char8_t const (&s)[I])
++{
++ static_assert (I == 2, "only single octet strings may be converted");
++ return s[0];
++}
++#else
+ template<unsigned I>
+ constexpr char S2C (char const (&s)[I])
+ {
+ static_assert (I == 2, "only single octet strings may be converted");
+ return s[0];
+ }
++#endif
+
+ /// Internal buffering class. Used to concatenate outgoing messages
+ /// and Lex incoming ones.
+@@ -123,6 +132,13 @@ public:
+ Space ();
+ Append (str, maybe_quote, len);
+ }
++#if __cpp_char8_t >= 201811
++ void AppendWord (char8_t const *str, bool maybe_quote = false,
++ size_t len = ~size_t (0))
++ {
++ AppendWord ((const char *) str, maybe_quote, len);
++ }
++#endif
+ /// Add a word as with AppendWord
+ /// @param str the string to append
+ /// @param maybe_quote string might need quoting, as for Append
+@@ -264,6 +280,12 @@ public:
+ : string (s), cat (STRING), code (c)
+ {
+ }
++#if __cpp_char8_t >= 201811
++ Packet (unsigned c, const char8_t *s)
++ : string ((const char *) s), cat (STRING), code (c)
++ {
++ }
++#endif
+ Packet (unsigned c, std::vector<std::string> &&v)
+ : vector (std::move (v)), cat (VECTOR), code (c)
+ {
+--- a/libcody/server.cc
++++ b/libcody/server.cc
+@@ -36,12 +36,12 @@ static RequestPair
+ const requestTable[Detail::RC_HWM] =
+ {
+ // Same order as enum RequestCode
+- RequestPair {u8"HELLO", nullptr},
+- RequestPair {u8"MODULE-REPO", ModuleRepoRequest},
+- RequestPair {u8"MODULE-EXPORT", ModuleExportRequest},
+- RequestPair {u8"MODULE-IMPORT", ModuleImportRequest},
+- RequestPair {u8"MODULE-COMPILED", ModuleCompiledRequest},
+- RequestPair {u8"INCLUDE-TRANSLATE", IncludeTranslateRequest},
++ RequestPair {(const char *) u8"HELLO", nullptr},
++ RequestPair {(const char *) u8"MODULE-REPO", ModuleRepoRequest},
++ RequestPair {(const char *) u8"MODULE-EXPORT", ModuleExportRequest},
++ RequestPair {(const char *) u8"MODULE-IMPORT", ModuleImportRequest},
++ RequestPair {(const char *) u8"MODULE-COMPILED", ModuleCompiledRequest},
++ RequestPair {(const char *) u8"INCLUDE-TRANSLATE", IncludeTranslateRequest},
+ };
+ }
+
+@@ -135,21 +135,21 @@ void Server::ProcessRequests (void)
+ std::string msg;
+
+ if (err > 0)
+- msg = u8"error processing '";
++ msg = (const char *) u8"error processing '";
+ else if (ix >= Detail::RC_HWM)
+- msg = u8"unrecognized '";
++ msg = (const char *) u8"unrecognized '";
+ else if (IsConnected () && ix == Detail::RC_CONNECT)
+- msg = u8"already connected '";
++ msg = (const char *) u8"already connected '";
+ else if (!IsConnected () && ix != Detail::RC_CONNECT)
+- msg = u8"not connected '";
++ msg = (const char *) u8"not connected '";
+ else
+- msg = u8"malformed '";
++ msg = (const char *) u8"malformed '";
+
+ read.LexedLine (msg);
+- msg.append (u8"'");
++ msg.append ((const char *) u8"'");
+ if (err > 0)
+ {
+- msg.append (u8" ");
++ msg.append ((const char *) u8" ");
+ msg.append (strerror (err));
+ }
+ resolver->ErrorResponse (this, std::move (msg));
+@@ -176,7 +176,7 @@ Resolver *ConnectRequest (Server *s, Res
+ return nullptr;
+
+ if (words.size () == 3)
+- words.emplace_back (u8"");
++ words.emplace_back ((const char *) u8"");
+ unsigned version = ParseUnsigned (words[1]);
+ if (version == ~0u)
+ return nullptr;
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
-@@ -3285,18 +3285,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
+@@ -3747,18 +3747,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
doc/gccint.info: $(TEXI_GCCINT_FILES)
doc/cppinternals.info: $(TEXI_CPPINT_FILES)
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
-@@ -987,7 +987,9 @@ proper position among the other output f
+@@ -992,7 +992,9 @@ proper position among the other output f
#endif
#ifndef LINK_SSP_SPEC
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
-@@ -20216,7 +20216,7 @@ mips_option_override (void)
+@@ -20599,7 +20599,7 @@ mips_option_override (void)
flag_pcc_struct_return = 0;
/* Decide which rtx_costs structure to use. */
--- /dev/null
+--- a/gcc/config/arm/arm.h
++++ b/gcc/config/arm/arm.h
+@@ -165,7 +165,7 @@ emission of floating point pcs attribute
+ /* Thumb-1 only. */
+ #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)
+
+-#define TARGET_LDRD (arm_arch5te && ARM_DOUBLEWORD_ALIGN \
++#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \
+ && !TARGET_THUMB1)
+
+ #define TARGET_CRC32 (arm_arch_crc)
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
-@@ -930,11 +930,12 @@ $(libgcov-driver-objects): %$(objext): $
+@@ -944,11 +944,12 @@ $(libgcov-driver-objects): %$(objext): $
# Static libraries.
libgcc.a: $(libgcc-objects)
-rm -f $@
objects="$(objects)"; \
-@@ -958,7 +959,7 @@ all: libunwind.a
+@@ -972,7 +973,7 @@ all: libunwind.a
endif
ifeq ($(enable_shared),yes)
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
-@@ -1164,6 +1165,10 @@ install-shared:
+@@ -1181,6 +1182,10 @@ install-shared:
chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
--- /dev/null
+libatomic: Do not enforce march on aarch64
+
+Inspired by The Yocto Project [1].
+
+[1] https://github.com/yoctoproject/poky/blob/51192a79f1717786dda42776f916c3d97ada7971/meta/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch
+
+Signed-off-by: Konstantin Demin <rockdrilla@gmail.com>
+
+ libatomic/Makefile.am | 1 -
+ libatomic/Makefile.in | 1 -
+ 2 files changed, 2 deletions(-)
+
+--- a/libatomic/Makefile.am
++++ b/libatomic/Makefile.am
+@@ -128,7 +128,6 @@ libatomic_la_LIBADD = $(foreach s,$(SIZE
+ ## On a target-specific basis, include alternates to be selected by IFUNC.
+ if HAVE_IFUNC
+ if ARCH_AARCH64_LINUX
+-IFUNC_OPTIONS = -march=armv8-a+lse
+ libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS)))
+
+ endif
+--- a/libatomic/Makefile.in
++++ b/libatomic/Makefile.in
+@@ -452,7 +452,6 @@ M_SRC = $(firstword $(filter %/$(M_FILE)
+ libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix \
+ _$(s)_.lo,$(SIZEOBJS))) $(am__append_1) $(am__append_2) \
+ $(am__append_3) $(am__append_4)
+-@ARCH_AARCH64_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv8-a+lse
+ @ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv7-a+fp -DHAVE_KERNEL64
+ @ARCH_I386_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=i586
+ @ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -mcx16 -mcx16
SVN-Revision: 30486
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
-@@ -126,10 +126,6 @@
- "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \
+@@ -132,10 +132,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
is used. */
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
-@@ -53,6 +53,10 @@ see the files COPYING3 and COPYING.RUNTI
+@@ -58,6 +58,10 @@ see the files COPYING3 and COPYING.RUNTI
builtin_assert ("system=posix"); \
} while (0)
}
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
-@@ -60,6 +60,9 @@
+@@ -70,6 +70,9 @@
#undef CPP_OS_DEFAULT_SPEC
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
--- 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)
{
--- a/libgcc/config/mips/t-mips16
+++ b/libgcc/config/mips/t-mips16
-@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
+@@ -42,3 +42,6 @@ SYNC_CFLAGS = -mno-mips16
# Version these symbols if building libgcc.so.
SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
--- 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;
+@@ -109,6 +109,9 @@ static size_t include_cursor;
/* Whether any standard preincluded header has been preincluded. */
static bool done_preinclude;
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
+@@ -503,6 +506,12 @@ c_common_handle_option (size_t scode, co
flag_no_builtin = !value;
break;
case OPT_fconstant_string_class_:
constant_string_class_name = arg;
break;
-@@ -1218,6 +1227,47 @@ c_common_init (void)
+@@ -1361,6 +1370,47 @@ c_common_init (void)
return false;
}
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
-@@ -1755,6 +1755,9 @@ C++ ObjC++ Optimization Alias(fexception
+@@ -2008,6 +2008,9 @@ C++ ObjC++ Optimization Alias(fexception
fhonor-std
C++ ObjC++ WarnRemoved
Assume normal C execution environment.
--- a/gcc/common.opt
+++ b/gcc/common.opt
-@@ -1770,6 +1770,9 @@ fharden-conditional-branches
- Common Var(flag_harden_conditional_branches) Optimization
- Harden conditional branches by checking reversed conditions.
+@@ -1938,6 +1938,9 @@ Enum(hardcfr_check_noreturn_calls) Strin
+ EnumValue
+ Enum(hardcfr_check_noreturn_calls) String(always) Value(HCFRNR_ALWAYS)
+fhonour-copts
+Common RejectNegative
; On SVR4 targets, it also controls whether or not to emit a
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
-@@ -9597,6 +9597,17 @@ This option is only supported for C and
- @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
- @option{-Wno-pointer-sign}.
+@@ -10897,6 +10897,17 @@ This option is only supported for C and
+
+ This warning is upgraded to an error by @option{-pedantic-errors}.
+@item -fhonour-copts
+@opindex fhonour-copts
+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
-@@ -2699,6 +2699,9 @@ common_handle_option (struct gcc_options
+@@ -2867,6 +2867,9 @@ common_handle_option (struct gcc_options
add_comma_separated_to_vector (&opts->x_flag_ignored_attributes, arg);
break;
+ break;
+
case OPT_Werror:
- dc->warning_as_error_requested = value;
+ dc->set_warning_as_error_requested (value);
break;
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
-@@ -10186,8 +10186,10 @@ getenv_spec_function (int argc, const ch
+@@ -10357,8 +10357,10 @@ getenv_spec_function (int argc, const ch
}
if (!value)
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
-@@ -1293,7 +1293,7 @@ extern const char *aarch64_rewrite_mcpu
- #define MCPU_TO_MARCH_SPEC_FUNCTIONS \
- { "rewrite_mcpu", aarch64_rewrite_mcpu },
+@@ -1469,7 +1469,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 @@
--- /dev/null
+From 93954654b87552c4fe0273cab99d0f42f213f7f8 Mon Sep 17 00:00:00 2001
+From: Georgi Valkov <gvalkov@gmail.com>
+Date: Mon, 14 Apr 2025 15:45:59 +0300
+Subject: [PATCH] zlib: fix build error with Xcode 16.3
+
+Xcode 16.3 defines TARGET_OS_MAC, it was not defined in prior versions.
+zutil.h conditionally defines fdopen as NULL when this macro is defined,
+resulting in the following build error:
+
+/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected identifier or '('
+ 318 | FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
+ | ^
+./zutil.h:147:33: note: expanded from macro 'fdopen'
+ 147 | # define fdopen(fd,mode) NULL /* No fdopen() */
+
+In Xcode 16.2 and earlier, TARGET_OS_MAC was not defined so this entire
+block was ignored, gcc and gdb used to compile and work fine.
+
+This may have been used for compatibility with older versions of macOS,
+but is no longer needed. By pure luck, the build worked fine for a long
+time, because it did not properly detect macOS.
+Fixed by removing the check for TARGET_OS_MAC.
+
+Note that since Xcode 16.3, an entire set of TARGET_OS macros
+are now defined, most of which are set to 0:
+TARGET_OS_LINUX 0
+TARGET_OS_MAC 1
+TARGET_OS_OSX 1
+
+[1] https://github.com/openwrt/openwrt/pull/18467
+
+Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
+---
+ zlib/zutil.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/zlib/zutil.h
++++ b/zlib/zutil.h
+@@ -130,7 +130,7 @@ extern z_const char * const z_errmsg[10]
+ # endif
+ #endif
+
+-#if defined(MACOS) || defined(TARGET_OS_MAC)
++#if defined(MACOS)
+ # define OS_CODE 7
+ # ifndef Z_SOLO
+ # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+++ /dev/null
-commit 81cc26c706b2bc8c8c1eb1a322e5c5157900836e
-Author: Felix Fietkau <nbd@openwrt.org>
-Date: Sun Oct 19 21:45:51 2014 +0000
-
- gcc: do not assume that the Mac OS X filesystem is case insensitive
-
- Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-
- SVN-Revision: 42973
-
---- a/include/filenames.h
-+++ b/include/filenames.h
-@@ -43,11 +43,6 @@ extern "C" {
- # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
- # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
- #else /* not DOSish */
--# if defined(__APPLE__)
--# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
--# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
--# endif
--# endif /* __APPLE__ */
- # define HAS_DRIVE_SPEC(f) (0)
- # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
- # define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)
+++ /dev/null
---- a/gcc/real.h
-+++ b/gcc/real.h
-@@ -70,8 +70,10 @@ struct GTY(()) real_value {
- + (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */
-
- /* Verify the guess. */
-+#ifndef __LP64__
- extern char test_real_width
- [sizeof (REAL_VALUE_TYPE) <= REAL_WIDTH * sizeof (HOST_WIDE_INT) ? 1 : -1];
-+#endif
-
- /* Calculate the format for CONST_DOUBLE. We need as many slots as
- are necessary to overlay a REAL_VALUE_TYPE on them. This could be
+++ /dev/null
-commit 098bd91f5eae625c7d2ee621e10930fc4434e5e2
-Author: Luka Perkov <luka@openwrt.org>
-Date: Tue Feb 26 16:16:33 2013 +0000
-
- gcc: don't build documentation
-
- This closes #13039.
-
- Signed-off-by: Luka Perkov <luka@openwrt.org>
-
- SVN-Revision: 35807
-
---- a/gcc/Makefile.in
-+++ b/gcc/Makefile.in
-@@ -3204,18 +3204,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
- doc/gccint.info: $(TEXI_GCCINT_FILES)
- doc/cppinternals.info: $(TEXI_CPPINT_FILES)
-
--doc/%.info: %.texi
-- if [ x$(BUILD_INFO) = xinfo ]; then \
-- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
-- -I $(gcc_docdir)/include -o $@ $<; \
-- fi
-+doc/%.info:
-
- # Duplicate entry to handle renaming of gccinstall.info
--doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
-- if [ x$(BUILD_INFO) = xinfo ]; then \
-- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
-- -I $(gcc_docdir)/include -o $@ $<; \
-- fi
-+doc/gccinstall.info:
-
- doc/cpp.dvi: $(TEXI_CPP_FILES)
- doc/gcc.dvi: $(TEXI_GCC_FILES)
+++ /dev/null
-Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790.
-MIPS16 functions have a static assembler prologue which clobbers
-registers v0 and v1. Add these register clobbers to function call
-instructions.
-
---- a/gcc/config/mips/mips.c
-+++ b/gcc/config/mips/mips.c
-@@ -3102,6 +3102,12 @@ mips_emit_call_insn (rtx pattern, rtx or
- emit_insn (gen_update_got_version ());
- }
-
-+ if (TARGET_MIPS16 && TARGET_USE_GOT)
-+ {
-+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS16_PIC_TEMP);
-+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS_PROLOGUE_TEMP (word_mode));
-+ }
-+
- if (TARGET_MIPS16
- && TARGET_EXPLICIT_RELOCS
- && TARGET_CALL_CLOBBERED_GP)
+++ /dev/null
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -868,7 +868,9 @@ proper position among the other output f
- #endif
-
- #ifndef LINK_SSP_SPEC
--#ifdef TARGET_LIBC_PROVIDES_SSP
-+#if DEFAULT_LIBC == LIBC_MUSL
-+#define LINK_SSP_SPEC "-lssp_nonshared"
-+#elif defined(TARGET_LIBC_PROVIDES_SSP)
- #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
- #else
+++ /dev/null
-commit ecf7671b769fe96f7b5134be442089f8bdba55d2
-Author: Felix Fietkau <nbd@nbd.name>
-Date: Thu Aug 4 20:29:45 2016 +0200
-
-gcc: add a patch to generate better code with Os on mips
-
-Also happens to reduce compressed code size a bit
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
-
---- a/gcc/config/mips/mips.c
-+++ b/gcc/config/mips/mips.c
-@@ -19847,7 +19847,7 @@ mips_option_override (void)
- flag_pcc_struct_return = 0;
-
- /* Decide which rtx_costs structure to use. */
-- if (optimize_size)
-+ if (0 && optimize_size)
- mips_cost = &mips_rtx_cost_optimize_size;
- else
- mips_cost = &mips_rtx_cost_data[mips_tune];
+++ /dev/null
-commit 8570c4be394cff7282f332f97da2ff569a927ddb
-Author: Imre Kaloz <kaloz@openwrt.org>
-Date: Wed Feb 2 20:06:12 2011 +0000
-
- fixup arm soft-float symbols
-
- SVN-Revision: 25325
-
---- a/libgcc/config/arm/t-linux
-+++ b/libgcc/config/arm/t-linux
-@@ -1,6 +1,10 @@
- LIB1ASMSRC = arm/lib1funcs.S
- LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
-- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
-+ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
-+ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
-+ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
-+ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
-+ _arm_fixsfsi _arm_fixunssfsi
-
- # Just for these, we omit the frame pointer since it makes such a big
- # difference.
---- a/gcc/config/arm/linux-elf.h
-+++ b/gcc/config/arm/linux-elf.h
-@@ -58,8 +58,6 @@
- %{shared:-lc} \
- %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
-
--#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
--
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-
- #define LINUX_TARGET_LINK_SPEC "%{h*} \
+++ /dev/null
-commit c96312958c0621e72c9b32da5bc224ffe2161384
-Author: Felix Fietkau <nbd@openwrt.org>
-Date: Mon Oct 19 23:26:09 2009 +0000
-
- gcc: create a proper libgcc_pic.a static library for relinking (4.3.3+ for now, backport will follow)
-
- SVN-Revision: 18086
-
---- a/libgcc/Makefile.in
-+++ b/libgcc/Makefile.in
-@@ -923,11 +923,12 @@ $(libgcov-driver-objects): %$(objext): $
-
- # Static libraries.
- libgcc.a: $(libgcc-objects)
-+libgcc_pic.a: $(libgcc-s-objects)
- libgcov.a: $(libgcov-objects)
- libunwind.a: $(libunwind-objects)
- libgcc_eh.a: $(libgcc-eh-objects)
-
--libgcc.a libgcov.a libunwind.a libgcc_eh.a:
-+libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
- -rm -f $@
-
- objects="$(objects)"; \
-@@ -948,7 +949,7 @@ all: libunwind.a
- endif
-
- ifeq ($(enable_shared),yes)
--all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
-+all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
- ifneq ($(LIBUNWIND),)
- all: libunwind$(SHLIB_EXT)
- libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
-@@ -1154,6 +1155,10 @@ install-shared:
- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
-
-+ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
-+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
-+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
-+
- $(subst @multilib_dir@,$(MULTIDIR),$(subst \
- @shlib_base_name@,libgcc_s,$(subst \
- @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
+++ /dev/null
-commit 7edc8ca5456d9743dd0075eb3cc5b04f4f24c8cc
-Author: Imre Kaloz <kaloz@openwrt.org>
-Date: Wed Feb 2 19:34:36 2011 +0000
-
- add armv4 fixup patches
-
- SVN-Revision: 25322
-
-
---- a/gcc/config/arm/linux-eabi.h
-+++ b/gcc/config/arm/linux-eabi.h
-@@ -88,10 +88,15 @@
- #define MUSL_DYNAMIC_LINKER \
- "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
-
-+/* For armv4 we pass --fix-v4bx to linker to support EABI */
-+#undef TARGET_FIX_V4BX_SPEC
-+#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
-+ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
-+
- /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
- use the GNU/Linux version, not the generic BPABI version. */
- #undef LINK_SPEC
--#define LINK_SPEC EABI_LINK_SPEC \
-+#define LINK_SPEC EABI_LINK_SPEC TARGET_FIX_V4BX_SPEC \
- LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
- LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
-
+++ /dev/null
-commit 64661de100da1ec1061ef3e5e400285dce115e6b
-Author: Felix Fietkau <nbd@openwrt.org>
-Date: Sun May 10 13:16:35 2015 +0000
-
- gcc: add some size optimization patches
-
- Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-
- SVN-Revision: 45664
-
---- a/libgcc/config/t-libunwind
-+++ b/libgcc/config/t-libunwind
-@@ -2,8 +2,7 @@
-
- HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
-
--LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
-- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
-+LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
- LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
-
- # Override the default value from t-slibgcc-elf-ver and mention -lunwind
+++ /dev/null
---- a/gcc/config/rs6000/rs6000.c
-+++ b/gcc/config/rs6000/rs6000.c
-@@ -24780,7 +24780,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)
- {
-- if (!optimize_size)
-+ if (1)
- {
- strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
- strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
+++ /dev/null
---- a/libgcc/crtstuff.c
-+++ b/libgcc/crtstuff.c
-@@ -152,7 +152,7 @@ call_ ## FUNC (void) \
- #endif
-
- #if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
--# define USE_TM_CLONE_REGISTRY 1
-+# define USE_TM_CLONE_REGISTRY 0
- #endif
-
- /* We do not want to add the weak attribute to the declarations of these
+++ /dev/null
---- a/libgcc/config/mips/t-mips16
-+++ b/libgcc/config/mips/t-mips16
-@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
-
- # Version these symbols if building libgcc.so.
- SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
-+
-+CRTSTUFF_T_CFLAGS += -mno-mips16
-+CRTSTUFF_T_CFLAGS_S += -mno-mips16
+++ /dev/null
-commit 99368862e44740ff4fd33760893f04e14f9dbdf1
-Author: Felix Fietkau <nbd@openwrt.org>
-Date: Tue Jul 31 00:52:27 2007 +0000
-
- Port the mbsd_multi patch from freewrt, which adds -fhonour-copts. This will emit warnings in packages that don't use our target cflags properly
-
- SVN-Revision: 8256
-
- This patch brings over a feature from MirBSD:
- * -fhonour-copts
- If this option is not given, it's warned (depending
- on environment variables). This is to catch errors
- of misbuilt packages which override CFLAGS themselves.
-
- This patch was authored by Thorsten Glaser <tg at mirbsd.de>
- with copyright assignment to the FSF in effect.
-
---- a/gcc/c-family/c-opts.c
-+++ b/gcc/c-family/c-opts.c
-@@ -107,6 +107,9 @@ static dump_flags_t original_dump_flags;
- /* Whether any standard preincluded header has been preincluded. */
- static bool done_preinclude;
-
-+/* Check if a port honours COPTS. */
-+static int honour_copts = 0;
-+
- static void handle_OPT_d (const char *);
- static void set_std_cxx98 (int);
- static void set_std_cxx11 (int);
-@@ -459,6 +462,12 @@ c_common_handle_option (size_t scode, co
- flag_no_builtin = !value;
- break;
-
-+ case OPT_fhonour_copts:
-+ if (c_language == clk_c) {
-+ honour_copts++;
-+ }
-+ break;
-+
- case OPT_fconstant_string_class_:
- constant_string_class_name = arg;
- break;
-@@ -1125,6 +1134,47 @@ c_common_init (void)
- return false;
- }
-
-+ if (c_language == clk_c) {
-+ char *ev = getenv ("GCC_HONOUR_COPTS");
-+ int evv;
-+ if (ev == NULL)
-+ evv = -1;
-+ else if ((*ev == '0') || (*ev == '\0'))
-+ evv = 0;
-+ else if (*ev == '1')
-+ evv = 1;
-+ else if (*ev == '2')
-+ evv = 2;
-+ else if (*ev == 's')
-+ evv = -1;
-+ else {
-+ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
-+ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
-+ }
-+ if (evv == 1) {
-+ if (honour_copts == 0) {
-+ error ("someone does not honour COPTS at all in lenient mode");
-+ return false;
-+ } else if (honour_copts != 1) {
-+ warning (0, "someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ }
-+ } else if (evv == 2) {
-+ if (honour_copts == 0) {
-+ error ("someone does not honour COPTS at all in strict mode");
-+ return false;
-+ } else if (honour_copts != 1) {
-+ error ("someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ return false;
-+ }
-+ } else if (evv == 0) {
-+ if (honour_copts != 1)
-+ inform (UNKNOWN_LOCATION, "someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ }
-+ }
-+
- return true;
- }
-
---- a/gcc/c-family/c.opt
-+++ b/gcc/c-family/c.opt
-@@ -1469,6 +1469,9 @@ C++ ObjC++ Optimization Alias(fexception
- fhonor-std
- C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
-
-+fhonour-copts
-+C ObjC C++ ObjC++ RejectNegative
-+
- fhosted
- C ObjC
- Assume normal C execution environment.
---- a/gcc/common.opt
-+++ b/gcc/common.opt
-@@ -1551,6 +1551,9 @@ fguess-branch-probability
- Common Report Var(flag_guess_branch_prob) Optimization
- Enable guessing of branch probabilities.
-
-+fhonour-copts
-+Common RejectNegative
-+
- ; Nonzero means ignore `#ident' directives. 0 means handle them.
- ; Generate position-independent code for executables if possible
- ; On SVR4 targets, it also controls whether or not to emit a
---- a/gcc/opts.c
-+++ b/gcc/opts.c
-@@ -2073,6 +2073,9 @@ common_handle_option (struct gcc_options
- opts, opts_set, loc, dc);
- break;
-
-+ case OPT_fhonour_copts:
-+ break;
-+
- case OPT_Wlarger_than_:
- opts->x_larger_than_size = value;
- opts->x_warn_larger_than = value != -1;
---- a/gcc/doc/invoke.texi
-+++ b/gcc/doc/invoke.texi
-@@ -7013,6 +7013,17 @@ This option is only supported for C and
- @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
- @option{-Wno-pointer-sign}.
-
-+@item -fhonour-copts
-+@opindex fhonour-copts
-+If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
-+given at least once, and warn if it is given more than once.
-+If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
-+given exactly once.
-+If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
-+is not given exactly once.
-+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
+++ /dev/null
-Author: Jo-Philipp Wich <jow@openwrt.org>
-Date: Sat Apr 21 03:02:39 2012 +0000
-
- gcc: add patch to make the getenv() spec function nonfatal if requested environment variable is unset
-
- SVN-Revision: 31390
-
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -9347,8 +9347,10 @@ getenv_spec_function (int argc, const ch
- value = varname;
-
- if (!value)
-- fatal_error (input_location,
-- "environment variable %qs not defined", varname);
-+ {
-+ warning (input_location, "environment variable %qs not defined", varname);
-+ value = "";
-+ }
-
- /* We have to escape every character of the environment variable so
- they are not interpreted as active spec characters. A
+++ /dev/null
-From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001
-From: Andrew McDonnell <bugs@andrewmcdonnell.net>
-Date: Fri, 3 Oct 2014 19:09:00 +0930
-Subject: Add .note.GNU-stack section
-
-See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html
-Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html
-
-Re: [Patch, MIPS] Add .note.GNU-stack section
-
- From: Steve Ellcey <sellcey at mips dot com>
-
-On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote:
->
->
-> On Wed, Sep 10, 2014 at 9:27 AM, <pinskia@gmail.com> wrote:
-
-> This works except you did not update the assembly files in
-> libgcc or glibc. We (Cavium) have the same patch in our tree
-> for a few released versions.
-
-> Mind just checking yours in then Andrew?
-
-> Thanks!
-> -eric
-
-I talked to Andrew about what files he changed in GCC and created and
-tested this new patch. Andrew also mentioned changing some assembly
-files in glibc but I don't see any use of '.section .note.GNU-stack' in
-any assembly files in glibc (for any platform) so I wasn't planning on
-creating a glibc to add them to mips glibc assembly language files.
-
-OK to check in this patch?
-
-Steve Ellcey
-sellcey@mips.com
-
-
-
-2014-09-26 Steve Ellcey <sellcey@mips.com>
----
- gcc/config/mips/mips.c | 3 +++
- libgcc/config/mips/crti.S | 4 ++++
- libgcc/config/mips/crtn.S | 3 +++
- libgcc/config/mips/mips16.S | 4 ++++
- libgcc/config/mips/vr4120-div.S | 4 ++++
- 5 files changed, 18 insertions(+)
-
---- a/gcc/config/mips/mips.c
-+++ b/gcc/config/mips/mips.c
-@@ -22640,6 +22640,9 @@ mips_starting_frame_offset (void)
- #undef TARGET_STARTING_FRAME_OFFSET
- #define TARGET_STARTING_FRAME_OFFSET mips_starting_frame_offset
-
-+#undef TARGET_ASM_FILE_END
-+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
-+
- struct gcc_target targetm = TARGET_INITIALIZER;
- \f
- #include "gt-mips.h"
---- a/libgcc/config/mips/crti.S
-+++ b/libgcc/config/mips/crti.S
-@@ -21,6 +21,10 @@ a copy of the GCC Runtime Library Except
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-+
-+/* An executable stack is *not* required for these functions. */
-+ .section .note.GNU-stack,"",%progbits
-+
- /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
- Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
-
---- a/libgcc/config/mips/crtn.S
-+++ b/libgcc/config/mips/crtn.S
-@@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Except
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-+/* An executable stack is *not* required for these functions. */
-+ .section .note.GNU-stack,"",%progbits
-+
- /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
- Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
-
---- a/libgcc/config/mips/mips16.S
-+++ b/libgcc/config/mips/mips16.S
-@@ -48,6 +48,10 @@ see the files COPYING3 and COPYING.RUNTI
- values using the soft-float calling convention, but do the actual
- operation using the hard floating point instructions. */
-
-+/* An executable stack is *not* required for these functions. */
-+ .section .note.GNU-stack,"",%progbits
-+ .previous
-+
- #if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64)
-
- /* This file contains 32-bit assembly code. */
---- a/libgcc/config/mips/vr4120-div.S
-+++ b/libgcc/config/mips/vr4120-div.S
-@@ -26,6 +26,10 @@ see the files COPYING3 and COPYING.RUNTI
- -mfix-vr4120. div and ddiv do not give the correct result when one
- of the operands is negative. */
-
-+/* An executable stack is *not* required for these functions. */
-+ .section .note.GNU-stack,"",%progbits
-+ .previous
-+
- .set nomips16
-
- #define DIV \
+++ /dev/null
-From c0c62fa4256f805389f16ebfc4a60cf789129b50 Mon Sep 17 00:00:00 2001
-From: BangLang Huang <banglang.huang@foxmail.com>
-Date: Wed, 9 Nov 2016 10:36:49 +0800
-Subject: [PATCH] libffi: fix MIPS softfloat build issue
-
-Backported from github.com/libffi/libffi#272
-
-Signed-off-by: BangLang Huang <banglang.huang@foxmail.com>
-Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
----
- libffi/src/mips/n32.S | 17 +++++++++++++++++
- libffi/src/mips/o32.S | 17 +++++++++++++++++
- 2 files changed, 34 insertions(+)
-
---- a/libffi/src/mips/n32.S
-+++ b/libffi/src/mips/n32.S
-@@ -107,6 +107,16 @@ loadregs:
-
- REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6.
-
-+#ifdef __mips_soft_float
-+ REG_L a0, 0*FFI_SIZEOF_ARG(t9)
-+ REG_L a1, 1*FFI_SIZEOF_ARG(t9)
-+ REG_L a2, 2*FFI_SIZEOF_ARG(t9)
-+ REG_L a3, 3*FFI_SIZEOF_ARG(t9)
-+ REG_L a4, 4*FFI_SIZEOF_ARG(t9)
-+ REG_L a5, 5*FFI_SIZEOF_ARG(t9)
-+ REG_L a6, 6*FFI_SIZEOF_ARG(t9)
-+ REG_L a7, 7*FFI_SIZEOF_ARG(t9)
-+#else
- and t4, t6, ((1<<FFI_FLAG_BITS)-1)
- REG_L a0, 0*FFI_SIZEOF_ARG(t9)
- beqz t4, arg1_next
-@@ -193,6 +203,7 @@ arg7_next:
- arg8_doublep:
- l.d $f19, 7*FFI_SIZEOF_ARG(t9)
- arg8_next:
-+#endif
-
- callit:
- # Load the function pointer
-@@ -214,6 +225,7 @@ retint:
- b epilogue
-
- retfloat:
-+#ifndef __mips_soft_float
- bne t6, FFI_TYPE_FLOAT, retdouble
- jal t9
- REG_L t4, 4*FFI_SIZEOF_ARG($fp)
-@@ -272,6 +284,7 @@ retstruct_f_d:
- s.s $f0, 0(t4)
- s.d $f2, 8(t4)
- b epilogue
-+#endif
-
- retstruct_d_soft:
- bne t6, FFI_TYPE_STRUCT_D_SOFT, retstruct_f_soft
-@@ -429,6 +442,7 @@ ffi_closure_N32:
- REG_S a6, A6_OFF2($sp)
- REG_S a7, A7_OFF2($sp)
-
-+#ifndef __mips_soft_float
- # Store all possible float/double registers.
- s.d $f12, F12_OFF2($sp)
- s.d $f13, F13_OFF2($sp)
-@@ -438,6 +452,7 @@ ffi_closure_N32:
- s.d $f17, F17_OFF2($sp)
- s.d $f18, F18_OFF2($sp)
- s.d $f19, F19_OFF2($sp)
-+#endif
-
- # Call ffi_closure_mips_inner_N32 to do the real work.
- LA t9, ffi_closure_mips_inner_N32
-@@ -458,6 +473,7 @@ cls_retint:
- b cls_epilogue
-
- cls_retfloat:
-+#ifndef __mips_soft_float
- bne v0, FFI_TYPE_FLOAT, cls_retdouble
- l.s $f0, V0_OFF2($sp)
- b cls_epilogue
-@@ -500,6 +516,7 @@ cls_retstruct_f_d:
- l.s $f0, V0_OFF2($sp)
- l.d $f2, V1_OFF2($sp)
- b cls_epilogue
-+#endif
-
- cls_retstruct_small2:
- REG_L v0, V0_OFF2($sp)
---- a/libffi/src/mips/o32.S
-+++ b/libffi/src/mips/o32.S
-@@ -82,13 +82,16 @@ sixteen:
-
- ADDU $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args
-
-+#ifndef __mips_soft_float
- bnez t0, pass_d # make it quick for int
-+#endif
- REG_L a0, 0*FFI_SIZEOF_ARG($sp) # just go ahead and load the
- REG_L a1, 1*FFI_SIZEOF_ARG($sp) # four regs.
- REG_L a2, 2*FFI_SIZEOF_ARG($sp)
- REG_L a3, 3*FFI_SIZEOF_ARG($sp)
- b call_it
-
-+#ifndef __mips_soft_float
- pass_d:
- bne t0, FFI_ARGS_D, pass_f
- l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
-@@ -130,6 +133,7 @@ pass_f_d:
- # bne t0, FFI_ARGS_F_D, call_it
- l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
- l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float
-+#endif
-
- call_it:
- # Load the function pointer
-@@ -158,14 +162,23 @@ retfloat:
- bne t2, FFI_TYPE_FLOAT, retdouble
- jalr t9
- REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
-+#ifndef __mips_soft_float
- s.s $f0, 0(t0)
-+#else
-+ REG_S v0, 0(t0)
-+#endif
- b epilogue
-
- retdouble:
- bne t2, FFI_TYPE_DOUBLE, noretval
- jalr t9
- REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
-+#ifndef __mips_soft_float
- s.d $f0, 0(t0)
-+#else
-+ REG_S v1, 4(t0)
-+ REG_S v0, 0(t0)
-+#endif
- b epilogue
-
- noretval:
-@@ -261,9 +274,11 @@ $LCFI7:
- li $13, 1 # FFI_O32
- bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT
-
-+#ifndef __mips_soft_float
- # Store all possible float/double registers.
- s.d $f12, FA_0_0_OFF2($fp)
- s.d $f14, FA_1_0_OFF2($fp)
-+#endif
- 1:
- # Call ffi_closure_mips_inner_O32 to do the work.
- la t9, ffi_closure_mips_inner_O32
-@@ -281,6 +296,7 @@ $LCFI7:
- li $13, 1 # FFI_O32
- bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT
-
-+#ifndef __mips_soft_float
- li $9, FFI_TYPE_FLOAT
- l.s $f0, V0_OFF2($fp)
- beq $8, $9, closure_done
-@@ -288,6 +304,7 @@ $LCFI7:
- li $9, FFI_TYPE_DOUBLE
- l.d $f0, V0_OFF2($fp)
- beq $8, $9, closure_done
-+#endif
- 1:
- REG_L $3, V1_OFF2($fp)
- REG_L $2, V0_OFF2($fp)
+++ /dev/null
-From dda6b050cd74a352670787a294596a9c56c21327 Mon Sep 17 00:00:00 2001
-From: Yousong Zhou <yszhou4tech@gmail.com>
-Date: Fri, 4 May 2018 18:20:53 +0800
-Subject: [PATCH] gotools: fix compilation when making cross compiler
-
-libgo is "the runtime support library for the Go programming language.
-This library is intended for use with the Go frontend."
-
-gccgo will link target files with libgo.so which depends on libgcc_s.so.1, but
-the linker will complain that it cannot find it. That's because shared libgcc
-is not present in the install directory yet. libgo.so was made without problem
-because gcc will emit -lgcc_s when compiled with -shared option. When gotools
-were being made, it was supplied with -static-libgcc thus no link option was
-provided. Check LIBGO in gcc/go/gcc-spec.c for how gccgo make a builtin spec
-for linking with libgo.so
-
-- GccgoCrossCompilation, https://github.com/golang/go/wiki/GccgoCrossCompilation
-- Cross-building instructions, http://www.eglibc.org/archives/patches/msg00078.html
-
-When 3-pass GCC compilation is used, shared libgcc runtime libraries will be
-available after gcc pass2 completed and will meet the gotools link requirement
-at gcc pass3
----
- gotools/Makefile.am | 4 +++-
- gotools/Makefile.in | 4 +++-
- 2 files changed, 6 insertions(+), 2 deletions(-)
-
---- a/gotools/Makefile.am
-+++ b/gotools/Makefile.am
-@@ -26,6 +26,7 @@ PWD_COMMAND = $${PWDCMD-pwd}
- STAMP = echo timestamp >
-
- libgodir = ../$(target_noncanonical)/libgo
-+libgccdir = ../$(target_noncanonical)/libgcc
- LIBGODEP = $(libgodir)/libgo.la
-
- LIBGOTOOL = $(libgodir)/libgotool.a
-@@ -41,7 +42,8 @@ GOCFLAGS = $(CFLAGS_FOR_TARGET)
- GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
-
- AM_GOCFLAGS = -I $(libgodir)
--AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
-+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
-+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
- GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
-
- libgosrcdir = $(srcdir)/../libgo/go
---- a/gotools/Makefile.in
-+++ b/gotools/Makefile.in
-@@ -263,6 +263,7 @@ mkinstalldirs = $(SHELL) $(toplevel_srcd
- PWD_COMMAND = $${PWDCMD-pwd}
- STAMP = echo timestamp >
- libgodir = ../$(target_noncanonical)/libgo
-+libgccdir = ../$(target_noncanonical)/libgcc
- LIBGODEP = $(libgodir)/libgo.la
- LIBGOTOOL = $(libgodir)/libgotool.a
- @NATIVE_FALSE@GOCOMPILER = $(GOC)
-@@ -271,7 +272,8 @@ LIBGOTOOL = $(libgodir)/libgotool.a
- @NATIVE_TRUE@GOCOMPILER = $(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET)
- GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
- AM_GOCFLAGS = -I $(libgodir)
--AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
-+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
-+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
- GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
- libgosrcdir = $(srcdir)/../libgo/go
- cmdsrcdir = $(libgosrcdir)/cmd