<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">diff -rupN binutils/binutils/bucomm.c binutils.patched/binutils/bucomm.c
--- binutils/binutils/bucomm.c	2023-01-03 11:46:41.815275246 +0000
+++ binutils.patched/binutils/bucomm.c	2023-01-03 11:45:33.326331901 +0000
@@ -536,6 +536,61 @@ template_in_dir (const char *path)
 #undef template
 }
 
+#if defined (_WIN32) &amp;&amp; !defined (__CYGWIN32__)
+
+/*
+ * Workaround mingw mkstemp producing duplicate filenames when cross-compiled
+ * on Linux.
+ */
+
+#include &lt;stdlib.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;string.h&gt;
+#include &lt;io.h&gt;
+#include &lt;errno.h&gt;
+#include &lt;share.h&gt;
+#include &lt;fcntl.h&gt;
+#include &lt;sys/stat.h&gt;
+
+static int mingw_mkstemp (char *template_name)
+{
+    int i, j, fd, len, index;
+
+    /* These are the (62) characters used in temporary filenames. */
+    static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+
+    /* The last six characters of template must be "XXXXXX" */
+    if (template_name == NULL || (len = strlen (template_name)) &lt; 6
+            || memcmp (template_name + (len - 6), "XXXXXX", 6)) {
+        errno = EINVAL;
+        return -1;
+    }
+
+    /* User may supply more than six trailing Xs */
+    for (index = len - 6; index &gt; 0 &amp;&amp; template_name[index - 1] == 'X'; index--);
+
+    /*
+        Like OpenBSD, mkstemp() will try at least 2 ** 31 combinations before
+        giving up.
+     */
+    for (i = 0; i &gt;= 0; i++) {
+        for(j = index; j &lt; len; j++) {
+            template_name[j] = letters[rand () % 62];
+        }
+        fd = _sopen(template_name,
+                _O_RDWR | _O_CREAT | _O_EXCL | _O_BINARY,
+                _SH_DENYRW, _S_IREAD | _S_IWRITE);
+        if (fd != -1) return fd;
+        if (fd == -1 &amp;&amp; errno != EEXIST) return -1;
+    }
+
+    return -1;
+}
+
+#define mkstemp mingw_mkstemp
+
+#endif
+
 /* Return the name of a created temporary file in the same directory
    as FILENAME.  */
 
diff -rupN binutils/binutils/configure binutils.patched/binutils/configure
--- binutils/binutils/configure	2023-01-03 11:46:41.807275136 +0000
+++ binutils.patched/binutils/configure	2023-01-03 11:45:33.334332012 +0000
@@ -14689,7 +14689,7 @@ do
 	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
 	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
 	  ;;
-	x86_64-*-mingw* | x86_64-*-cygwin*)
+	x86_64-*-mingw* | aarch64-*-mingw* | x86_64-*-cygwin*)
   	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
 	  if test -z "$DLLTOOL_DEFAULT"; then
 	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
diff -rupN binutils/binutils/Makefile.in binutils.patched/binutils/Makefile.in
--- binutils/binutils/Makefile.in	2023-01-03 11:46:41.803275082 +0000
+++ binutils.patched/binutils/Makefile.in	2023-01-03 11:45:33.334332012 +0000
@@ -867,8 +867,7 @@ man_MANS = \
 info_TEXINFOS = doc/binutils.texi
 binutils_TEXI = $(srcdir)/doc/binutils.texi
 AM_MAKEINFOFLAGS = -I "$(srcdir)/doc" -I "$(top_srcdir)/../libiberty" \
-		   -I "$(top_srcdir)/../bfd/doc" -I ../bfd/doc \
-		   --no-split
+		   -I "$(top_srcdir)/../bfd/doc" -I ../bfd/doc
 
 TEXI2DVI = texi2dvi -I "$(srcdir)/doc" -I "$(top_srcdir)/../libiberty" \
 		    -I "$(top_srcdir)/../bfd/doc" -I ../bfd/doc
diff -rupN binutils/configure binutils.patched/configure
--- binutils/configure	2023-01-03 11:46:41.031264489 +0000
+++ binutils.patched/configure	2023-01-03 11:45:33.338332067 +0000
@@ -3486,7 +3486,7 @@ case "${target}" in
   i[3456789]86-*-mingw*)
     noconfigdirs="$noconfigdirs target-libffi"
     ;;
-  x86_64-*-mingw*)
+  x86_64-*-mingw* | aarch64-*-mingw*)
     noconfigdirs="$noconfigdirs target-libffi"
     ;;
   mmix-*-*)
@@ -7987,7 +7987,7 @@ case " $target_configdirs " in
 esac
 
 case "$target" in
-  x86_64-*mingw* | *-w64-mingw*)
+  x86_64-*mingw* | aarch64-*mingw* | *-w64-mingw*)
   # MinGW-w64 does not use newlib, nor does it use winsup. It may,
   # however, use a symlink named 'mingw' in ${prefix} .
     FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L${prefix}/${target}/lib -L${prefix}/mingw/lib -isystem ${prefix}/${target}/include -isystem ${prefix}/mingw/include'
diff -rupN binutils/gas/Makefile.in binutils.patched/gas/Makefile.in
--- binutils/gas/Makefile.in	2023-01-03 11:46:43.067292426 +0000
+++ binutils.patched/gas/Makefile.in	2023-01-03 11:45:33.342332122 +0000
@@ -922,8 +922,7 @@ man_MANS = doc/as.1
 info_TEXINFOS = doc/as.texi
 doc_as_TEXINFOS = doc/asconfig.texi $(CPU_DOCS)
 AM_MAKEINFOFLAGS = -I "$(srcdir)/doc" -I doc -I "$(srcdir)/../libiberty" \
-		   -I "$(srcdir)/../bfd/doc" -I ../bfd/doc \
-		   --no-split
+		   -I "$(srcdir)/../bfd/doc" -I ../bfd/doc
 
 TEXI2DVI = texi2dvi -I "$(srcdir)/doc" -I doc -I "$(srcdir)/../libiberty" \
 		   -I "$(srcdir)/../bfd/doc" -I ../bfd/doc
diff -rupN binutils/intl/configure binutils.patched/intl/configure
--- binutils/intl/configure	2023-01-03 11:46:42.907290231 +0000
+++ binutils.patched/intl/configure	2023-01-03 11:45:33.342332122 +0000
@@ -6838,7 +6838,7 @@ case "${host}" in
 	;;
     i[34567]86-*-cygwin* | x86_64-*-cygwin*)
 	;;
-    i[34567]86-*-mingw* | x86_64-*-mingw*)
+    i[34567]86-*-mingw* | x86_64-*-mingw* | aarch64-*-mingw*)
 	;;
     i[34567]86-*-interix[3-9]*)
 	# Interix 3.x gcc -fpic/-fPIC options generate broken code.
diff -rupN binutils/ld/Makefile.in binutils.patched/ld/Makefile.in
--- binutils/ld/Makefile.in	2023-01-03 11:46:41.883276179 +0000
+++ binutils.patched/ld/Makefile.in	2023-01-03 11:45:33.346332178 +0000
@@ -633,7 +633,7 @@ ld_TEXINFOS = configdoc.texi
 noinst_TEXINFOS = ldint.texi
 man_MANS = ld.1
 AM_MAKEINFOFLAGS = -I $(srcdir) -I $(BFDDIR)/doc -I ../bfd/doc \
-		   -I $(top_srcdir)/../libiberty --no-split
+		   -I $(top_srcdir)/../libiberty
 
 TEXI2DVI = texi2dvi -I $(srcdir) -I $(BFDDIR)/doc -I ../bfd/doc \
 		    -I $(top_srcdir)/../libiberty
diff -rupN binutils/libdecnumber/configure binutils.patched/libdecnumber/configure
--- binutils/libdecnumber/configure	2023-01-03 11:46:44.339309878 +0000
+++ binutils.patched/libdecnumber/configure	2023-01-03 11:45:33.346332178 +0000
@@ -4764,7 +4764,7 @@ else
     aarch64* | \
     powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \
     i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \
-    i?86*-*-mingw* | x86_64*-*-mingw* | \
+    i?86*-*-mingw* | x86_64*-*-mingw* | aarch64*-*-mingw* | \
     i?86*-*-cygwin* | x86_64*-*-cygwin*)
       enable_decimal_float=yes
       ;;
diff -rupN binutils/libiberty/configure binutils.patched/libiberty/configure
--- binutils/libiberty/configure	2023-01-03 11:46:43.011291658 +0000
+++ binutils.patched/libiberty/configure	2023-01-03 11:45:33.350332233 +0000
@@ -5330,7 +5330,7 @@ case "${host}" in
 	;;
     i[34567]86-*-cygwin* | x86_64-*-cygwin*)
 	;;
-    i[34567]86-*-mingw* | x86_64-*-mingw*)
+    i[34567]86-*-mingw* | x86_64-*-mingw* | aarch64-*-mingw*)
 	;;
     i[34567]86-*-interix[3-9]*)
 	# Interix 3.x gcc -fpic/-fPIC options generate broken code.
</pre></body></html>