public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v2 00/13] Add aarch64-w64-mingw32 target
@ 2024-03-04 17:24 Evgeny Karpov
  2024-03-04 17:30 ` [PATCH v2 01/13] Introduce " Evgeny Karpov
                   ` (17 more replies)
  0 siblings, 18 replies; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 17:24 UTC (permalink / raw)
  To: gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

Hello,

v2 is ready for the review!
Based on the v1 review: https://gcc.gnu.org/pipermail/gcc-patches/2024-February/thread.html#646203

Testing for the x86_64-w64-mingw32 target is in progress to avoid
regression due to refactoring.

Regards,
Evgeny


Changes from v1 to v2:
Adjust the target name to aarch64-*-mingw* to exclude the big-endian
target from support.
Exclude 64-bit ISA.
Rename enum calling_abi to aarch64_calling_abi.
Move AArch64 MS ABI definitions FIXED_REGISTERS,
CALL_REALLY_USED_REGISTERS, and STATIC_CHAIN_REGNUM from aarch64.h 
to aarch64-abi-ms.h.
Rename TARGET_ARM64_MS_ABI to TARGET_AARCH64_MS_ABI.
Exclude TARGET_64BIT from the aarch64 target.
Exclude HAVE_GAS_WEAK.
Set HAVE_GAS_ALIGNED_COMM to 1 by default.
Use a reference from "x86 Windows Options" to 
"Cygwin and MinGW Options".
Update commit descriptions to follow standard style.
Rebase from 4th March 2024.


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 01/13] Introduce aarch64-w64-mingw32 target
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
@ 2024-03-04 17:30 ` Evgeny Karpov
  2024-03-04 17:33 ` [PATCH v2 02/13] aarch64: The aarch64-w64-mingw32 target implements Evgeny Karpov
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 17:30 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

From 38efaf5ab1fa017622d10239fff2ca23d2d3fb82 Mon Sep 17 00:00:00 2001
From: Zac Walker <zacwalker@microsoft.com>
Date: Fri, 1 Mar 2024 01:40:53 +0100
Subject: [PATCH v2 01/13] Introduce aarch64-w64-mingw32 target

Add the initial aarch64-w64-mingw32 target for gcc.

fixincludes/ChangeLog:

	* mkfixinc.sh: Extend for *-mingw32* targets.

gcc/ChangeLog:

	* config.gcc: Add aarch64-w64-mingw32 target.
---
 fixincludes/mkfixinc.sh |  3 +--
 gcc/config.gcc          | 13 +++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/fixincludes/mkfixinc.sh b/fixincludes/mkfixinc.sh
index df90720b716..7112f4dcd64 100755
--- a/fixincludes/mkfixinc.sh
+++ b/fixincludes/mkfixinc.sh
@@ -12,8 +12,7 @@ target=fixinc.sh
 # Check for special fix rules for particular targets
 case $machine in
     i?86-*-cygwin* | \
-    i?86-*-mingw32* | \
-    x86_64-*-mingw32* | \
+    *-mingw32* | \
     powerpc-*-eabisim* | \
     powerpc-*-eabi*    | \
     powerpc-*-rtems*   | \
diff --git a/gcc/config.gcc b/gcc/config.gcc
index a1480b72c46..2756377e50b 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1264,6 +1264,19 @@ aarch64*-*-linux*)
 	done
 	TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
 	;;
+aarch64-*-mingw*)
+	tmake_file="${tmake_file} aarch64/t-aarch64"
+	case ${enable_threads} in
+	  "" | yes | win32)
+	    thread_file='win32'
+	    ;;
+	  posix)
+	    thread_file='posix'
+	    ;;
+	esac
+	default_use_cxa_atexit=yes
+	user_headers_inc_next_post="${user_headers_inc_next_post} float.h"
+	;;
 aarch64*-wrs-vxworks*)
         tm_file="${tm_file} elfos.h aarch64/aarch64-elf.h"
         tm_file="${tm_file} vx-common.h vxworks.h aarch64/aarch64-vxworks.h"
-- 
2.25.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 02/13] aarch64: The aarch64-w64-mingw32 target implements
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
  2024-03-04 17:30 ` [PATCH v2 01/13] Introduce " Evgeny Karpov
@ 2024-03-04 17:33 ` Evgeny Karpov
  2024-04-10 18:17   ` Richard Sandiford
  2024-03-04 17:36 ` [PATCH v2 03/13] aarch64: Mark x18 register as a fixed register for MS ABI Evgeny Karpov
                   ` (15 subsequent siblings)
  17 siblings, 1 reply; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 17:33 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

From: Zac Walker <zacwalker@microsoft.com>
Date: Fri, 1 Mar 2024 01:45:13 +0100
Subject: [PATCH v2 02/13] aarch64: The aarch64-w64-mingw32 target implements
 the MS ABI

Two ABIs for aarch64 have been defined for different platforms.

gcc/ChangeLog:

	* config/aarch64/aarch64-opts.h (enum aarch64_calling_abi):
	Define two ABIs.
---
 gcc/config/aarch64/aarch64-opts.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/config/aarch64/aarch64-opts.h b/gcc/config/aarch64/aarch64-opts.h
index a05c0d3ded1..52c9e4596d6 100644
--- a/gcc/config/aarch64/aarch64-opts.h
+++ b/gcc/config/aarch64/aarch64-opts.h
@@ -131,4 +131,11 @@ enum aarch64_early_ra_scope {
   AARCH64_EARLY_RA_NONE
 };
 
+/* Available call ABIs.  */
+enum aarch64_calling_abi
+{
+  AARCH64_CALLING_ABI_EABI,
+  AARCH64_CALLING_ABI_MS
+};
+
 #endif
-- 
2.25.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 03/13] aarch64: Mark x18 register as a fixed register for MS ABI
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
  2024-03-04 17:30 ` [PATCH v2 01/13] Introduce " Evgeny Karpov
  2024-03-04 17:33 ` [PATCH v2 02/13] aarch64: The aarch64-w64-mingw32 target implements Evgeny Karpov
@ 2024-03-04 17:36 ` Evgeny Karpov
  2024-04-10 18:25   ` Richard Sandiford
  2024-03-04 17:39 ` [PATCH v2 04/13] aarch64: Add aarch64-w64-mingw32 COFF Evgeny Karpov
                   ` (14 subsequent siblings)
  17 siblings, 1 reply; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 17:36 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

From: Zac Walker <zacwalker@microsoft.com>
Date: Fri, 1 Mar 2024 09:56:59 +0100
Subject: [PATCH v2 03/13] aarch64: Mark x18 register as a fixed register for
 MS ABI

Define the MS ABI for aarch64-w64-mingw32.
Adjust FIXED_REGISTERS, CALL_REALLY_USED_REGISTERS and
STATIC_CHAIN_REGNUM for AArch64 MS ABI.
The X18 register is reserved on Windows for the TEB.

gcc/ChangeLog:

	* config.gcc: Define TARGET_AARCH64_MS_ABI when
	AArch64 MS ABI is used.
	* config/aarch64/aarch64-abi-ms.h: New file. Adjust
	FIXED_REGISTERS, CALL_REALLY_USED_REGISTERS and
	STATIC_CHAIN_REGNUM for AArch64 MS ABI.
---
 gcc/config.gcc                      |  1 +
 gcc/config/aarch64/aarch64-abi-ms.h | 64 +++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)
 create mode 100644 gcc/config/aarch64/aarch64-abi-ms.h

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 2756377e50b..b762393b64c 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1265,6 +1265,7 @@ aarch64*-*-linux*)
 	TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
 	;;
 aarch64-*-mingw*)
+	tm_file="${tm_file} aarch64/aarch64-abi-ms.h"
 	tmake_file="${tmake_file} aarch64/t-aarch64"
 	case ${enable_threads} in
 	  "" | yes | win32)
diff --git a/gcc/config/aarch64/aarch64-abi-ms.h b/gcc/config/aarch64/aarch64-abi-ms.h
new file mode 100644
index 00000000000..90b0dcc5edf
--- /dev/null
+++ b/gcc/config/aarch64/aarch64-abi-ms.h
@@ -0,0 +1,64 @@
+/* Machine description for AArch64 MS ABI.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#ifndef GCC_AARCH64_ABI_MS_H
+#define GCC_AARCH64_ABI_MS_H
+
+/* X18 reserved for the TEB on Windows.  */
+
+#undef FIXED_REGISTERS
+#define FIXED_REGISTERS					\
+  {							\
+    0, 0, 0, 0,   0, 0, 0, 0,	/* R0 - R7.  */		\
+    0, 0, 0, 0,   0, 0, 0, 0,	/* R8 - R15.  */	\
+    0, 0, 1, 0,   0, 0, 0, 0,	/* R16 - R23.  */	\
+    0, 0, 0, 0,   0, 1, 0, 1,	/* R24 - R30, SP.  */	\
+    0, 0, 0, 0,   0, 0, 0, 0,	/* V0 - V7.  */		\
+    0, 0, 0, 0,   0, 0, 0, 0,   /* V8 - V15.  */	\
+    0, 0, 0, 0,   0, 0, 0, 0,   /* V16 - V23.  */	\
+    0, 0, 0, 0,   0, 0, 0, 0,   /* V24 - V31.  */	\
+    1, 1, 1, 1,			/* SFP, AP, CC, VG.  */	\
+    0, 0, 0, 0,   0, 0, 0, 0,	/* P0 - P7.  */		\
+    0, 0, 0, 0,   0, 0, 0, 0,   /* P8 - P15.  */	\
+    1, 1,			/* FFR and FFRT.  */	\
+    1, 1, 1, 1, 1, 1, 1, 1	/* Fake registers.  */	\
+  }
+
+#undef CALL_REALLY_USED_REGISTERS
+#define CALL_REALLY_USED_REGISTERS			\
+  {							\
+    1, 1, 1, 1,   1, 1, 1, 1,	/* R0 - R7.  */		\
+    1, 1, 1, 1,   1, 1, 1, 1,	/* R8 - R15.  */	\
+    1, 1, 0, 0,   0, 0, 0, 0,   /* R16 - R23.  */	\
+    0, 0, 0, 0,   0, 1, 1, 1,	/* R24 - R30, SP.  */	\
+    1, 1, 1, 1,   1, 1, 1, 1,	/* V0 - V7.  */		\
+    0, 0, 0, 0,   0, 0, 0, 0,	/* V8 - V15.  */	\
+    1, 1, 1, 1,   1, 1, 1, 1,   /* V16 - V23.  */	\
+    1, 1, 1, 1,   1, 1, 1, 1,   /* V24 - V31.  */	\
+    1, 1, 1, 0,			/* SFP, AP, CC, VG.  */	\
+    1, 1, 1, 1,   1, 1, 1, 1,	/* P0 - P7.  */		\
+    1, 1, 1, 1,   1, 1, 1, 1,	/* P8 - P15.  */	\
+    1, 1,			/* FFR and FFRT.  */	\
+    0, 0, 0, 0, 0, 0, 0, 0	/* Fake registers.  */	\
+  }
+
+#undef  STATIC_CHAIN_REGNUM
+#define STATIC_CHAIN_REGNUM R17_REGNUM
+
+#endif /* GCC_AARCH64_ABI_MS_H.  */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 04/13] aarch64: Add aarch64-w64-mingw32 COFF
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (2 preceding siblings ...)
  2024-03-04 17:36 ` [PATCH v2 03/13] aarch64: Mark x18 register as a fixed register for MS ABI Evgeny Karpov
@ 2024-03-04 17:39 ` Evgeny Karpov
  2024-04-10 18:31   ` Richard Sandiford
  2024-03-04 17:39 ` [PATCH v2 05/13] Reuse MinGW from i386 for AArch64 Evgeny Karpov
                   ` (13 subsequent siblings)
  17 siblings, 1 reply; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 17:39 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

From: Zac Walker <zacwalker@microsoft.com>
Date: Fri, 1 Mar 2024 01:55:47 +0100
Subject: [PATCH v2 04/13] aarch64: Add aarch64-w64-mingw32 COFF

Define ASM specific for COFF format on AArch64.

gcc/ChangeLog:

	* config.gcc: Add COFF format support definitions.
	* config/aarch64/aarch64-coff.h: New file.
---
 gcc/config.gcc                    |  1 +
 gcc/config/aarch64/aarch64-coff.h | 91 +++++++++++++++++++++++++++++++
 2 files changed, 92 insertions(+)
 create mode 100644 gcc/config/aarch64/aarch64-coff.h

diff --git a/gcc/config.gcc b/gcc/config.gcc
index b762393b64c..cb6661f44ef 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1266,6 +1266,7 @@ aarch64*-*-linux*)
 	;;
 aarch64-*-mingw*)
 	tm_file="${tm_file} aarch64/aarch64-abi-ms.h"
+	tm_file="${tm_file} aarch64/aarch64-coff.h"
 	tmake_file="${tmake_file} aarch64/t-aarch64"
 	case ${enable_threads} in
 	  "" | yes | win32)
diff --git a/gcc/config/aarch64/aarch64-coff.h b/gcc/config/aarch64/aarch64-coff.h
new file mode 100644
index 00000000000..79c5a43b970
--- /dev/null
+++ b/gcc/config/aarch64/aarch64-coff.h
@@ -0,0 +1,91 @@
+/* Machine description for AArch64 architecture.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   GCC is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC; see the file COPYING3.  If not see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef GCC_AARCH64_COFF_H
+#define GCC_AARCH64_COFF_H
+
+#include "aarch64.h"
+
+#ifndef LOCAL_LABEL_PREFIX
+# define LOCAL_LABEL_PREFIX 	""
+#endif
+
+/* Using long long breaks -ansi and -std=c90, so these will need to be
+   made conditional for an LLP64 ABI.  */
+#undef SIZE_TYPE
+#define SIZE_TYPE	"long long unsigned int"
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE	"long long int"
+
+#undef LONG_TYPE_SIZE
+#define LONG_TYPE_SIZE 32
+
+#ifndef ASM_GENERATE_INTERNAL_LABEL
+# define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM)  \
+  sprintf (STRING, "*%s%s%u", LOCAL_LABEL_PREFIX, PREFIX, (unsigned int)(NUM))
+#endif
+
+#define ASM_OUTPUT_ALIGN(STREAM, POWER)		\
+  fprintf (STREAM, "\t.align\t%d\n", (int)POWER)
+
+/* Output a common block.  */
+#ifndef ASM_OUTPUT_COMMON
+# define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED)	\
+    {							\
+      fprintf (STREAM, "\t.comm\t");			\
+      assemble_name (STREAM, NAME);			\
+      asm_fprintf (STREAM, ", %d, %d\n", 		\
+      (int)(ROUNDED), (int)(SIZE));	\
+    }
+#endif
+
+/* Output a local common block.  /bin/as can't do this, so hack a
+   `.space' into the bss segment.  Note that this is *bad* practice,
+   which is guaranteed NOT to work since it doesn't define STATIC
+   COMMON space but merely STATIC BSS space.  */
+#ifndef ASM_OUTPUT_ALIGNED_LOCAL
+# define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN)		\
+    {									\
+      switch_to_section (bss_section);					\
+      ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT));	\
+      ASM_OUTPUT_LABEL (STREAM, NAME);					\
+      fprintf (STREAM, "\t.space\t%d\n", (int)(SIZE));			\
+    }
+#endif
+
+#define ASM_OUTPUT_SKIP(STREAM, NBYTES) 	\
+  fprintf (STREAM, "\t.space\t%d  // skip\n", (int) (NBYTES))
+
+#define ASM_OUTPUT_TYPE_DIRECTIVE(STREAM, NAME, TYPE)
+#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)
+
+#define TEXT_SECTION_ASM_OP	"\t.text"
+#define DATA_SECTION_ASM_OP	"\t.data"
+#define BSS_SECTION_ASM_OP	"\t.bss"
+
+#define CTORS_SECTION_ASM_OP	"\t.section\t.ctors, \"aw\""
+#define DTORS_SECTION_ASM_OP	"\t.section\t.dtors, \"aw\""
+
+#define GLOBAL_ASM_OP "\t.global\t"
+
+#undef SUPPORTS_INIT_PRIORITY
+#define SUPPORTS_INIT_PRIORITY 0
+
+#endif
-- 
2.25.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 05/13] Reuse MinGW from i386 for AArch64
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (3 preceding siblings ...)
  2024-03-04 17:39 ` [PATCH v2 04/13] aarch64: Add aarch64-w64-mingw32 COFF Evgeny Karpov
@ 2024-03-04 17:39 ` Evgeny Karpov
  2024-03-04 17:41 ` [PATCH v2 06/13] Rename section and encoding functions from i386 which will be used in aarch64 Evgeny Karpov
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 17:39 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

From: Zac Walker <zacwalker@microsoft.com>
Date: Fri, 1 Mar 2024 02:41:50 +0100
Subject: [PATCH v2 05/13] Reuse MinGW from i386 for AArch64

This patch creates a new config/mingw directory to share MinGW
related definitions, and moves there the corresponding existing files
from config/i386.

gcc/ChangeLog:

	* config.gcc: Adjust targets after moving MinGW related files
	from i386 to mingw folder.
	* config/i386/cygming.opt: Move to...
	* config/mingw/cygming.opt: ...here.
	* config/i386/cygming.opt.urls: Move to...
	* config/mingw/cygming.opt.urls: ...here.
	* config/i386/cygwin-d.cc: Move to...
	* config/mingw/cygwin-d.cc: ...here.
	* config/i386/mingw-stdint.h: Move to...
	* config/mingw/mingw-stdint.h: ...here.
	* config/i386/mingw.opt: Move to...
	* config/mingw/mingw.opt: ...here.
	* config/i386/mingw.opt.urls: Move to...
	* config/mingw/mingw.opt.urls: ...here.
	* config/i386/mingw32.h: Move to...
	* config/mingw/mingw32.h: ...here.
	* config/i386/msformat-c.cc: Move to...
	* config/mingw/msformat-c.cc: ...here.
	* config/i386/t-cygming: Move to...
	* config/mingw/t-cygming: ...here and updated.
	* config/i386/winnt-cxx.cc: Move to...
	* config/mingw/winnt-cxx.cc: ...here.
	* config/i386/winnt-d.cc: Move to...
	* config/mingw/winnt-d.cc: ...here.
	* config/i386/winnt-stubs.cc: Move to...
	* config/mingw/winnt-stubs.cc: ...here.
	* config/i386/winnt.cc: Move to...
	* config/mingw/winnt.cc: ...here.
---
 gcc/config.gcc                              | 22 ++++++++++----------
 gcc/config/{i386 => mingw}/cygming.opt      |  0
 gcc/config/{i386 => mingw}/cygming.opt.urls |  0
 gcc/config/{i386 => mingw}/cygwin-d.cc      |  0
 gcc/config/{i386 => mingw}/mingw-stdint.h   |  0
 gcc/config/{i386 => mingw}/mingw.opt        |  0
 gcc/config/{i386 => mingw}/mingw.opt.urls   |  0
 gcc/config/{i386 => mingw}/mingw32.h        |  0
 gcc/config/{i386 => mingw}/msformat-c.cc    |  0
 gcc/config/{i386 => mingw}/t-cygming        | 23 ++++++++++++---------
 gcc/config/{i386 => mingw}/winnt-cxx.cc     |  0
 gcc/config/{i386 => mingw}/winnt-d.cc       |  0
 gcc/config/{i386 => mingw}/winnt-stubs.cc   |  0
 gcc/config/{i386 => mingw}/winnt.cc         |  0
 14 files changed, 24 insertions(+), 21 deletions(-)
 rename gcc/config/{i386 => mingw}/cygming.opt (100%)
 rename gcc/config/{i386 => mingw}/cygming.opt.urls (100%)
 rename gcc/config/{i386 => mingw}/cygwin-d.cc (100%)
 rename gcc/config/{i386 => mingw}/mingw-stdint.h (100%)
 rename gcc/config/{i386 => mingw}/mingw.opt (100%)
 rename gcc/config/{i386 => mingw}/mingw.opt.urls (100%)
 rename gcc/config/{i386 => mingw}/mingw32.h (100%)
 rename gcc/config/{i386 => mingw}/msformat-c.cc (100%)
 rename gcc/config/{i386 => mingw}/t-cygming (73%)
 rename gcc/config/{i386 => mingw}/winnt-cxx.cc (100%)
 rename gcc/config/{i386 => mingw}/winnt-d.cc (100%)
 rename gcc/config/{i386 => mingw}/winnt-stubs.cc (100%)
 rename gcc/config/{i386 => mingw}/winnt.cc (100%)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index cb6661f44ef..26564ead079 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2161,9 +2161,9 @@ i[4567]86-wrs-vxworks*|x86_64-wrs-vxworks7*)
 i[34567]86-*-cygwin*)
 	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/cygming.h i386/cygwin.h i386/cygwin-stdint.h"
 	xm_file=i386/xm-cygwin.h
-	tmake_file="${tmake_file} i386/t-cygming t-slibgcc"
-	target_gtfiles="$target_gtfiles \$(srcdir)/config/i386/winnt.cc"
-	extra_options="${extra_options} i386/cygming.opt i386/cygwin.opt"
+	tmake_file="${tmake_file} mingw/t-cygming t-slibgcc"
+	target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
+	extra_options="${extra_options} mingw/cygming.opt i386/cygwin.opt"
 	extra_objs="${extra_objs} winnt.o winnt-stubs.o"
 	c_target_objs="${c_target_objs} msformat-c.o"
 	cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
@@ -2179,9 +2179,9 @@ x86_64-*-cygwin*)
 	need_64bit_isa=yes
 	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/cygming.h i386/cygwin.h i386/cygwin-w64.h i386/cygwin-stdint.h"
 	xm_file=i386/xm-cygwin.h
-	tmake_file="${tmake_file} i386/t-cygming t-slibgcc"
-	target_gtfiles="$target_gtfiles \$(srcdir)/config/i386/winnt.cc"
-	extra_options="${extra_options} i386/cygming.opt i386/cygwin.opt"
+	tmake_file="${tmake_file} mingw/t-cygming t-slibgcc"
+	target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
+	extra_options="${extra_options} mingw/cygming.opt i386/cygwin.opt"
 	extra_objs="${extra_objs} winnt.o winnt-stubs.o"
 	c_target_objs="${c_target_objs} msformat-c.o"
 	cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
@@ -2217,7 +2217,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
 	if test x$enable_threads = xmcf ; then
 		tm_file="${tm_file} i386/mingw-mcfgthread.h"
 	fi
-	tm_file="${tm_file} i386/mingw32.h"
+	tm_file="${tm_file} mingw/mingw32.h"
 	# This makes the logic if mingw's or the w64 feature set has to be used
 	case ${target} in
 		*-w64-*)
@@ -2246,8 +2246,8 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
 		*)
 			;;
 	esac
-	tm_file="${tm_file} i386/mingw-stdint.h"
-	tmake_file="${tmake_file} t-winnt i386/t-cygming t-slibgcc"
+	tm_file="${tm_file} mingw/mingw-stdint.h"
+	tmake_file="${tmake_file} t-winnt mingw/t-cygming t-slibgcc"
         case ${target} in
                x86_64-w64-*)
                		tmake_file="${tmake_file} i386/t-mingw-w64"
@@ -2257,8 +2257,8 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
 			;;
 	esac
         native_system_header_dir=/mingw/include
-	target_gtfiles="$target_gtfiles \$(srcdir)/config/i386/winnt.cc"
-	extra_options="${extra_options} i386/cygming.opt i386/mingw.opt"
+	target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
+	extra_options="${extra_options} mingw/cygming.opt mingw/mingw.opt"
 	case ${target} in
 		*-w64-*)
 			extra_options="${extra_options} i386/mingw-w64.opt"
diff --git a/gcc/config/i386/cygming.opt b/gcc/config/mingw/cygming.opt
similarity index 100%
rename from gcc/config/i386/cygming.opt
rename to gcc/config/mingw/cygming.opt
diff --git a/gcc/config/i386/cygming.opt.urls b/gcc/config/mingw/cygming.opt.urls
similarity index 100%
rename from gcc/config/i386/cygming.opt.urls
rename to gcc/config/mingw/cygming.opt.urls
diff --git a/gcc/config/i386/cygwin-d.cc b/gcc/config/mingw/cygwin-d.cc
similarity index 100%
rename from gcc/config/i386/cygwin-d.cc
rename to gcc/config/mingw/cygwin-d.cc
diff --git a/gcc/config/i386/mingw-stdint.h b/gcc/config/mingw/mingw-stdint.h
similarity index 100%
rename from gcc/config/i386/mingw-stdint.h
rename to gcc/config/mingw/mingw-stdint.h
diff --git a/gcc/config/i386/mingw.opt b/gcc/config/mingw/mingw.opt
similarity index 100%
rename from gcc/config/i386/mingw.opt
rename to gcc/config/mingw/mingw.opt
diff --git a/gcc/config/i386/mingw.opt.urls b/gcc/config/mingw/mingw.opt.urls
similarity index 100%
rename from gcc/config/i386/mingw.opt.urls
rename to gcc/config/mingw/mingw.opt.urls
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/mingw/mingw32.h
similarity index 100%
rename from gcc/config/i386/mingw32.h
rename to gcc/config/mingw/mingw32.h
diff --git a/gcc/config/i386/msformat-c.cc b/gcc/config/mingw/msformat-c.cc
similarity index 100%
rename from gcc/config/i386/msformat-c.cc
rename to gcc/config/mingw/msformat-c.cc
diff --git a/gcc/config/i386/t-cygming b/gcc/config/mingw/t-cygming
similarity index 73%
rename from gcc/config/i386/t-cygming
rename to gcc/config/mingw/t-cygming
index af01f69acd1..f5de941c8e5 100644
--- a/gcc/config/i386/t-cygming
+++ b/gcc/config/mingw/t-cygming
@@ -20,37 +20,40 @@
 # doing the build, it may not be installed yet.
 LIMITS_H_TEST = true
 
-winnt.o: $(srcdir)/config/i386/winnt.cc $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+winnt.o: $(srcdir)/config/mingw/winnt.cc $(CONFIG_H) $(SYSTEM_H) coretypes.h \
   $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h output.h $(TREE_H) flags.h \
   $(TM_P_H) $(HASH_TABLE_H) $(GGC_H) $(LTO_STREAMER_H)
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-	$(srcdir)/config/i386/winnt.cc
+	$(srcdir)/config/mingw/winnt.cc
 
-winnt-cxx.o: $(srcdir)/config/i386/winnt-cxx.cc $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+winnt-cxx.o: $(srcdir)/config/mingw/winnt-cxx.cc $(CONFIG_H) $(SYSTEM_H) \
+  coretypes.h \
   $(TM_H) $(TREE_H) flags.h \
   $(TM_P_H) $(HASHTAB_H) $(GGC_H)
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-	$(srcdir)/config/i386/winnt-cxx.cc
+	$(srcdir)/config/mingw/winnt-cxx.cc
 
 
-winnt-stubs.o: $(srcdir)/config/i386/winnt-stubs.cc $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+winnt-stubs.o: $(srcdir)/config/mingw/winnt-stubs.cc $(CONFIG_H) $(SYSTEM_H) \
+  coretypes.h \
   $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h output.h $(TREE_H) flags.h \
   $(TM_P_H) $(HASHTAB_H) $(GGC_H)
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-	$(srcdir)/config/i386/winnt-stubs.cc
+	$(srcdir)/config/mingw/winnt-stubs.cc
 
-cygwin-d.o: $(srcdir)/config/i386/cygwin-d.cc
+cygwin-d.o: $(srcdir)/config/mingw/cygwin-d.cc
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-winnt-d.o: $(srcdir)/config/i386/winnt-d.cc
+winnt-d.o: $(srcdir)/config/mingw/winnt-d.cc
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-msformat-c.o: $(srcdir)/config/i386/msformat-c.cc $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+msformat-c.o: $(srcdir)/config/mingw/msformat-c.cc $(CONFIG_H) $(SYSTEM_H) \
+  coretypes.h \
   $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h output.h $(TREE_H) flags.h \
   $(TM_P_H) $(HASHTAB_H) $(GGC_H)
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-	$(srcdir)/config/i386/msformat-c.cc
+	$(srcdir)/config/mingw/msformat-c.cc
 
 STMP_FIXINC=stmp-fixinc
diff --git a/gcc/config/i386/winnt-cxx.cc b/gcc/config/mingw/winnt-cxx.cc
similarity index 100%
rename from gcc/config/i386/winnt-cxx.cc
rename to gcc/config/mingw/winnt-cxx.cc
diff --git a/gcc/config/i386/winnt-d.cc b/gcc/config/mingw/winnt-d.cc
similarity index 100%
rename from gcc/config/i386/winnt-d.cc
rename to gcc/config/mingw/winnt-d.cc
diff --git a/gcc/config/i386/winnt-stubs.cc b/gcc/config/mingw/winnt-stubs.cc
similarity index 100%
rename from gcc/config/i386/winnt-stubs.cc
rename to gcc/config/mingw/winnt-stubs.cc
diff --git a/gcc/config/i386/winnt.cc b/gcc/config/mingw/winnt.cc
similarity index 100%
rename from gcc/config/i386/winnt.cc
rename to gcc/config/mingw/winnt.cc
-- 
2.25.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 06/13] Rename section and encoding functions from i386 which will be used in aarch64
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (4 preceding siblings ...)
  2024-03-04 17:39 ` [PATCH v2 05/13] Reuse MinGW from i386 for AArch64 Evgeny Karpov
@ 2024-03-04 17:41 ` Evgeny Karpov
  2024-03-04 17:43 ` [PATCH v2 07/13] Exclude i386 functionality from aarch64 build Evgeny Karpov
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 17:41 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

From: Zac Walker <zacwalker@microsoft.com>
Date: Tue, 20 Feb 2024 17:22:31 +0100
Subject: [PATCH v2 06/13] Rename section and encoding functions from i386
 which will be used in aarch64

gcc/ChangeLog:

	* config/i386/cygming.h (SUBTARGET_ENCODE_SECTION_INFO):
	Rename functions in mingw folder which will be reused for
	aarch64.
	(TARGET_ASM_UNIQUE_SECTION): Likewise.
	(TARGET_ASM_NAMED_SECTION): Likewise.
	(TARGET_SECTION_TYPE_FLAGS): Likewise.
	(ASM_DECLARE_COLD_FUNCTION_NAME): Likewise.
	(ASM_OUTPUT_EXTERNAL_LIBCALL): Likewise.
	* config/i386/i386-protos.h (i386_pe_unique_section):
	Rename into ...
	(mingw_pe_unique_section): ... this.
	(i386_pe_declare_function_type): Rename into ...
	(mingw_pe_declare_function_type): ... this.
	(i386_pe_encode_section_info): Rename into ...
	(mingw_pe_encode_section_info): ... this.
	(i386_pe_maybe_record_exported_symbol): Rename into ...
	(mingw_pe_maybe_record_exported_symbol): ... this.
	(i386_pe_section_type_flags): Rename into ...
	(mingw_pe_section_type_flags): ... this.
	(i386_pe_asm_named_section): Rename into ...
	(mingw_pe_asm_named_section): ... this.
	* config/mingw/winnt.cc (i386_pe_encode_section_info):
	Rename into ...
	(mingw_pe_encode_section_info): ... this.
	(i386_pe_unique_section): Rename into ...
	(mingw_pe_unique_section): ... this.
	(i386_pe_section_type_flags): Rename into ...
	(mingw_pe_section_type_flags): ... this.
	(i386_pe_asm_named_section): Rename into ...
	(mingw_pe_asm_named_section): ... this.
	(i386_pe_asm_output_aligned_decl_common): Likewise.
	(i386_pe_declare_function_type): Rename into ...
	(mingw_pe_declare_function_type): ... this.
	(i386_pe_maybe_record_exported_symbol): Rename into ...
	(mingw_pe_maybe_record_exported_symbol): ... this.
	(i386_pe_start_function): Likewise.
	* varasm.cc (switch_to_comdat_section): Likewise.
---
 gcc/config/i386/cygming.h     | 18 +++++++++---------
 gcc/config/i386/i386-protos.h | 12 ++++++------
 gcc/config/mingw/winnt.cc     | 22 +++++++++++-----------
 gcc/varasm.cc                 |  2 +-
 4 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 1af5bc380a5..beedf7c398a 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -219,7 +219,7 @@ do {									\
    section and we need to set DECL_SECTION_NAME so we do that here.
    Note that we can be called twice on the same decl.  */
 
-#define SUBTARGET_ENCODE_SECTION_INFO  i386_pe_encode_section_info
+#define SUBTARGET_ENCODE_SECTION_INFO  mingw_pe_encode_section_info
 
 /* Local and global relocs can be placed always into readonly memory
    for PE-COFF targets.  */
@@ -235,7 +235,7 @@ do {									\
 #undef ASM_DECLARE_OBJECT_NAME
 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)	\
 do {							\
-  i386_pe_maybe_record_exported_symbol (DECL, NAME, 1);	\
+  mingw_pe_maybe_record_exported_symbol (DECL, NAME, 1);	\
   ASM_OUTPUT_LABEL ((STREAM), (NAME));			\
 } while (0)
 
@@ -283,16 +283,16 @@ do {						\
 /* Windows uses explicit import from shared libraries.  */
 #define MULTIPLE_SYMBOL_SPACES 1
 
-#define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
+#define TARGET_ASM_UNIQUE_SECTION mingw_pe_unique_section
 #define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
 
 #define SUPPORTS_ONE_ONLY 1
 
 /* Switch into a generic section.  */
-#define TARGET_ASM_NAMED_SECTION  i386_pe_asm_named_section
+#define TARGET_ASM_NAMED_SECTION  mingw_pe_asm_named_section
 
 /* Select attributes for named sections.  */
-#define TARGET_SECTION_TYPE_FLAGS  i386_pe_section_type_flags
+#define TARGET_SECTION_TYPE_FLAGS  mingw_pe_section_type_flags
 
 /* Write the extra assembler code needed to declare a function
    properly.  */
@@ -307,7 +307,7 @@ do {						\
 #define ASM_DECLARE_COLD_FUNCTION_NAME(FILE, NAME, DECL)	\
   do								\
     {								\
-      i386_pe_declare_function_type (FILE, NAME, 0);		\
+      mingw_pe_declare_function_type (FILE, NAME, 0);		\
       i386_pe_seh_cold_init (FILE, NAME);			\
       ASM_OUTPUT_LABEL (FILE, NAME);				\
     }								\
@@ -333,7 +333,7 @@ do {						\
 
 /* Declare the type properly for any external libcall.  */
 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
-  i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
+  mingw_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
 
 /* This says out to put a global symbol in the BSS section.  */
 #undef ASM_OUTPUT_ALIGNED_BSS
@@ -416,9 +416,9 @@ do {						\
     {									\
       const char *alias							\
 	= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));		\
-      i386_pe_maybe_record_exported_symbol (DECL, alias, 0);		\
+      mingw_pe_maybe_record_exported_symbol (DECL, alias, 0);		\
       if (TREE_CODE (DECL) == FUNCTION_DECL)				\
-	i386_pe_declare_function_type (STREAM, alias,			\
+	mingw_pe_declare_function_type (STREAM, alias,			\
 				       TREE_PUBLIC (DECL));		\
       ASM_OUTPUT_DEF (STREAM, alias, IDENTIFIER_POINTER (TARGET));	\
     } while (0)
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 46214a63974..dbc861fb1ea 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -295,16 +295,16 @@ extern void ix86_target_macros (void);
 extern void ix86_register_pragmas (void);
 
 /* In winnt.cc  */
-extern void i386_pe_unique_section (tree, int);
-extern void i386_pe_declare_function_type (FILE *, const char *, int);
+extern void mingw_pe_unique_section (tree, int);
+extern void mingw_pe_declare_function_type (FILE *, const char *, int);
 extern void i386_pe_record_external_function (tree, const char *);
-extern void i386_pe_maybe_record_exported_symbol (tree, const char *, int);
-extern void i386_pe_encode_section_info (tree, rtx, int);
+extern void mingw_pe_maybe_record_exported_symbol (tree, const char *, int);
+extern void mingw_pe_encode_section_info (tree, rtx, int);
 extern bool i386_pe_binds_local_p (const_tree);
 extern const char *i386_pe_strip_name_encoding_full (const char *);
 extern bool i386_pe_valid_dllimport_attribute_p (const_tree);
-extern unsigned int i386_pe_section_type_flags (tree, const char *, int);
-extern void i386_pe_asm_named_section (const char *, unsigned int, tree);
+extern unsigned int mingw_pe_section_type_flags (tree, const char *, int);
+extern void mingw_pe_asm_named_section (const char *, unsigned int, tree);
 extern void i386_pe_asm_output_aligned_decl_common (FILE *, tree,
 						    const char *,
 						    HOST_WIDE_INT,
diff --git a/gcc/config/mingw/winnt.cc b/gcc/config/mingw/winnt.cc
index 9b315898fca..1ed383155d0 100644
--- a/gcc/config/mingw/winnt.cc
+++ b/gcc/config/mingw/winnt.cc
@@ -293,7 +293,7 @@ i386_pe_mangle_assembler_name (const char *name)
 }
 
 void
-i386_pe_encode_section_info (tree decl, rtx rtl, int first)
+mingw_pe_encode_section_info (tree decl, rtx rtl, int first)
 {
   rtx symbol;
   int flags;
@@ -384,7 +384,7 @@ i386_pe_strip_name_encoding_full (const char *str)
 }
 
 void
-i386_pe_unique_section (tree decl, int reloc)
+mingw_pe_unique_section (tree decl, int reloc)
 {
   int len;
   const char *name, *prefix;
@@ -442,7 +442,7 @@ i386_pe_reloc_rw_mask (void)
 #define SECTION_PE_SHARED	SECTION_MACH_DEP
 
 unsigned int
-i386_pe_section_type_flags (tree decl, const char *, int reloc)
+mingw_pe_section_type_flags (tree decl, const char *, int reloc)
 {
   unsigned int flags;
 
@@ -471,7 +471,7 @@ i386_pe_section_type_flags (tree decl, const char *, int reloc)
 }
 
 void
-i386_pe_asm_named_section (const char *name, unsigned int flags, 
+mingw_pe_asm_named_section (const char *name, unsigned int flags,
 			   tree decl)
 {
   char flagchars[8], *f = flagchars;
@@ -548,7 +548,7 @@ i386_pe_asm_output_aligned_decl_common (FILE *stream, tree decl,
   rounded = (rounded / (BIGGEST_ALIGNMENT / BITS_PER_UNIT)
 	     * (BIGGEST_ALIGNMENT / BITS_PER_UNIT));
   
-  i386_pe_maybe_record_exported_symbol (decl, name, 1);
+  mingw_pe_maybe_record_exported_symbol (decl, name, 1);
 
   fprintf (stream, "\t.comm\t");
   assemble_name (stream, name);
@@ -574,7 +574,7 @@ i386_pe_asm_output_aligned_decl_common (FILE *stream, tree decl,
    visible.  */
 
 void
-i386_pe_declare_function_type (FILE *file, const char *name, int pub)
+mingw_pe_declare_function_type (FILE *file, const char *name, int pub)
 {
   fprintf (file, "\t.def\t");
   assemble_name (file, name);
@@ -641,7 +641,7 @@ static GTY(()) struct stub_list *stub_head;
    the LTO marker.  */
 
 void
-i386_pe_maybe_record_exported_symbol (tree decl, const char *name, int is_data)
+mingw_pe_maybe_record_exported_symbol (tree decl, const char *name, int is_data)
 {
   rtx symbol;
   struct export_list *p;
@@ -761,11 +761,11 @@ i386_pe_file_end (void)
 	     the real function so that an (unused) import is created.  */
 	  const char *realsym = i386_find_on_wrapper_list (p->name);
 	  if (realsym)
-	    i386_pe_declare_function_type (asm_out_file,
+	    mingw_pe_declare_function_type (asm_out_file,
 		concat ("__real_", realsym, NULL), TREE_PUBLIC (decl));
 #endif /* CXX_WRAP_SPEC_LIST */
 	  TREE_ASM_WRITTEN (decl) = 1;
-	  i386_pe_declare_function_type (asm_out_file, p->name,
+	  mingw_pe_declare_function_type (asm_out_file, p->name,
 					 TREE_PUBLIC (decl));
 	}
     }
@@ -1354,8 +1354,8 @@ i386_pe_seh_init_sections (void)
 void
 i386_pe_start_function (FILE *f, const char *name, tree decl)
 {
-  i386_pe_maybe_record_exported_symbol (decl, name, 0);
-  i386_pe_declare_function_type (f, name, TREE_PUBLIC (decl));
+  mingw_pe_maybe_record_exported_symbol (decl, name, 0);
+  mingw_pe_declare_function_type (f, name, TREE_PUBLIC (decl));
   /* In case section was altered by debugging output.  */
   if (decl != NULL_TREE)
     switch_to_section (function_section (decl));
diff --git a/gcc/varasm.cc b/gcc/varasm.cc
index 747f74ba1c0..2ab9e096853 100644
--- a/gcc/varasm.cc
+++ b/gcc/varasm.cc
@@ -8672,7 +8672,7 @@ switch_to_comdat_section (section *sect, tree decl)
      everything in .vtable_map_vars at the end.
 
      A fix could be made in
-     gcc/config/i386/winnt.cc: i386_pe_unique_section.  */
+     gcc/config/i386/winnt.cc: mingw_pe_unique_section.  */
   if (TARGET_PECOFF)
     {
       char *name;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 07/13] Exclude i386 functionality from aarch64 build
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (5 preceding siblings ...)
  2024-03-04 17:41 ` [PATCH v2 06/13] Rename section and encoding functions from i386 which will be used in aarch64 Evgeny Karpov
@ 2024-03-04 17:43 ` Evgeny Karpov
  2024-03-04 17:44 ` [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64 Evgeny Karpov
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 17:43 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

From: Zac Walker <zacwalker@microsoft.com>
Date: Fri, 1 Mar 2024 02:35:40 +0100
Subject: [PATCH v2 07/13] Exclude i386 functionality from aarch64 build

This patch defines TARGET_AARCH64_MS_ABI in config.gcc and uses it to
exclude i386 functionality from aarch64 build and adjust MinGW headers
for AArch64 MS ABI.

gcc/ChangeLog:

	* config.gcc: Define TARGET_AARCH64_MS_ABI.
	* config/mingw/mingw-stdint.h (INTPTR_TYPE): Use
	TARGET_AARCH64_MS_ABI to adjust MinGW headers for
	AArch64 MS ABI.
	(UINTPTR_TYPE): Likewise.
	(defined): Likewise.
	* config/mingw/mingw32.h (DEFAULT_ABI): Likewise.
	(defined): Likewise.
	* config/mingw/winnt.cc (defined): Use TARGET_ARM64_MS_ABI to
	exclude ix86_get_callcvt.
	(i386_pe_maybe_mangle_decl_assembler_name): Likewise.
	(i386_pe_mangle_decl_assembler_name): Likewise.
---
 gcc/config.gcc                  | 1 +
 gcc/config/mingw/mingw-stdint.h | 9 +++++++--
 gcc/config/mingw/mingw32.h      | 6 +++++-
 gcc/config/mingw/winnt.cc       | 8 ++++++++
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 26564ead079..3aca257c322 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1278,6 +1278,7 @@ aarch64-*-mingw*)
 	esac
 	default_use_cxa_atexit=yes
 	user_headers_inc_next_post="${user_headers_inc_next_post} float.h"
+	tm_defines="${tm_defines} TARGET_AARCH64_MS_ABI=1"
 	;;
 aarch64*-wrs-vxworks*)
         tm_file="${tm_file} elfos.h aarch64/aarch64-elf.h"
diff --git a/gcc/config/mingw/mingw-stdint.h b/gcc/config/mingw/mingw-stdint.h
index c0feade76e9..debbe829bdf 100644
--- a/gcc/config/mingw/mingw-stdint.h
+++ b/gcc/config/mingw/mingw-stdint.h
@@ -46,5 +46,10 @@ along with GCC; see the file COPYING3.  If not see
 #define UINT_FAST32_TYPE "unsigned int"
 #define UINT_FAST64_TYPE "long long unsigned int"
 
-#define INTPTR_TYPE (TARGET_64BIT ? "long long int" : "int")
-#define UINTPTR_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int")
+#if defined (TARGET_AARCH64_MS_ABI)
+# define INTPTR_TYPE "long long int"
+# define UINTPTR_TYPE "long long unsigned int"
+#else
+# define INTPTR_TYPE (TARGET_64BIT ? "long long int" : "int")
+# define UINTPTR_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int")
+#endif
\ No newline at end of file
diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h
index 58304fc55f6..040c3e1e521 100644
--- a/gcc/config/mingw/mingw32.h
+++ b/gcc/config/mingw/mingw32.h
@@ -19,7 +19,11 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #undef DEFAULT_ABI
-#define DEFAULT_ABI MS_ABI
+#if defined (TARGET_AARCH64_MS_ABI)
+# define DEFAULT_ABI AARCH64_CALLING_ABI_MS
+#else
+# define DEFAULT_ABI MS_ABI
+#endif
 
 /* By default, target has a 80387, uses IEEE compatible arithmetic,
    returns float values in the 387 and needs stack probes.
diff --git a/gcc/config/mingw/winnt.cc b/gcc/config/mingw/winnt.cc
index 1ed383155d0..2a4fc03fc56 100644
--- a/gcc/config/mingw/winnt.cc
+++ b/gcc/config/mingw/winnt.cc
@@ -224,6 +224,8 @@ gen_stdcall_or_fastcall_suffix (tree decl, tree id, bool fastcall)
   return get_identifier (new_str);
 }
 
+#if !defined (TARGET_AARCH64_MS_ABI)
+
 /* Maybe decorate and get a new identifier for the DECL of a stdcall or
    fastcall function. The original identifier is supplied in ID. */
 
@@ -250,6 +252,8 @@ i386_pe_maybe_mangle_decl_assembler_name (tree decl, tree id)
   return new_id;
 }
 
+#endif
+
 /* Emit an assembler directive to set symbol for DECL visibility to
    the visibility type VIS, which must not be VISIBILITY_DEFAULT.
    As for PE there is no hidden support in gas, we just warn for
@@ -266,6 +270,8 @@ i386_pe_assemble_visibility (tree decl, int)
 			      "in this configuration; ignored");
 }
 
+#if !defined (TARGET_AARCH64_MS_ABI)
+
 /* This is used as a target hook to modify the DECL_ASSEMBLER_NAME
    in the language-independent default hook
    langhooks,c:lhd_set_decl_assembler_name ()
@@ -278,6 +284,8 @@ i386_pe_mangle_decl_assembler_name (tree decl, tree id)
   return (new_id ? new_id : id);
 }
 
+#endif
+
 /* This hook behaves the same as varasm.cc/assemble_name(), but
    generates the name into memory rather than outputting it to
    a file stream.  */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (6 preceding siblings ...)
  2024-03-04 17:43 ` [PATCH v2 07/13] Exclude i386 functionality from aarch64 build Evgeny Karpov
@ 2024-03-04 17:44 ` Evgeny Karpov
  2024-03-18 13:26   ` Christophe Lyon
                     ` (2 more replies)
  2024-03-04 17:45 ` [PATCH v2 09/13] aarch64: Add SEH to machine_function Evgeny Karpov
                   ` (9 subsequent siblings)
  17 siblings, 3 replies; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 17:44 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

From: Zac Walker <zacwalker@microsoft.com>
Date: Fri, 1 Mar 2024 10:49:28 +0100
Subject: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for
 AArch64

Define Cygwin and MinGW environment such as types, SEH definitions,
shared libraries, etc.

gcc/ChangeLog:

	* config.gcc: Add Cygwin and MinGW difinitions.
	* config/aarch64/aarch64-protos.h
	(mingw_pe_maybe_record_exported_symbol): Declare functions
	which are used in Cygwin and MinGW environment.
	(mingw_pe_section_type_flags): Likewise.
	(mingw_pe_unique_section): Likewise.
	(mingw_pe_encode_section_info): Likewise.
	* config/aarch64/cygming.h: New file.
---
 gcc/config.gcc                      |   4 +
 gcc/config/aarch64/aarch64-protos.h |   5 +
 gcc/config/aarch64/cygming.h        | 175 ++++++++++++++++++++++++++++
 3 files changed, 184 insertions(+)
 create mode 100644 gcc/config/aarch64/cygming.h

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 3aca257c322..4471599454b 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1267,7 +1267,11 @@ aarch64*-*-linux*)
 aarch64-*-mingw*)
 	tm_file="${tm_file} aarch64/aarch64-abi-ms.h"
 	tm_file="${tm_file} aarch64/aarch64-coff.h"
+	tm_file="${tm_file} aarch64/cygming.h"
+	tm_file="${tm_file} mingw/mingw32.h"
+	tm_file="${tm_file} mingw/mingw-stdint.h"
 	tmake_file="${tmake_file} aarch64/t-aarch64"
+	target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
 	case ${enable_threads} in
 	  "" | yes | win32)
 	    thread_file='win32'
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index bd719b992a5..759e1a0f9da 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -1110,6 +1110,11 @@ extern void aarch64_output_patchable_area (unsigned int, bool);
 
 extern void aarch64_adjust_reg_alloc_order ();
 
+extern void mingw_pe_maybe_record_exported_symbol (tree, const char *, int);
+extern unsigned int mingw_pe_section_type_flags (tree, const char *, int);
+extern void mingw_pe_unique_section (tree, int);
+extern void mingw_pe_encode_section_info (tree, rtx, int);
+
 bool aarch64_optimize_mode_switching (aarch64_mode_entity);
 void aarch64_restore_za (rtx);
 
diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h
new file mode 100644
index 00000000000..2f239c42a89
--- /dev/null
+++ b/gcc/config/aarch64/cygming.h
@@ -0,0 +1,175 @@
+/* Operating system specific defines to be used when targeting GCC for
+   hosting on Windows32, using a Unix style C library and tools.
+   Copyright (C) 1995-2024 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#ifndef GCC_AARCH64_CYGMING_H
+#define GCC_AARCH64_CYGMING_H
+
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DINFO_TYPE_NONE
+
+#define FASTCALL_PREFIX '@'
+
+#define print_reg(rtx, code, file)
+
+#define SYMBOL_FLAG_DLLIMPORT 0
+#define SYMBOL_FLAG_DLLEXPORT 0
+
+#define SYMBOL_REF_DLLEXPORT_P(X) \
+	((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLEXPORT) != 0)
+
+/* Disable SEH and declare the required SEH-related macros that are
+still needed for compilation.  */
+#undef TARGET_SEH
+#define TARGET_SEH 0
+
+#define SSE_REGNO_P(N) 0
+#define GENERAL_REGNO_P(N) 0
+#define SEH_MAX_FRAME_SIZE 0
+
+#undef DEFAULT_ABI
+#define DEFAULT_ABI AARCH64_CALLING_ABI_MS
+
+#undef TARGET_PECOFF
+#define TARGET_PECOFF 1
+
+#include <stdbool.h>
+#ifdef __MINGW32__
+#include <stdio.h>
+#endif
+
+extern void mingw_pe_asm_named_section (const char *, unsigned int, tree);
+extern void mingw_pe_declare_function_type (FILE *file, const char *name,
+	int pub);
+
+#define TARGET_ASM_NAMED_SECTION  mingw_pe_asm_named_section
+
+/* Select attributes for named sections.  */
+#define TARGET_SECTION_TYPE_FLAGS  mingw_pe_section_type_flags
+
+#define TARGET_ASM_UNIQUE_SECTION mingw_pe_unique_section
+#define TARGET_ENCODE_SECTION_INFO  mingw_pe_encode_section_info
+
+/* Declare the type properly for any external libcall.  */
+#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
+  mingw_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
+
+#define TARGET_OS_CPP_BUILTINS()					\
+  do									\
+    {									\
+      builtin_define ("__MSVCRT__");					\
+      builtin_define ("__MINGW32__");					\
+      builtin_define ("_WIN32");					\
+      builtin_define_std ("WIN32");					\
+      builtin_define_std ("WINNT");					\
+      builtin_define_with_int_value ("_INTEGRAL_MAX_BITS",		\
+				TYPE_PRECISION (intmax_type_node));	\
+      builtin_define ("__MINGW64__");					\
+      builtin_define_std ("WIN64");					\
+      builtin_define ("_WIN64");					\
+      builtin_define ("__stdcall=__attribute__((__stdcall__))");	\
+      builtin_define ("__fastcall=__attribute__((__fastcall__))");	\
+      builtin_define ("__thiscall=__attribute__((__thiscall__))");	\
+      builtin_define ("__cdecl=__attribute__((__cdecl__))");		\
+    }									\
+  while (0)
+
+/* Windows64 continues to use a 32-bit long type.  */
+#undef LONG_TYPE_SIZE
+#define LONG_TYPE_SIZE 32
+
+#undef DEFAULT_SIGNED_CHAR
+#define DEFAULT_SIGNED_CHAR 1
+
+#undef SIZE_TYPE
+#undef PTRDIFF_TYPE
+#define SIZE_TYPE "long long unsigned int"
+#define PTRDIFF_TYPE "long long int"
+
+#undef WCHAR_TYPE_SIZE
+#undef WCHAR_TYPE
+#define WCHAR_TYPE_SIZE 16
+#define WCHAR_TYPE "short unsigned int"
+
+#define drectve_section() \
+  (fprintf (asm_out_file, "\t.section\t.drectve\n"), \
+   in_section = NULL)
+
+
+/* Enable alias attribute support.  */
+#ifndef SET_ASM_OP
+#define SET_ASM_OP "\t.set\t"
+#endif
+
+/* GNU as supports weak symbols on PECOFF.  */
+#define ASM_WEAKEN_LABEL(FILE, NAME)	\
+  do					\
+    {					\
+      fputs ("\t.weak\t", (FILE));	\
+      assemble_name ((FILE), (NAME));	\
+      fputc ('\n', (FILE));		\
+    }					\
+  while (0)
+
+/* Get tree.cc to declare a target-specific specialization of
+   merge_decl_attributes.  */
+#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1
+
+#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL)		\
+  do {									\
+    switch (GET_MODE (BODY))						\
+      {									\
+      case E_QImode:							\
+	asm_fprintf (STREAM, "\t.byte\t(%LL%d - %LLrtx%d) / 4\n",	\
+		     VALUE, REL);					\
+	break;								\
+      case E_HImode:							\
+	asm_fprintf (STREAM, "\t.2byte\t(%LL%d - %LLrtx%d) / 4\n",	\
+		     VALUE, REL);					\
+	break;								\
+      case E_SImode:							\
+      case E_DImode: /* See comment in aarch64_output_casesi.  */	\
+	asm_fprintf (STREAM, "\t.word\t(%LL%d - %LLrtx%d) / 4\n",	\
+		     VALUE, REL);					\
+	break;								\
+      default:								\
+	gcc_unreachable ();						\
+      }									\
+  } while (0)
+
+#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rdata,\"dr\""
+
+#undef  SUBTARGET_OVERRIDE_OPTIONS
+#define SUBTARGET_OVERRIDE_OPTIONS			\
+  do {							\
+    flag_stack_check = STATIC_BUILTIN_STACK_CHECK;	\
+  } while (0)
+
+
+#define SUPPORTS_ONE_ONLY 1
+
+/* Define this to be nonzero if static stack checking is supported.  */
+#define STACK_CHECK_STATIC_BUILTIN 1
+
+#define HAVE_GAS_ALIGNED_COMM 1
+
+#undef MAX_OFILE_ALIGNMENT
+#define MAX_OFILE_ALIGNMENT (8192 * 8)
+
+#endif
-- 
2.25.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 09/13] aarch64: Add SEH to machine_function
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (7 preceding siblings ...)
  2024-03-04 17:44 ` [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64 Evgeny Karpov
@ 2024-03-04 17:45 ` Evgeny Karpov
  2024-03-04 17:46 ` [PATCH v2 10/13] Rename "x86 Windows Options" to "Cygwin and MinGW Options" Evgeny Karpov
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 17:45 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

From: Zac Walker <zacwalker@microsoft.com>
Date: Tue, 20 Feb 2024 18:10:08 +0100
Subject: [PATCH v2 09/13] aarch64: Add SEH to machine_function

SEH is not enabled in aarch64-w64-mingw32 target yet. However, it is
needed to be declared in machine_function for reusing winnt.cc.

gcc/ChangeLog:

	* config/aarch64/aarch64.h (struct seh_frame_state): Declare SEH
	structure in machine_function.
	(GTY): Add SEH field.
---
 gcc/config/aarch64/aarch64.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 45e901cda64..62cc97aa8c8 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -1042,6 +1042,9 @@ struct GTY (()) aarch64_frame
   bool is_scs_enabled;
 };
 
+/* Private to winnt.cc.  */
+struct seh_frame_state;
+
 #ifdef hash_set_h
 typedef struct GTY (()) machine_function
 {
@@ -1082,6 +1085,9 @@ typedef struct GTY (()) machine_function
      still exists and still fulfils its original purpose. the same register
      can be reused by other code.  */
   rtx_insn *advsimd_zero_insn;
+
+  /* During SEH output, this is non-null.  */
+  struct seh_frame_state * GTY ((skip (""))) seh;
 } machine_function;
 #endif
 #endif
-- 
2.25.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 10/13] Rename "x86 Windows Options" to "Cygwin and MinGW Options"
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (8 preceding siblings ...)
  2024-03-04 17:45 ` [PATCH v2 09/13] aarch64: Add SEH to machine_function Evgeny Karpov
@ 2024-03-04 17:46 ` Evgeny Karpov
  2024-04-10 18:35   ` Richard Sandiford
  2024-03-04 17:49 ` [PATCH v2 11/13] aarch64: Build and add objects for Cygwin and MinGW for AArch64 Evgeny Karpov
                   ` (7 subsequent siblings)
  17 siblings, 1 reply; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 17:46 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

From: Zac Walker <zacwalker@microsoft.com>
Date: Fri, 1 Mar 2024 02:17:39 +0100
Subject: [PATCH v2 10/13] Rename "x86 Windows Options" to "Cygwin and MinGW
 Options"

Rename "x86 Windows Options" to "Cygwin and MinGW Options".
It will be used also for AArch64.

gcc/ChangeLog:

	* config/i386/mingw-w64.opt.urls: Rename options' name and
	regenerate option URLs.
	* config/lynx.opt.urls: Likewise.
	* config/mingw/cygming.opt.urls: Likewise.
	* config/mingw/mingw.opt.urls: Likewise.
	* doc/invoke.texi: Likewise.
---
 gcc/config/i386/mingw-w64.opt.urls |  2 +-
 gcc/config/lynx.opt.urls           |  2 +-
 gcc/config/mingw/cygming.opt.urls  | 18 +++++++++---------
 gcc/config/mingw/mingw.opt.urls    |  2 +-
 gcc/doc/invoke.texi                | 12 ++++++++++--
 5 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/gcc/config/i386/mingw-w64.opt.urls b/gcc/config/i386/mingw-w64.opt.urls
index 6bb53ef29b2..5cceba1d1a1 100644
--- a/gcc/config/i386/mingw-w64.opt.urls
+++ b/gcc/config/i386/mingw-w64.opt.urls
@@ -1,5 +1,5 @@
 ; Autogenerated by regenerate-opt-urls.py from gcc/config/i386/mingw-w64.opt and generated HTML
 
 municode
-UrlSuffix(gcc/x86-Windows-Options.html#index-municode)
+UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-municode)
 
diff --git a/gcc/config/lynx.opt.urls b/gcc/config/lynx.opt.urls
index 63e7b9c4b33..b547138f7ff 100644
--- a/gcc/config/lynx.opt.urls
+++ b/gcc/config/lynx.opt.urls
@@ -1,5 +1,5 @@
 ; Autogenerated by regenerate-opt-urls.py from gcc/config/lynx.opt and generated HTML
 
 mthreads
-UrlSuffix(gcc/x86-Windows-Options.html#index-mthreads-1)
+UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mthreads-1)
 
diff --git a/gcc/config/mingw/cygming.opt.urls b/gcc/config/mingw/cygming.opt.urls
index 87799befe3c..c624e22e442 100644
--- a/gcc/config/mingw/cygming.opt.urls
+++ b/gcc/config/mingw/cygming.opt.urls
@@ -1,30 +1,30 @@
 ; Autogenerated by regenerate-opt-urls.py from gcc/config/i386/cygming.opt and generated HTML
 
 mconsole
-UrlSuffix(gcc/x86-Windows-Options.html#index-mconsole)
+UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mconsole)
 
 mdll
-UrlSuffix(gcc/x86-Windows-Options.html#index-mdll)
+UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mdll)
 
 mnop-fun-dllimport
-UrlSuffix(gcc/x86-Windows-Options.html#index-mnop-fun-dllimport)
+UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mnop-fun-dllimport)
 
 ; skipping UrlSuffix for 'mthreads' due to multiple URLs:
+;   duplicate: 'gcc/Cygwin-and-MinGW-Options.html#index-mthreads-1'
 ;   duplicate: 'gcc/x86-Options.html#index-mthreads'
-;   duplicate: 'gcc/x86-Windows-Options.html#index-mthreads-1'
 
 mwin32
-UrlSuffix(gcc/x86-Windows-Options.html#index-mwin32)
+UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mwin32)
 
 mwindows
-UrlSuffix(gcc/x86-Windows-Options.html#index-mwindows)
+UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mwindows)
 
 mpe-aligned-commons
-UrlSuffix(gcc/x86-Windows-Options.html#index-mpe-aligned-commons)
+UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mpe-aligned-commons)
 
 fset-stack-executable
-UrlSuffix(gcc/x86-Windows-Options.html#index-fno-set-stack-executable)
+UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-fno-set-stack-executable)
 
 fwritable-relocated-rdata
-UrlSuffix(gcc/x86-Windows-Options.html#index-fno-writable-relocated-rdata)
+UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-fno-writable-relocated-rdata)
 
diff --git a/gcc/config/mingw/mingw.opt.urls b/gcc/config/mingw/mingw.opt.urls
index 2cbbaadf310..f8ee5be6a53 100644
--- a/gcc/config/mingw/mingw.opt.urls
+++ b/gcc/config/mingw/mingw.opt.urls
@@ -1,7 +1,7 @@
 ; Autogenerated by regenerate-opt-urls.py from gcc/config/i386/mingw.opt and generated HTML
 
 mcrtdll=
-UrlSuffix(gcc/x86-Windows-Options.html#index-mcrtdll)
+UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mcrtdll)
 
 ; skipping UrlSuffix for 'pthread' due to multiple URLs:
 ;   duplicate: 'gcc/Link-Options.html#index-pthread-1'
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index bdf05be387d..e2e473e095f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1493,6 +1493,8 @@ See RS/6000 and PowerPC Options.
 -munroll-only-small-loops -mlam=@var{choice}}
 
 @emph{x86 Windows Options}
+
+@emph{Cygwin and MinGW Options}
 @gccoptlist{-mconsole  -mcrtdll=@var{library}  -mdll
 -mnop-fun-dllimport  -mthread
 -municode  -mwin32  -mwindows  -fno-set-stack-executable}
@@ -20976,6 +20978,7 @@ platform.
 * C6X Options::
 * CRIS Options::
 * C-SKY Options::
+* Cygwin and MinGW Options::
 * Darwin Options::
 * DEC Alpha Options::
 * eBPF Options::
@@ -36112,8 +36115,13 @@ positions 62:57 can be used for metadata.
 
 @node x86 Windows Options
 @subsection x86 Windows Options
-@cindex x86 Windows Options
-@cindex Windows Options for x86
+
+@xref{Cygwin and MinGW Options}.
+
+@node Cygwin and MinGW Options
+@subsection Cygwin and MinGW Options
+@cindex Cygwin and MinGW Options
+@cindex Options for Cygwin and MinGW
 
 These additional options are available for Microsoft Windows targets:
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 11/13] aarch64: Build and add objects for Cygwin and MinGW for AArch64
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (9 preceding siblings ...)
  2024-03-04 17:46 ` [PATCH v2 10/13] Rename "x86 Windows Options" to "Cygwin and MinGW Options" Evgeny Karpov
@ 2024-03-04 17:49 ` Evgeny Karpov
  2024-03-04 17:50 ` [PATCH v2 12/13] aarch64: Add aarch64-w64-mingw32 target to libatomic Evgeny Karpov
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 17:49 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

From: Zac Walker <zacwalker@microsoft.com>
Date: Tue, 20 Feb 2024 13:55:51 +0100
Subject: [PATCH v2 11/13] aarch64: Build and add objects for Cygwin and MinGW
 for AArch64

gcc/ChangeLog:

	* config.gcc: Build and add objects for Cygwin and MinGW. Add Cygwin
	and MinGW options to the target.
---
 gcc/config.gcc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 4471599454b..ed5431b0f5d 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1272,6 +1272,11 @@ aarch64-*-mingw*)
 	tm_file="${tm_file} mingw/mingw-stdint.h"
 	tmake_file="${tmake_file} aarch64/t-aarch64"
 	target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
+	extra_options="${extra_options} mingw/cygming.opt mingw/mingw.opt"
+	extra_objs="${extra_objs} winnt.o"
+	c_target_objs="${c_target_objs} msformat-c.o"
+	d_target_objs="${d_target_objs} winnt-d.o"
+	tmake_file="${tmake_file} mingw/t-cygming"
 	case ${enable_threads} in
 	  "" | yes | win32)
 	    thread_file='win32'
-- 
2.25.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 12/13] aarch64: Add aarch64-w64-mingw32 target to libatomic
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (10 preceding siblings ...)
  2024-03-04 17:49 ` [PATCH v2 11/13] aarch64: Build and add objects for Cygwin and MinGW for AArch64 Evgeny Karpov
@ 2024-03-04 17:50 ` Evgeny Karpov
  2024-03-04 17:51 ` [PATCH v2 13/13] Add aarch64-w64-mingw32 target to libgcc Evgeny Karpov
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 17:50 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

From: Zac Walker <zacwalker@microsoft.com>
Date: Fri, 1 Mar 2024 02:23:45 +0100
Subject: [PATCH v2 12/13] aarch64: Add aarch64-w64-mingw32 target to libatomic

libatomic/ChangeLog:

	* configure.tgt: Add aarch64-w64-mingw32 target.
---
 libatomic/configure.tgt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index 4237f283fe4..e49fd57ab41 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -44,7 +44,7 @@ case "${target_cpu}" in
   aarch64*)
 	ARCH=aarch64
 	case "${target}" in
-	    aarch64*-*-linux*)
+	    aarch64*-*-linux* | aarch64-*-mingw*)
 		if test -n "$enable_aarch64_lse"; then
 		    try_ifunc=yes
 		fi
-- 
2.25.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 13/13] Add aarch64-w64-mingw32 target to libgcc
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (11 preceding siblings ...)
  2024-03-04 17:50 ` [PATCH v2 12/13] aarch64: Add aarch64-w64-mingw32 target to libatomic Evgeny Karpov
@ 2024-03-04 17:51 ` Evgeny Karpov
  2024-03-04 17:55 ` [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 17:51 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

From: Zac Walker <zacwalker@microsoft.com>
Date: Mon, 12 Feb 2024 15:22:47 +0100
Subject: [PATCH v2 13/13] Add aarch64-w64-mingw32 target to libgcc

Reuse MinGW definitions from i386 for libgcc. Move reused files to
libgcc/config/mingw folder.

libgcc/ChangeLog:

	* config.host: Add aarch64-w64-mingw32 target. Adjust targets
	after moving MinGW files.
	* config/i386/t-gthr-win32: Move to...
	* config/mingw/t-gthr-win32: ...here.
	* config/i386/t-mingw-pthread: Move to...
	* config/mingw/t-mingw-pthread: ...here.
	* config/aarch64/t-no-eh: New file. EH is not yet implemented for
	the target, and the default definition should be disabled.
---
 libgcc/config.host                            | 23 +++++++++++++++----
 libgcc/config/aarch64/t-no-eh                 |  2 ++
 libgcc/config/{i386 => mingw}/t-gthr-win32    |  0
 libgcc/config/{i386 => mingw}/t-mingw-pthread |  0
 4 files changed, 21 insertions(+), 4 deletions(-)
 create mode 100644 libgcc/config/aarch64/t-no-eh
 rename libgcc/config/{i386 => mingw}/t-gthr-win32 (100%)
 rename libgcc/config/{i386 => mingw}/t-mingw-pthread (100%)

diff --git a/libgcc/config.host b/libgcc/config.host
index 59a42d3a01f..3396a84893f 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -456,6 +456,21 @@ aarch64*-*-vxworks7*)
 	tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
 	tmake_file="${tmake_file} t-dfprules"
 	;;
+aarch64-*-mingw*)
+	case ${target_thread_file} in
+	  win32)
+	    tmake_thr_file="mingw/t-gthr-win32"
+	    ;;
+	  posix)
+	    tmake_thr_file="mingw/t-mingw-pthread"
+	    ;;
+	esac
+	tmake_file="${tmake_file} ${cpu_type}/t-no-eh ${tmake_thr_file}"
+	tmake_file="${tmake_file} t-dfprules"
+	tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
+	tmake_file="${tmake_file} ${cpu_type}/t-lse"
+	tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
+	;;
 alpha*-*-linux*)
 	tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee t-crtfm alpha/t-linux"
 	extra_parts="$extra_parts crtfastmath.o"
@@ -874,10 +889,10 @@ i[34567]86-*-mingw*)
 	fi
 	case ${target_thread_file} in
 	  win32)
-	    tmake_thr_file="i386/t-gthr-win32"
+	    tmake_thr_file="mingw/t-gthr-win32"
 	    ;;
 	  posix)
-	    tmake_thr_file="i386/t-mingw-pthread"
+	    tmake_thr_file="mingw/t-mingw-pthread"
 	    ;;
 	  mcf)
 	    tmake_thr_file="i386/t-mingw-mcfgthread"
@@ -901,10 +916,10 @@ i[34567]86-*-mingw*)
 x86_64-*-mingw*)
 	case ${target_thread_file} in
 	  win32)
-	    tmake_thr_file="i386/t-gthr-win32"
+	    tmake_thr_file="mingw/t-gthr-win32"
 	    ;;
 	  posix)
-	    tmake_thr_file="i386/t-mingw-pthread"
+	    tmake_thr_file="mingw/t-mingw-pthread"
 	    ;;
 	  mcf)
 	    tmake_thr_file="i386/t-mingw-mcfgthread"
diff --git a/libgcc/config/aarch64/t-no-eh b/libgcc/config/aarch64/t-no-eh
new file mode 100644
index 00000000000..1802339a583
--- /dev/null
+++ b/libgcc/config/aarch64/t-no-eh
@@ -0,0 +1,2 @@
+# Not using EH
+LIB2ADDEH =
diff --git a/libgcc/config/i386/t-gthr-win32 b/libgcc/config/mingw/t-gthr-win32
similarity index 100%
rename from libgcc/config/i386/t-gthr-win32
rename to libgcc/config/mingw/t-gthr-win32
diff --git a/libgcc/config/i386/t-mingw-pthread b/libgcc/config/mingw/t-mingw-pthread
similarity index 100%
rename from libgcc/config/i386/t-mingw-pthread
rename to libgcc/config/mingw/t-mingw-pthread
-- 
2.25.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (12 preceding siblings ...)
  2024-03-04 17:51 ` [PATCH v2 13/13] Add aarch64-w64-mingw32 target to libgcc Evgeny Karpov
@ 2024-03-04 17:55 ` Evgeny Karpov
  2024-03-04 19:25 ` Evgeny Karpov
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 17:55 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

gcc/ChangeLog:

	* config.gcc:
	* config/aarch64/aarch64-opts.h (enum aarch64_calling_abi):
	* config/aarch64/aarch64-protos.h (mingw_pe_maybe_record_exported_symbol):
	(mingw_pe_section_type_flags):
	(mingw_pe_unique_section):
	(mingw_pe_encode_section_info):
	* config/aarch64/aarch64.h (struct seh_frame_state):
	(GTY):
	* config/i386/cygming.h (SUBTARGET_ENCODE_SECTION_INFO):
	(TARGET_ASM_UNIQUE_SECTION):
	(TARGET_ASM_NAMED_SECTION):
	(TARGET_SECTION_TYPE_FLAGS):
	(ASM_DECLARE_COLD_FUNCTION_NAME):
	(ASM_OUTPUT_EXTERNAL_LIBCALL):
	* config/i386/i386-protos.h (i386_pe_unique_section):
	(i386_pe_declare_function_type):
	(mingw_pe_unique_section):
	(mingw_pe_declare_function_type):
	(i386_pe_maybe_record_exported_symbol):
	(i386_pe_encode_section_info):
	(mingw_pe_maybe_record_exported_symbol):
	(mingw_pe_encode_section_info):
	(i386_pe_section_type_flags):
	(i386_pe_asm_named_section):
	(mingw_pe_section_type_flags):
	(mingw_pe_asm_named_section):
	* config/i386/mingw-w64.opt.urls:
	* config/lynx.opt.urls:
	* config/i386/cygming.opt: Move to...
	* config/mingw/cygming.opt: ...here.
	* config/i386/cygwin-d.cc: Move to...
	* config/mingw/cygwin-d.cc: ...here.
	* config/i386/mingw-stdint.h: Move to...
	* config/mingw/mingw-stdint.h: ...here.
	* config/i386/mingw.opt: Move to...
	* config/mingw/mingw.opt: ...here.
	* config/i386/mingw.opt.urls: Move to...
	* config/mingw/mingw.opt.urls: ...here.
	* config/i386/mingw32.h: Move to...
	* config/mingw/mingw32.h: ...here.
	* config/i386/msformat-c.cc: Move to...
	* config/mingw/msformat-c.cc: ...here.
	* config/i386/t-cygming: Move to...
	* config/mingw/t-cygming: ...here.
	* config/i386/winnt-cxx.cc: Move to...
	* config/mingw/winnt-cxx.cc: ...here.
	* config/i386/winnt-d.cc: Move to...
	* config/mingw/winnt-d.cc: ...here.
	* config/i386/winnt-stubs.cc: Move to...
	* config/mingw/winnt-stubs.cc: ...here.
	* config/i386/winnt.cc: Move to...
	* config/mingw/winnt.cc: ...here.
	* doc/invoke.texi:
	* varasm.cc (switch_to_comdat_section):
	* config/i386/cygming.opt.urls: Removed.
	* config/aarch64/aarch64-abi-ms.h: New file.
	* config/aarch64/aarch64-coff.h: New file.
	* config/aarch64/cygming.h: New file.
	* config/mingw/cygming.opt.urls: New file.

libatomic/ChangeLog:

	* configure.tgt:

libgcc/ChangeLog:

	* config.host:
	* config/i386/t-gthr-win32: Move to...
	* config/mingw/t-gthr-win32: ...here.
	* config/i386/t-mingw-pthread: Move to...
	* config/mingw/t-mingw-pthread: ...here.
	* config/aarch64/t-no-eh: New file.


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (13 preceding siblings ...)
  2024-03-04 17:55 ` [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
@ 2024-03-04 19:25 ` Evgeny Karpov
  2024-03-07 20:47 ` Evgeny Karpov
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-04 19:25 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

Zac Walker (13):
  Introduce aarch64-w64-mingw32 target
  aarch64: The aarch64-w64-mingw32 target implements the MS ABI
  aarch64: Mark x18 register as a fixed register for MS ABI
  aarch64: Add aarch64-w64-mingw32 COFF
  Reuse MinGW from i386 for AArch64
  Rename section and encoding functions from i386 which will be used in
    aarch64
  Exclude i386 functionality from aarch64 build
  aarch64: Add Cygwin and MinGW environments for AArch64
  aarch64: Add SEH to machine_function
  Rename "x86 Windows Options" to "Cygwin and MinGW Options"
  aarch64: Build and add objects for Cygwin and MinGW for AArch64
  aarch64: Add aarch64-w64-mingw32 target to libatomic
  Add aarch64-w64-mingw32 target to libgcc

 fixincludes/mkfixinc.sh                       |   3 +-
 gcc/config.gcc                                |  47 +++--
 gcc/config/aarch64/aarch64-abi-ms.h           |  64 +++++++
 gcc/config/aarch64/aarch64-coff.h             |  91 +++++++++
 gcc/config/aarch64/aarch64-opts.h             |   7 +
 gcc/config/aarch64/aarch64-protos.h           |   5 +
 gcc/config/aarch64/aarch64.h                  |   6 +
 gcc/config/aarch64/cygming.h                  | 175 ++++++++++++++++++
 gcc/config/i386/cygming.h                     |  18 +-
 gcc/config/i386/cygming.opt.urls              |  30 ---
 gcc/config/i386/i386-protos.h                 |  12 +-
 gcc/config/i386/mingw-w64.opt.urls            |   2 +-
 gcc/config/lynx.opt.urls                      |   2 +-
 gcc/config/{i386 => mingw}/cygming.opt        |   0
 gcc/config/mingw/cygming.opt.urls             |  30 +++
 gcc/config/{i386 => mingw}/cygwin-d.cc        |   0
 gcc/config/{i386 => mingw}/mingw-stdint.h     |   9 +-
 gcc/config/{i386 => mingw}/mingw.opt          |   0
 gcc/config/{i386 => mingw}/mingw.opt.urls     |   2 +-
 gcc/config/{i386 => mingw}/mingw32.h          |   6 +-
 gcc/config/{i386 => mingw}/msformat-c.cc      |   0
 gcc/config/{i386 => mingw}/t-cygming          |  23 ++-
 gcc/config/{i386 => mingw}/winnt-cxx.cc       |   0
 gcc/config/{i386 => mingw}/winnt-d.cc         |   0
 gcc/config/{i386 => mingw}/winnt-stubs.cc     |   0
 gcc/config/{i386 => mingw}/winnt.cc           |  30 +--
 gcc/doc/invoke.texi                           |  12 +-
 gcc/varasm.cc                                 |   2 +-
 libatomic/configure.tgt                       |   2 +-
 libgcc/config.host                            |  23 ++-
 libgcc/config/aarch64/t-no-eh                 |   2 +
 libgcc/config/{i386 => mingw}/t-gthr-win32    |   0
 libgcc/config/{i386 => mingw}/t-mingw-pthread |   0
 33 files changed, 510 insertions(+), 93 deletions(-)
 create mode 100644 gcc/config/aarch64/aarch64-abi-ms.h
 create mode 100644 gcc/config/aarch64/aarch64-coff.h
 create mode 100644 gcc/config/aarch64/cygming.h
 delete mode 100644 gcc/config/i386/cygming.opt.urls
 rename gcc/config/{i386 => mingw}/cygming.opt (100%)
 create mode 100644 gcc/config/mingw/cygming.opt.urls
 rename gcc/config/{i386 => mingw}/cygwin-d.cc (100%)
 rename gcc/config/{i386 => mingw}/mingw-stdint.h (86%)
 rename gcc/config/{i386 => mingw}/mingw.opt (100%)
 rename gcc/config/{i386 => mingw}/mingw.opt.urls (86%)
 rename gcc/config/{i386 => mingw}/mingw32.h (98%)
 rename gcc/config/{i386 => mingw}/msformat-c.cc (100%)
 rename gcc/config/{i386 => mingw}/t-cygming (73%)
 rename gcc/config/{i386 => mingw}/winnt-cxx.cc (100%)
 rename gcc/config/{i386 => mingw}/winnt-d.cc (100%)
 rename gcc/config/{i386 => mingw}/winnt-stubs.cc (100%)
 rename gcc/config/{i386 => mingw}/winnt.cc (97%)
 create mode 100644 libgcc/config/aarch64/t-no-eh
 rename libgcc/config/{i386 => mingw}/t-gthr-win32 (100%)
 rename libgcc/config/{i386 => mingw}/t-mingw-pthread (100%)

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (14 preceding siblings ...)
  2024-03-04 19:25 ` Evgeny Karpov
@ 2024-03-07 20:47 ` Evgeny Karpov
  2024-03-18 13:33   ` Christophe Lyon
                     ` (2 more replies)
  2024-03-18 21:05 ` [PATCH " Radek Barton
  2024-04-10 18:40 ` Richard Sandiford
  17 siblings, 3 replies; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-07 20:47 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches, richard.sandiford, Richard Earnshaw (lists)
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

Monday, March 4, 2024
Evgeny Karpov wrote:

>
> Changes from v1 to v2:
> Adjust the target name to aarch64-*-mingw* to exclude the big-endian target
> from support.
> Exclude 64-bit ISA.
> Rename enum calling_abi to aarch64_calling_abi.
> Move AArch64 MS ABI definitions FIXED_REGISTERS,
> CALL_REALLY_USED_REGISTERS, and STATIC_CHAIN_REGNUM from aarch64.h
> to aarch64-abi-ms.h.
> Rename TARGET_ARM64_MS_ABI to TARGET_AARCH64_MS_ABI.
> Exclude TARGET_64BIT from the aarch64 target.
> Exclude HAVE_GAS_WEAK.
> Set HAVE_GAS_ALIGNED_COMM to 1 by default.
> Use a reference from "x86 Windows Options" to "Cygwin and MinGW
> Options".
> Update commit descriptions to follow standard style.
> Rebase from 4th March 2024.

Hello,

It looks like the initial feedback has been addressed.
While unit testing for the x86_64-w64-mingw32 target is still in
progress, the first 4 patches do not obviously change other
targets, including aarch64-linux-gnu.
Could they be merged once stage 1 starts, 
or could it be done even now? 
Thanks!

Regards,
Evgeny


^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64
  2024-03-04 17:44 ` [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64 Evgeny Karpov
@ 2024-03-18 13:26   ` Christophe Lyon
  2024-03-18 21:35   ` Evgeny Karpov
  2024-04-10 18:34   ` Richard Sandiford
  2 siblings, 0 replies; 40+ messages in thread
From: Christophe Lyon @ 2024-03-18 13:26 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, richard.sandiford, Richard Earnshaw (lists),
	Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

Hi!

On Mon, 4 Mar 2024 at 18:44, Evgeny Karpov <Evgeny.Karpov@microsoft.com> wrote:
>
> From: Zac Walker <zacwalker@microsoft.com>
> Date: Fri, 1 Mar 2024 10:49:28 +0100
> Subject: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for
>  AArch64
>
> Define Cygwin and MinGW environment such as types, SEH definitions,
> shared libraries, etc.
>
> gcc/ChangeLog:
>
>         * config.gcc: Add Cygwin and MinGW difinitions.
>         * config/aarch64/aarch64-protos.h
>         (mingw_pe_maybe_record_exported_symbol): Declare functions
>         which are used in Cygwin and MinGW environment.
>         (mingw_pe_section_type_flags): Likewise.
>         (mingw_pe_unique_section): Likewise.
>         (mingw_pe_encode_section_info): Likewise.
>         * config/aarch64/cygming.h: New file.
> ---
>  gcc/config.gcc                      |   4 +
>  gcc/config/aarch64/aarch64-protos.h |   5 +
>  gcc/config/aarch64/cygming.h        | 175 ++++++++++++++++++++++++++++
>  3 files changed, 184 insertions(+)
>  create mode 100644 gcc/config/aarch64/cygming.h
>
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index 3aca257c322..4471599454b 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -1267,7 +1267,11 @@ aarch64*-*-linux*)
>  aarch64-*-mingw*)
>         tm_file="${tm_file} aarch64/aarch64-abi-ms.h"
>         tm_file="${tm_file} aarch64/aarch64-coff.h"
> +       tm_file="${tm_file} aarch64/cygming.h"
> +       tm_file="${tm_file} mingw/mingw32.h"
> +       tm_file="${tm_file} mingw/mingw-stdint.h"
>         tmake_file="${tmake_file} aarch64/t-aarch64"
> +       target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
>         case ${enable_threads} in
>           "" | yes | win32)
>             thread_file='win32'
> diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
> index bd719b992a5..759e1a0f9da 100644
> --- a/gcc/config/aarch64/aarch64-protos.h
> +++ b/gcc/config/aarch64/aarch64-protos.h
> @@ -1110,6 +1110,11 @@ extern void aarch64_output_patchable_area (unsigned int, bool);
>
>  extern void aarch64_adjust_reg_alloc_order ();
>
> +extern void mingw_pe_maybe_record_exported_symbol (tree, const char *, int);
> +extern unsigned int mingw_pe_section_type_flags (tree, const char *, int);
> +extern void mingw_pe_unique_section (tree, int);
> +extern void mingw_pe_encode_section_info (tree, rtx, int);
> +
>  bool aarch64_optimize_mode_switching (aarch64_mode_entity);
>  void aarch64_restore_za (rtx);
>
> diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h
> new file mode 100644
> index 00000000000..2f239c42a89
> --- /dev/null
> +++ b/gcc/config/aarch64/cygming.h
> @@ -0,0 +1,175 @@
> +/* Operating system specific defines to be used when targeting GCC for
> +   hosting on Windows32, using a Unix style C library and tools.
> +   Copyright (C) 1995-2024 Free Software Foundation, Inc.
> +
> +This file is part of GCC.
> +
> +GCC is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 3, or (at your option)
> +any later version.
> +
> +GCC is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +GNU General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GCC; see the file COPYING3.  If not see
> +<http://www.gnu.org/licenses/>.  */
> +
> +#ifndef GCC_AARCH64_CYGMING_H
> +#define GCC_AARCH64_CYGMING_H
> +
> +#undef PREFERRED_DEBUGGING_TYPE
> +#define PREFERRED_DEBUGGING_TYPE DINFO_TYPE_NONE
> +
> +#define FASTCALL_PREFIX '@'
> +
> +#define print_reg(rtx, code, file)
> +
> +#define SYMBOL_FLAG_DLLIMPORT 0
> +#define SYMBOL_FLAG_DLLEXPORT 0
> +
> +#define SYMBOL_REF_DLLEXPORT_P(X) \
> +       ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLEXPORT) != 0)
> +
> +/* Disable SEH and declare the required SEH-related macros that are
> +still needed for compilation.  */
> +#undef TARGET_SEH
> +#define TARGET_SEH 0
> +
> +#define SSE_REGNO_P(N) 0
> +#define GENERAL_REGNO_P(N) 0
I think you forgot to add a comment to explain the above two lines.
(it was requested during v1 review)

Thanks,

Christophe

> +#define SEH_MAX_FRAME_SIZE 0
> +
> +#undef DEFAULT_ABI
> +#define DEFAULT_ABI AARCH64_CALLING_ABI_MS
> +
> +#undef TARGET_PECOFF
> +#define TARGET_PECOFF 1
> +
> +#include <stdbool.h>
> +#ifdef __MINGW32__
> +#include <stdio.h>
> +#endif
> +
> +extern void mingw_pe_asm_named_section (const char *, unsigned int, tree);
> +extern void mingw_pe_declare_function_type (FILE *file, const char *name,
> +       int pub);
> +
> +#define TARGET_ASM_NAMED_SECTION  mingw_pe_asm_named_section
> +
> +/* Select attributes for named sections.  */
> +#define TARGET_SECTION_TYPE_FLAGS  mingw_pe_section_type_flags
> +
> +#define TARGET_ASM_UNIQUE_SECTION mingw_pe_unique_section
> +#define TARGET_ENCODE_SECTION_INFO  mingw_pe_encode_section_info
> +
> +/* Declare the type properly for any external libcall.  */
> +#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
> +  mingw_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
> +
> +#define TARGET_OS_CPP_BUILTINS()                                       \
> +  do                                                                   \
> +    {                                                                  \
> +      builtin_define ("__MSVCRT__");                                   \
> +      builtin_define ("__MINGW32__");                                  \
> +      builtin_define ("_WIN32");                                       \
> +      builtin_define_std ("WIN32");                                    \
> +      builtin_define_std ("WINNT");                                    \
> +      builtin_define_with_int_value ("_INTEGRAL_MAX_BITS",             \
> +                               TYPE_PRECISION (intmax_type_node));     \
> +      builtin_define ("__MINGW64__");                                  \
> +      builtin_define_std ("WIN64");                                    \
> +      builtin_define ("_WIN64");                                       \
> +      builtin_define ("__stdcall=__attribute__((__stdcall__))");       \
> +      builtin_define ("__fastcall=__attribute__((__fastcall__))");     \
> +      builtin_define ("__thiscall=__attribute__((__thiscall__))");     \
> +      builtin_define ("__cdecl=__attribute__((__cdecl__))");           \
> +    }                                                                  \
> +  while (0)
> +
> +/* Windows64 continues to use a 32-bit long type.  */
> +#undef LONG_TYPE_SIZE
> +#define LONG_TYPE_SIZE 32
> +
> +#undef DEFAULT_SIGNED_CHAR
> +#define DEFAULT_SIGNED_CHAR 1
> +
> +#undef SIZE_TYPE
> +#undef PTRDIFF_TYPE
> +#define SIZE_TYPE "long long unsigned int"
> +#define PTRDIFF_TYPE "long long int"
> +
> +#undef WCHAR_TYPE_SIZE
> +#undef WCHAR_TYPE
> +#define WCHAR_TYPE_SIZE 16
> +#define WCHAR_TYPE "short unsigned int"
> +
> +#define drectve_section() \
> +  (fprintf (asm_out_file, "\t.section\t.drectve\n"), \
> +   in_section = NULL)
> +
> +
> +/* Enable alias attribute support.  */
> +#ifndef SET_ASM_OP
> +#define SET_ASM_OP "\t.set\t"
> +#endif
> +
> +/* GNU as supports weak symbols on PECOFF.  */
> +#define ASM_WEAKEN_LABEL(FILE, NAME)   \
> +  do                                   \
> +    {                                  \
> +      fputs ("\t.weak\t", (FILE));     \
> +      assemble_name ((FILE), (NAME));  \
> +      fputc ('\n', (FILE));            \
> +    }                                  \
> +  while (0)
> +
> +/* Get tree.cc to declare a target-specific specialization of
> +   merge_decl_attributes.  */
> +#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1
> +
> +#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL)             \
> +  do {                                                                 \
> +    switch (GET_MODE (BODY))                                           \
> +      {                                                                        \
> +      case E_QImode:                                                   \
> +       asm_fprintf (STREAM, "\t.byte\t(%LL%d - %LLrtx%d) / 4\n",       \
> +                    VALUE, REL);                                       \
> +       break;                                                          \
> +      case E_HImode:                                                   \
> +       asm_fprintf (STREAM, "\t.2byte\t(%LL%d - %LLrtx%d) / 4\n",      \
> +                    VALUE, REL);                                       \
> +       break;                                                          \
> +      case E_SImode:                                                   \
> +      case E_DImode: /* See comment in aarch64_output_casesi.  */      \
> +       asm_fprintf (STREAM, "\t.word\t(%LL%d - %LLrtx%d) / 4\n",       \
> +                    VALUE, REL);                                       \
> +       break;                                                          \
> +      default:                                                         \
> +       gcc_unreachable ();                                             \
> +      }                                                                        \
> +  } while (0)
> +
> +#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rdata,\"dr\""
> +
> +#undef  SUBTARGET_OVERRIDE_OPTIONS
> +#define SUBTARGET_OVERRIDE_OPTIONS                     \
> +  do {                                                 \
> +    flag_stack_check = STATIC_BUILTIN_STACK_CHECK;     \
> +  } while (0)
> +
> +
> +#define SUPPORTS_ONE_ONLY 1
> +
> +/* Define this to be nonzero if static stack checking is supported.  */
> +#define STACK_CHECK_STATIC_BUILTIN 1
> +
> +#define HAVE_GAS_ALIGNED_COMM 1
> +
> +#undef MAX_OFILE_ALIGNMENT
> +#define MAX_OFILE_ALIGNMENT (8192 * 8)
> +
> +#endif
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-03-07 20:47 ` Evgeny Karpov
@ 2024-03-18 13:33   ` Christophe Lyon
  2024-03-18 22:10   ` Evgeny Karpov
  2024-03-21 10:28   ` [PING][PATCH " Evgeny Karpov
  2 siblings, 0 replies; 40+ messages in thread
From: Christophe Lyon @ 2024-03-18 13:33 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, richard.sandiford, Richard Earnshaw (lists),
	Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

On Thu, 7 Mar 2024 at 21:48, Evgeny Karpov <Evgeny.Karpov@microsoft.com> wrote:
>
> Monday, March 4, 2024
> Evgeny Karpov wrote:
>
> >
> > Changes from v1 to v2:
> > Adjust the target name to aarch64-*-mingw* to exclude the big-endian target
> > from support.
> > Exclude 64-bit ISA.
> > Rename enum calling_abi to aarch64_calling_abi.
> > Move AArch64 MS ABI definitions FIXED_REGISTERS,
> > CALL_REALLY_USED_REGISTERS, and STATIC_CHAIN_REGNUM from aarch64.h
> > to aarch64-abi-ms.h.
> > Rename TARGET_ARM64_MS_ABI to TARGET_AARCH64_MS_ABI.
> > Exclude TARGET_64BIT from the aarch64 target.
> > Exclude HAVE_GAS_WEAK.
> > Set HAVE_GAS_ALIGNED_COMM to 1 by default.
> > Use a reference from "x86 Windows Options" to "Cygwin and MinGW
> > Options".
> > Update commit descriptions to follow standard style.
> > Rebase from 4th March 2024.
>
> Hello,
>
> It looks like the initial feedback has been addressed.

I had a look at the v2 series, and besides a minor comment patch #8,
ISTM than all the comments your received about v1 have been addressed,
indeed.

> While unit testing for the x86_64-w64-mingw32 target is still in
> progress, the first 4 patches do not obviously change other
> targets, including aarch64-linux-gnu.
> Could they be merged once stage 1 starts,
> or could it be done even now?

What would be the benefit of committing only the first 4 patches?
(whether now or when stage 1 reopens)

Thanks,

Christophe

> Thanks!
>
> Regards,
> Evgeny
>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (15 preceding siblings ...)
  2024-03-07 20:47 ` Evgeny Karpov
@ 2024-03-18 21:05 ` Radek Barton
  2024-03-20 11:50   ` Radek Barton
  2024-04-10 18:40 ` Richard Sandiford
  17 siblings, 1 reply; 40+ messages in thread
From: Radek Barton @ 2024-03-18 21:05 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov

Hello, everyone.

Currently, we are able to provide results of regression testing for `x86_64-w64-mingw32` target with `--enable-languages=c,lto,c++,fortran` running in WSL only.

The summarized results, both for the branch with patch set applied and its corresponding base branch, show:

517501 expected passes
4537 of expected failures
10828 unexpected failures
180 of unexpected successes
5934 of unresolved testcases
19113 of unsupported tests

which means that 98% of the tests ends in an expected way and we haven't detected a single regression between the branches.

The detailed results can be downloaded and reviewed at https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/actions/runs/8327889403

Best regards,

Radek Bartoň

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64
  2024-03-04 17:44 ` [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64 Evgeny Karpov
  2024-03-18 13:26   ` Christophe Lyon
@ 2024-03-18 21:35   ` Evgeny Karpov
  2024-03-19 13:40     ` Christophe Lyon
  2024-04-10 18:34   ` Richard Sandiford
  2 siblings, 1 reply; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-18 21:35 UTC (permalink / raw)
  To: gcc-patches, Christophe Lyon
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

Monday, March 18, 2024 2:27 PM
Christophe Lyon wrote: 

> > +/* Disable SEH and declare the required SEH-related macros that are
> > +still needed for compilation.  */ #undef TARGET_SEH #define
> > +TARGET_SEH 0
> > +
> > +#define SSE_REGNO_P(N) 0
> > +#define GENERAL_REGNO_P(N) 0
> I think you forgot to add a comment to explain the above two lines.
> (it was requested during v1 review)
> 
> Thanks,
> 
> Christophe

Hi Christophe,

Thank you for the review!
The comment regarding SEH and SEH-related macros has been added two lines above.
It may not be obvious, but these macros are needed to emit SEH data in mingw/winnt.cc.
This group is separated by an empty line; however, it still relates to SEH-related macros.

Regards,
Evgeny

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-03-07 20:47 ` Evgeny Karpov
  2024-03-18 13:33   ` Christophe Lyon
@ 2024-03-18 22:10   ` Evgeny Karpov
  2024-03-18 22:58     ` Fangrui Song
  2024-03-21 10:28   ` [PING][PATCH " Evgeny Karpov
  2 siblings, 1 reply; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-18 22:10 UTC (permalink / raw)
  To: gcc-patches, richard.sandiford, Richard Earnshaw (lists),
	christophe.lyon
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton


Monday, March 18, 2024 2:34 PM
Christophe Lyon wrote:

> I had a look at the v2 series, and besides a minor comment patch #8, ISTM than
> all the comments your received about v1 have been addressed, indeed.
> 
> > While unit testing for the x86_64-w64-mingw32 target is still in
> > progress, the first 4 patches do not obviously change other targets,
> > including aarch64-linux-gnu.
> > Could they be merged once stage 1 starts, or could it be done even
> > now?
> 
> What would be the benefit of committing only the first 4 patches?
> (whether now or when stage 1 reopens)
> 
> Thanks,
> 
> Christophe

Work on obtaining regression test results for x86_x64-w64-mingw32 was still in progress at that moment.
The first 4 patches do not obviously change other targets, so it was safe to merge them.
Now, based on the regression test results https://gcc.gnu.org/pipermail/gcc-patches/2024-March/647967.html,
it appears safe to merge the entire series.

Regards,
Evgeny

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-03-18 22:10   ` Evgeny Karpov
@ 2024-03-18 22:58     ` Fangrui Song
  2024-03-18 23:22       ` Andrew Pinski
  2024-03-19  7:50       ` Martin Storsjö
  0 siblings, 2 replies; 40+ messages in thread
From: Fangrui Song @ 2024-03-18 22:58 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, richard.sandiford, Richard Earnshaw (lists),
	christophe.lyon, Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton, Martin Storsjö

On Mon, Mar 18, 2024 at 3:10 PM Evgeny Karpov
<Evgeny.Karpov@microsoft.com> wrote:
>
>
> Monday, March 18, 2024 2:34 PM
> Christophe Lyon wrote:
>
> > I had a look at the v2 series, and besides a minor comment patch #8, ISTM than
> > all the comments your received about v1 have been addressed, indeed.
> >
> > > While unit testing for the x86_64-w64-mingw32 target is still in
> > > progress, the first 4 patches do not obviously change other targets,
> > > including aarch64-linux-gnu.
> > > Could they be merged once stage 1 starts, or could it be done even
> > > now?
> >
> > What would be the benefit of committing only the first 4 patches?
> > (whether now or when stage 1 reopens)
> >
> > Thanks,
> >
> > Christophe
>
> Work on obtaining regression test results for x86_x64-w64-mingw32 was still in progress at that moment.
> The first 4 patches do not obviously change other targets, so it was safe to merge them.
> Now, based on the regression test results https://gcc.gnu.org/pipermail/gcc-patches/2024-March/647967.html,
> it appears safe to merge the entire series.
>
> Regards,
> Evgeny

LLVM has had an aarch64 mingw ABI support for a long time. Does this
patch series introduce a different ABI?
If yes, do you have a summary?

Does the patch need any adaptation on the LLVM side, or should a
different target triple be picked?
I have always been wondering what "32" in "x86_x64-w64-mingw32" means.

https://github.com/llvm/llvm-project/pull/78908 even introduced the
first use of the triple "arm64ec-w64-mingw32" into llvm-project.


-- 
宋方睿

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-03-18 22:58     ` Fangrui Song
@ 2024-03-18 23:22       ` Andrew Pinski
  2024-03-19  7:50       ` Martin Storsjö
  1 sibling, 0 replies; 40+ messages in thread
From: Andrew Pinski @ 2024-03-18 23:22 UTC (permalink / raw)
  To: Fangrui Song
  Cc: Evgeny Karpov, gcc-patches, richard.sandiford,
	Richard Earnshaw (lists), christophe.lyon, Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton, Martin Storsjö

On Mon, Mar 18, 2024 at 3:59 PM Fangrui Song <maskray@google.com> wrote:
>
> On Mon, Mar 18, 2024 at 3:10 PM Evgeny Karpov
> <Evgeny.Karpov@microsoft.com> wrote:
> >
> >
> > Monday, March 18, 2024 2:34 PM
> > Christophe Lyon wrote:
> >
> > > I had a look at the v2 series, and besides a minor comment patch #8, ISTM than
> > > all the comments your received about v1 have been addressed, indeed.
> > >
> > > > While unit testing for the x86_64-w64-mingw32 target is still in
> > > > progress, the first 4 patches do not obviously change other targets,
> > > > including aarch64-linux-gnu.
> > > > Could they be merged once stage 1 starts, or could it be done even
> > > > now?
> > >
> > > What would be the benefit of committing only the first 4 patches?
> > > (whether now or when stage 1 reopens)
> > >
> > > Thanks,
> > >
> > > Christophe
> >
> > Work on obtaining regression test results for x86_x64-w64-mingw32 was still in progress at that moment.
> > The first 4 patches do not obviously change other targets, so it was safe to merge them.
> > Now, based on the regression test results https://gcc.gnu.org/pipermail/gcc-patches/2024-March/647967.html,
> > it appears safe to merge the entire series.
> >
> > Regards,
> > Evgeny
>
> LLVM has had an aarch64 mingw ABI support for a long time. Does this
> patch series introduce a different ABI?
> If yes, do you have a summary?
>
> Does the patch need any adaptation on the LLVM side, or should a
> different target triple be picked?
> I have always been wondering what "32" in "x86_x64-w64-mingw32" means.

It was always mingw32, it comes from win32 API interface which dates
to when windows also a 16bit API too.
The API has always been named win32 and Microsoft didn't rename it to
win64 though.

Thanks,
Andrew Pinski

>
> https://github.com/llvm/llvm-project/pull/78908 even introduced the
> first use of the triple "arm64ec-w64-mingw32" into llvm-project.
>
>
> --
> 宋方睿

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-03-18 22:58     ` Fangrui Song
  2024-03-18 23:22       ` Andrew Pinski
@ 2024-03-19  7:50       ` Martin Storsjö
  1 sibling, 0 replies; 40+ messages in thread
From: Martin Storsjö @ 2024-03-19  7:50 UTC (permalink / raw)
  To: Fangrui Song
  Cc: Evgeny Karpov, gcc-patches, richard.sandiford,
	Richard Earnshaw (lists), christophe.lyon, Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

On Mon, 18 Mar 2024, Fangrui Song wrote:

> LLVM has had an aarch64 mingw ABI support for a long time. Does this
> patch series introduce a different ABI?
> If yes, do you have a summary?

This patchset in itself does not reach ABI compatibility with the 
preexisting aarch64 mingw ecosystem - but this is also just the first 
patchset to lay out the groundwork for a new mingw target within GCC.

As far as I've understood, the divergence is not intended, and they are 
working on converging towards compatibility - but such bits are to be 
handled in later patchsets.

Off the top of my head, the major missing pieces wrt compatbility are the 
variadic calling convention, and using 64 bit doubles for "long double" 
(just like for Darwin).

> Does the patch need any adaptation on the LLVM side, or should a
> different target triple be picked?

No, I don't think a different target triple should be used - it is 
intended to be the same, but compatibility is a work in progress.

> I have always been wondering what "32" in "x86_x64-w64-mingw32" means.

(Nit, I presume you meant "x86_64-w64-mingw32".)

As Andrew replied, w32 stands for win32, which isn't so much about the 
bitness as "the current windows API as of the last 30 years, as opposed to 
win16". So it's more of a name than something indicating any form of 
bitness.

Likewise, "w64" just indicates which vendor/fork is involved, so we also 
have i686-w64-mingw32 and armv7-w64-mingw32, for the 32 bit ABIs with an 
SDK from the same vendor.

> https://github.com/llvm/llvm-project/pull/78908 even introduced the
> first use of the triple "arm64ec-w64-mingw32" into llvm-project.

ARM64EC is a totally different thing though; that's an entirely separate 
ABI on almost every single level.

// Martin


^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64
  2024-03-18 21:35   ` Evgeny Karpov
@ 2024-03-19 13:40     ` Christophe Lyon
  2024-03-20 21:53       ` rep.dot.nop
  0 siblings, 1 reply; 40+ messages in thread
From: Christophe Lyon @ 2024-03-19 13:40 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, richard.sandiford, Richard Earnshaw (lists),
	Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

On Mon, 18 Mar 2024 at 22:35, Evgeny Karpov <Evgeny.Karpov@microsoft.com> wrote:
>
> Monday, March 18, 2024 2:27 PM
> Christophe Lyon wrote:
>
> > > +/* Disable SEH and declare the required SEH-related macros that are
> > > +still needed for compilation.  */ #undef TARGET_SEH #define
> > > +TARGET_SEH 0
> > > +
> > > +#define SSE_REGNO_P(N) 0
> > > +#define GENERAL_REGNO_P(N) 0
> > I think you forgot to add a comment to explain the above two lines.
> > (it was requested during v1 review)
> >
> > Thanks,
> >
> > Christophe
>
> Hi Christophe,
>
> Thank you for the review!
> The comment regarding SEH and SEH-related macros has been added two lines above.
> It may not be obvious, but these macros are needed to emit SEH data in mingw/winnt.cc.
> This group is separated by an empty line; however, it still relates to SEH-related macros.
>
Thanks for the clarification, I thought that comment only applied to
the two lines about TARGET_SEH.

Christophe

> Regards,
> Evgeny

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-03-18 21:05 ` [PATCH " Radek Barton
@ 2024-03-20 11:50   ` Radek Barton
  2024-03-20 19:37     ` NightStrike
  0 siblings, 1 reply; 40+ messages in thread
From: Radek Barton @ 2024-03-20 11:50 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov

Hello, everyone.

I've re-run the `x86_64-w64-mingw32` target tests with all the languages enabled, except of Ada and JIT, which are harder to bootstrap, and Go, which is not supported by MinGW. The summarized results are:

536176 of expected passes
13859 of unexpected failures
188 of unexpected successes
4537 of expected failures
8271 of unresolved testcases
20958 of unsupported tests
97.40% of tests completes in expected way

and, again, zero regressions were detected.

The detailed results can be reviewed at https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/actions/runs/8349019387

Best regards,

Radek Bartoň

________________________________________
From: Radek Barton <radek.barton@microsoft.com>
Sent: Monday, March 18, 2024 10:05 PM
To: Evgeny Karpov; gcc-patches@gcc.gnu.org
Cc: richard.sandiford@arm.com; Richard Earnshaw (lists); Andrew Pinski (QUIC); Maxim Kuvyrkov
Subject: Re: [PATCH v2 00/13] Add aarch64-w64-mingw32 target

Hello, everyone.

Currently, we are able to provide results of regression testing for `x86_64-w64-mingw32` target with `--enable-languages=c,lto,c++,fortran` running in WSL only.

The summarized results, both for the branch with patch set applied and its corresponding base branch, show:

517501 expected passes
4537 of expected failures
10828 unexpected failures
180 of unexpected successes
5934 of unresolved testcases
19113 of unsupported tests

which means that 98% of the tests ends in an expected way and we haven't detected a single regression between the branches.

The detailed results can be downloaded and reviewed at https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/actions/runs/8327889403

Best regards,

Radek Bartoň

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-03-20 11:50   ` Radek Barton
@ 2024-03-20 19:37     ` NightStrike
  0 siblings, 0 replies; 40+ messages in thread
From: NightStrike @ 2024-03-20 19:37 UTC (permalink / raw)
  To: Radek Barton
  Cc: Evgeny Karpov, GCC Patches, Richard Sandiford,
	Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov

[-- Attachment #1: Type: text/plain, Size: 2103 bytes --]

On Wed, Mar 20, 2024, 07:50 Radek Barton <radek.barton@microsoft.com> wrote:

> Hello, everyone.
>
> I've re-run the `x86_64-w64-mingw32` target tests with all the languages
> enabled, except of Ada and JIT, which are harder to bootstrap, and Go,
> which is not supported by MinGW. The summarized results are:
>
> 536176 of expected passes
> 13859 of unexpected failures
> 188 of unexpected successes
> 4537 of expected failures
> 8271 of unresolved testcases
> 20958 of unsupported tests
> 97.40% of tests completes in expected way
>

You can generate an integrated summary using dejagnu report card:

https://www.gnu.org/software/dejagnu/manual/Invoking-dejagnu-report-card.html


> and, again, zero regressions were detected.
>
> The detailed results can be reviewed at
> https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/actions/runs/8349019387
>
> Best regards,
>
> Radek Bartoň
>
> ________________________________________
> From: Radek Barton <radek.barton@microsoft.com>
> Sent: Monday, March 18, 2024 10:05 PM
> To: Evgeny Karpov; gcc-patches@gcc.gnu.org
> Cc: richard.sandiford@arm.com; Richard Earnshaw (lists); Andrew Pinski
> (QUIC); Maxim Kuvyrkov
> Subject: Re: [PATCH v2 00/13] Add aarch64-w64-mingw32 target
>
> Hello, everyone.
>
> Currently, we are able to provide results of regression testing for
> `x86_64-w64-mingw32` target with `--enable-languages=c,lto,c++,fortran`
> running in WSL only.
>
> The summarized results, both for the branch with patch set applied and its
> corresponding base branch, show:
>
> 517501 expected passes
> 4537 of expected failures
> 10828 unexpected failures
> 180 of unexpected successes
> 5934 of unresolved testcases
> 19113 of unsupported tests
>
> which means that 98% of the tests ends in an expected way and we haven't
> detected a single regression between the branches.
>
> The detailed results can be downloaded and reviewed at
> https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/actions/runs/8327889403
>
> Best regards,
>
> Radek Bartoň
>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64
  2024-03-19 13:40     ` Christophe Lyon
@ 2024-03-20 21:53       ` rep.dot.nop
  0 siblings, 0 replies; 40+ messages in thread
From: rep.dot.nop @ 2024-03-20 21:53 UTC (permalink / raw)
  To: gcc-patches, Christophe Lyon, Evgeny Karpov
  Cc: gcc-patches, richard.sandiford, Richard Earnshaw (lists),
	Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

On 19 March 2024 14:40:57 CET, Christophe Lyon <christophe.lyon@linaro.org> wrote:
>On Mon, 18 Mar 2024 at 22:35, Evgeny Karpov <Evgeny.Karpov@microsoft.com> wrote:
>>
>> Monday, March 18, 2024 2:27 PM
>> Christophe Lyon wrote:
>>
>> > > +/* Disable SEH and declare the required SEH-related macros that are
>> > > +still needed for compilation.  */ #undef TARGET_SEH #define
>> > > +TARGET_SEH 0
>> > > +
>> > > +#define SSE_REGNO_P(N) 0
>> > > +#define GENERAL_REGNO_P(N) 0
>> > I think you forgot to add a comment to explain the above two lines.
>> > (it was requested during v1 review)
>> >
>> > Thanks,
>> >
>> > Christophe
>>
>> Hi Christophe,
>>
>> Thank you for the review!
>> The comment regarding SEH and SEH-related macros has been added two lines above.
>> It may not be obvious, but these macros are needed to emit SEH data in mingw/winnt.cc.
>> This group is separated by an empty line; however, it still relates to SEH-related macros.
>>
>Thanks for the clarification, I thought that comment only applied to
>the two lines about TARGET_SEH.

So, for avoidance of doubt, please drop the vertical space before SSE_REGNO_P to be gentle to the casual/inattentive reader?

Or add /* SEH-related */ after the vertical space, to make it clear?

thanks

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PING][PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-03-07 20:47 ` Evgeny Karpov
  2024-03-18 13:33   ` Christophe Lyon
  2024-03-18 22:10   ` Evgeny Karpov
@ 2024-03-21 10:28   ` Evgeny Karpov
  2 siblings, 0 replies; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-21 10:28 UTC (permalink / raw)
  To: gcc-patches, richard.sandiford, Richard Earnshaw (lists)
  Cc: richard.sandiford, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

On Thursday, March 7, 2024 9:48 PM
Evgeny Karpov wrote:

> > Changes from v1 to v2:
> > Adjust the target name to aarch64-*-mingw* to exclude the big-endian
> > target from support.
> > Exclude 64-bit ISA.

> > Update commit descriptions to follow standard style.
> > Rebase from 4th March 2024.
> 
> Hello,
> 
> It looks like the initial feedback has been addressed.
> While unit testing for the x86_64-w64-mingw32 target is still in progress, the
> first 4 patches do not obviously change other targets, including aarch64-linux-
> gnu.
> Could they be merged once stage 1 starts, or could it be done even now?
> Thanks!
> 
> Regards,
> Evgeny

Hello,

The original question was about merging the first 4 patches from the series. 
Since then, we have obtained regression tests https://gcc.gnu.org/pipermail/gcc-patches/2024-March/648086.html .
It appears that it would be safe to merge the entire series without breaking other targets.

Regards,
Evgeny


^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 02/13] aarch64: The aarch64-w64-mingw32 target implements
  2024-03-04 17:33 ` [PATCH v2 02/13] aarch64: The aarch64-w64-mingw32 target implements Evgeny Karpov
@ 2024-04-10 18:17   ` Richard Sandiford
  0 siblings, 0 replies; 40+ messages in thread
From: Richard Sandiford @ 2024-04-10 18:17 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

Sorry for the slow reply.

Evgeny Karpov <Evgeny.Karpov@microsoft.com> writes:
> From: Zac Walker <zacwalker@microsoft.com>
> Date: Fri, 1 Mar 2024 01:45:13 +0100
> Subject: [PATCH v2 02/13] aarch64: The aarch64-w64-mingw32 target implements
>  the MS ABI
>
> Two ABIs for aarch64 have been defined for different platforms.
>
> gcc/ChangeLog:
>
> 	* config/aarch64/aarch64-opts.h (enum aarch64_calling_abi):
> 	Define two ABIs.
> ---
>  gcc/config/aarch64/aarch64-opts.h | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/gcc/config/aarch64/aarch64-opts.h b/gcc/config/aarch64/aarch64-opts.h
> index a05c0d3ded1..52c9e4596d6 100644
> --- a/gcc/config/aarch64/aarch64-opts.h
> +++ b/gcc/config/aarch64/aarch64-opts.h
> @@ -131,4 +131,11 @@ enum aarch64_early_ra_scope {
>    AARCH64_EARLY_RA_NONE
>  };
>  
> +/* Available call ABIs.  */
> +enum aarch64_calling_abi
> +{
> +  AARCH64_CALLING_ABI_EABI,
> +  AARCH64_CALLING_ABI_MS
> +};
> +
>  #endif

Thanks for removing the MS_ABI uses.  However, I'm still a bit uneasy
about this.  We already have a way of categorising ABIs (arm_pcs)
and it's not clear how this new enum would interact with it.  We also
have infrastructure for recording the arm_pcs for each call, including
in RTL insns.  Would we need to do the same for this classification?

It seems like the enum is currently unused.  At least, I was able
to build successfully with:

diff --git a/gcc/config/aarch64/aarch64-opts.h b/gcc/config/aarch64/aarch64-opts.h
index 52c9e4596d6..a05c0d3ded1 100644
--- a/gcc/config/aarch64/aarch64-opts.h
+++ b/gcc/config/aarch64/aarch64-opts.h
@@ -131,11 +131,4 @@ enum aarch64_early_ra_scope {
   AARCH64_EARLY_RA_NONE
 };
 
-/* Available call ABIs.  */
-enum aarch64_calling_abi
-{
-  AARCH64_CALLING_ABI_EABI,
-  AARCH64_CALLING_ABI_MS
-};
-
 #endif
diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h
index 2f239c42a89..902539763bd 100644
--- a/gcc/config/aarch64/cygming.h
+++ b/gcc/config/aarch64/cygming.h
@@ -43,9 +43,6 @@ still needed for compilation.  */
 #define GENERAL_REGNO_P(N) 0
 #define SEH_MAX_FRAME_SIZE 0
 
-#undef DEFAULT_ABI
-#define DEFAULT_ABI AARCH64_CALLING_ABI_MS
-
 #undef TARGET_PECOFF
 #define TARGET_PECOFF 1
 
diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h
index 040c3e1e521..08f1b5f0696 100644
--- a/gcc/config/mingw/mingw32.h
+++ b/gcc/config/mingw/mingw32.h
@@ -19,9 +19,7 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #undef DEFAULT_ABI
-#if defined (TARGET_AARCH64_MS_ABI)
-# define DEFAULT_ABI AARCH64_CALLING_ABI_MS
-#else
+#if !defined (TARGET_AARCH64_MS_ABI)
 # define DEFAULT_ABI MS_ABI
 #endif
 
Would you be happy with that for now?  We can then revisit this
later when the information is needed.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 03/13] aarch64: Mark x18 register as a fixed register for MS ABI
  2024-03-04 17:36 ` [PATCH v2 03/13] aarch64: Mark x18 register as a fixed register for MS ABI Evgeny Karpov
@ 2024-04-10 18:25   ` Richard Sandiford
  0 siblings, 0 replies; 40+ messages in thread
From: Richard Sandiford @ 2024-04-10 18:25 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

Evgeny Karpov <Evgeny.Karpov@microsoft.com> writes:
> From: Zac Walker <zacwalker@microsoft.com>
> Date: Fri, 1 Mar 2024 09:56:59 +0100
> Subject: [PATCH v2 03/13] aarch64: Mark x18 register as a fixed register for
>  MS ABI
>
> Define the MS ABI for aarch64-w64-mingw32.
> Adjust FIXED_REGISTERS, CALL_REALLY_USED_REGISTERS and
> STATIC_CHAIN_REGNUM for AArch64 MS ABI.
> The X18 register is reserved on Windows for the TEB.
>
> gcc/ChangeLog:
>
> 	* config.gcc: Define TARGET_AARCH64_MS_ABI when
> 	AArch64 MS ABI is used.
> 	* config/aarch64/aarch64-abi-ms.h: New file. Adjust
> 	FIXED_REGISTERS, CALL_REALLY_USED_REGISTERS and
> 	STATIC_CHAIN_REGNUM for AArch64 MS ABI.
> ---
>  gcc/config.gcc                      |  1 +
>  gcc/config/aarch64/aarch64-abi-ms.h | 64 +++++++++++++++++++++++++++++
>  2 files changed, 65 insertions(+)
>  create mode 100644 gcc/config/aarch64/aarch64-abi-ms.h
>
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index 2756377e50b..b762393b64c 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -1265,6 +1265,7 @@ aarch64*-*-linux*)
>  	TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
>  	;;
>  aarch64-*-mingw*)
> +	tm_file="${tm_file} aarch64/aarch64-abi-ms.h"
>  	tmake_file="${tmake_file} aarch64/t-aarch64"
>  	case ${enable_threads} in
>  	  "" | yes | win32)
> diff --git a/gcc/config/aarch64/aarch64-abi-ms.h b/gcc/config/aarch64/aarch64-abi-ms.h
> new file mode 100644
> index 00000000000..90b0dcc5edf
> --- /dev/null
> +++ b/gcc/config/aarch64/aarch64-abi-ms.h
> @@ -0,0 +1,64 @@
> +/* Machine description for AArch64 MS ABI.
> +   Copyright (C) 2024 Free Software Foundation, Inc.
> +
> +This file is part of GCC.
> +
> +GCC is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 3, or (at your option)
> +any later version.
> +
> +GCC is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +GNU General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GCC; see the file COPYING3.  If not see
> +<http://www.gnu.org/licenses/>.  */
> +
> +#ifndef GCC_AARCH64_ABI_MS_H
> +#define GCC_AARCH64_ABI_MS_H
> +
> +/* X18 reserved for the TEB on Windows.  */
> +
> +#undef FIXED_REGISTERS
> +#define FIXED_REGISTERS					\
> +  {							\
> +    0, 0, 0, 0,   0, 0, 0, 0,	/* R0 - R7.  */		\
> +    0, 0, 0, 0,   0, 0, 0, 0,	/* R8 - R15.  */	\
> +    0, 0, 1, 0,   0, 0, 0, 0,	/* R16 - R23.  */	\
> +    0, 0, 0, 0,   0, 1, 0, 1,	/* R24 - R30, SP.  */	\
> +    0, 0, 0, 0,   0, 0, 0, 0,	/* V0 - V7.  */		\
> +    0, 0, 0, 0,   0, 0, 0, 0,   /* V8 - V15.  */	\
> +    0, 0, 0, 0,   0, 0, 0, 0,   /* V16 - V23.  */	\
> +    0, 0, 0, 0,   0, 0, 0, 0,   /* V24 - V31.  */	\
> +    1, 1, 1, 1,			/* SFP, AP, CC, VG.  */	\
> +    0, 0, 0, 0,   0, 0, 0, 0,	/* P0 - P7.  */		\
> +    0, 0, 0, 0,   0, 0, 0, 0,   /* P8 - P15.  */	\
> +    1, 1,			/* FFR and FFRT.  */	\
> +    1, 1, 1, 1, 1, 1, 1, 1	/* Fake registers.  */	\
> +  }
> +
> +#undef CALL_REALLY_USED_REGISTERS
> +#define CALL_REALLY_USED_REGISTERS			\
> +  {							\
> +    1, 1, 1, 1,   1, 1, 1, 1,	/* R0 - R7.  */		\
> +    1, 1, 1, 1,   1, 1, 1, 1,	/* R8 - R15.  */	\
> +    1, 1, 0, 0,   0, 0, 0, 0,   /* R16 - R23.  */	\
> +    0, 0, 0, 0,   0, 1, 1, 1,	/* R24 - R30, SP.  */	\
> +    1, 1, 1, 1,   1, 1, 1, 1,	/* V0 - V7.  */		\
> +    0, 0, 0, 0,   0, 0, 0, 0,	/* V8 - V15.  */	\
> +    1, 1, 1, 1,   1, 1, 1, 1,   /* V16 - V23.  */	\
> +    1, 1, 1, 1,   1, 1, 1, 1,   /* V24 - V31.  */	\
> +    1, 1, 1, 0,			/* SFP, AP, CC, VG.  */	\
> +    1, 1, 1, 1,   1, 1, 1, 1,	/* P0 - P7.  */		\
> +    1, 1, 1, 1,   1, 1, 1, 1,	/* P8 - P15.  */	\
> +    1, 1,			/* FFR and FFRT.  */	\
> +    0, 0, 0, 0, 0, 0, 0, 0	/* Fake registers.  */	\
> +  }
> +
> +#undef  STATIC_CHAIN_REGNUM
> +#define STATIC_CHAIN_REGNUM R17_REGNUM
> +
> +#endif /* GCC_AARCH64_ABI_MS_H.  */

Gah, I think there was a miscommunication, sorry.  The way I'd interpreted
Richard's comment:

> +/* X18 reserved for the TEB on Windows.  */
> +#ifdef TARGET_ARM64_MS_ABI
> +# define FIXED_X18 1
> +# define CALL_USED_X18 0
> +#else
> +# define FIXED_X18 0
> +# define CALL_USED_X18 1
> +#endif
>
> I'm not overly keen on ifdefs like this (and the one below), it can
> get quite confusing if we have to support more than a couple of ABIs.
> Perhaps we could create a couple of new headers, one for the EABI
> (which all existing targets would then need to include) and one for
> the MS ABI.  Then the mingw port would use that instead of the EABI
> header.

was that aarch64.h should have:

#define FIXED_X18 0
#define CALL_USED_X18 1

and then aarch64-abi-ms.h should have:

#undef FIXED_X18
#define FIXED_X18 1

#undef CALL_USED_X18
#define CALL_USED_X18 0

similarly to STATIC_CHAIN_REGNUM.  The goal is to keep aarch64.h "generic"
and have the port-specific files define the variations.

At least, that's what I'd prefer.  It's certainly better not to
duplicate the whole of FIXED_REGISTERS, since there's a risk that
non-aarch64.h versions could get out of sync.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 04/13] aarch64: Add aarch64-w64-mingw32 COFF
  2024-03-04 17:39 ` [PATCH v2 04/13] aarch64: Add aarch64-w64-mingw32 COFF Evgeny Karpov
@ 2024-04-10 18:31   ` Richard Sandiford
  0 siblings, 0 replies; 40+ messages in thread
From: Richard Sandiford @ 2024-04-10 18:31 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

Evgeny Karpov <Evgeny.Karpov@microsoft.com> writes:
> From: Zac Walker <zacwalker@microsoft.com>
> Date: Fri, 1 Mar 2024 01:55:47 +0100
> Subject: [PATCH v2 04/13] aarch64: Add aarch64-w64-mingw32 COFF
>
> Define ASM specific for COFF format on AArch64.
>
> gcc/ChangeLog:
>
> 	* config.gcc: Add COFF format support definitions.
> 	* config/aarch64/aarch64-coff.h: New file.
> ---
>  gcc/config.gcc                    |  1 +
>  gcc/config/aarch64/aarch64-coff.h | 91 +++++++++++++++++++++++++++++++
>  2 files changed, 92 insertions(+)
>  create mode 100644 gcc/config/aarch64/aarch64-coff.h
>
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index b762393b64c..cb6661f44ef 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -1266,6 +1266,7 @@ aarch64*-*-linux*)
>  	;;
>  aarch64-*-mingw*)
>  	tm_file="${tm_file} aarch64/aarch64-abi-ms.h"
> +	tm_file="${tm_file} aarch64/aarch64-coff.h"
>  	tmake_file="${tmake_file} aarch64/t-aarch64"
>  	case ${enable_threads} in
>  	  "" | yes | win32)
> diff --git a/gcc/config/aarch64/aarch64-coff.h b/gcc/config/aarch64/aarch64-coff.h
> new file mode 100644
> index 00000000000..79c5a43b970
> --- /dev/null
> +++ b/gcc/config/aarch64/aarch64-coff.h
> @@ -0,0 +1,91 @@
> +/* Machine description for AArch64 architecture.
> +   Copyright (C) 2024 Free Software Foundation, Inc.
> +
> +   This file is part of GCC.
> +
> +   GCC is free software; you can redistribute it and/or modify it
> +   under the terms of the GNU General Public License as published by
> +   the Free Software Foundation; either version 3, or (at your option)
> +   any later version.
> +
> +   GCC is distributed in the hope that it will be useful, but
> +   WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with GCC; see the file COPYING3.  If not see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef GCC_AARCH64_COFF_H
> +#define GCC_AARCH64_COFF_H
> +
> +#include "aarch64.h"

Is this needed?  It looks like aarch64-coff.h comes after aarch64.h
in the include list, so I'd have expected the #include to be a no-op.

If you want to emphasise that this file must be included after aarch64.h
then perhaps:

#if !defined(GCC_AARCH64_H)
#error This file must be included after aarch64.h
#endif

would work.  But it should also be ok just to drop the include without
replacing it with anything.

> +
> +#ifndef LOCAL_LABEL_PREFIX
> +# define LOCAL_LABEL_PREFIX 	""
> +#endif
> +
> +/* Using long long breaks -ansi and -std=c90, so these will need to be
> +   made conditional for an LLP64 ABI.  */
> +#undef SIZE_TYPE
> +#define SIZE_TYPE	"long long unsigned int"
> +
> +#undef PTRDIFF_TYPE
> +#define PTRDIFF_TYPE	"long long int"
> +
> +#undef LONG_TYPE_SIZE
> +#define LONG_TYPE_SIZE 32
> +
> +#ifndef ASM_GENERATE_INTERNAL_LABEL
> +# define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM)  \
> +  sprintf (STRING, "*%s%s%u", LOCAL_LABEL_PREFIX, PREFIX, (unsigned int)(NUM))
> +#endif
> +
> +#define ASM_OUTPUT_ALIGN(STREAM, POWER)		\
> +  fprintf (STREAM, "\t.align\t%d\n", (int)POWER)
> +
> +/* Output a common block.  */
> +#ifndef ASM_OUTPUT_COMMON
> +# define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED)	\
> +    {							\
> +      fprintf (STREAM, "\t.comm\t");			\
> +      assemble_name (STREAM, NAME);			\
> +      asm_fprintf (STREAM, ", %d, %d\n", 		\
> +      (int)(ROUNDED), (int)(SIZE));	\
> +    }
> +#endif
> +
> +/* Output a local common block.  /bin/as can't do this, so hack a
> +   `.space' into the bss segment.  Note that this is *bad* practice,
> +   which is guaranteed NOT to work since it doesn't define STATIC
> +   COMMON space but merely STATIC BSS space.  */
> +#ifndef ASM_OUTPUT_ALIGNED_LOCAL
> +# define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN)		\
> +    {									\
> +      switch_to_section (bss_section);					\
> +      ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT));	\
> +      ASM_OUTPUT_LABEL (STREAM, NAME);					\
> +      fprintf (STREAM, "\t.space\t%d\n", (int)(SIZE));			\
> +    }
> +#endif
> +
> +#define ASM_OUTPUT_SKIP(STREAM, NBYTES) 	\
> +  fprintf (STREAM, "\t.space\t%d  // skip\n", (int) (NBYTES))
> +
> +#define ASM_OUTPUT_TYPE_DIRECTIVE(STREAM, NAME, TYPE)
> +#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)

Just curious: are these empty definitions the final intended
definitions, or are they just temporary?  Might be worth a comment
either way.

Thanks,
Richard

> +
> +#define TEXT_SECTION_ASM_OP	"\t.text"
> +#define DATA_SECTION_ASM_OP	"\t.data"
> +#define BSS_SECTION_ASM_OP	"\t.bss"
> +
> +#define CTORS_SECTION_ASM_OP	"\t.section\t.ctors, \"aw\""
> +#define DTORS_SECTION_ASM_OP	"\t.section\t.dtors, \"aw\""
> +
> +#define GLOBAL_ASM_OP "\t.global\t"
> +
> +#undef SUPPORTS_INIT_PRIORITY
> +#define SUPPORTS_INIT_PRIORITY 0
> +
> +#endif

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64
  2024-03-04 17:44 ` [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64 Evgeny Karpov
  2024-03-18 13:26   ` Christophe Lyon
  2024-03-18 21:35   ` Evgeny Karpov
@ 2024-04-10 18:34   ` Richard Sandiford
  2 siblings, 0 replies; 40+ messages in thread
From: Richard Sandiford @ 2024-04-10 18:34 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

Evgeny Karpov <Evgeny.Karpov@microsoft.com> writes:
> From: Zac Walker <zacwalker@microsoft.com>
> Date: Fri, 1 Mar 2024 10:49:28 +0100
> Subject: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for
>  AArch64
>
> Define Cygwin and MinGW environment such as types, SEH definitions,
> shared libraries, etc.
>
> gcc/ChangeLog:
>
> 	* config.gcc: Add Cygwin and MinGW difinitions.
> 	* config/aarch64/aarch64-protos.h
> 	(mingw_pe_maybe_record_exported_symbol): Declare functions
> 	which are used in Cygwin and MinGW environment.
> 	(mingw_pe_section_type_flags): Likewise.
> 	(mingw_pe_unique_section): Likewise.
> 	(mingw_pe_encode_section_info): Likewise.
> 	* config/aarch64/cygming.h: New file.
> ---
>  gcc/config.gcc                      |   4 +
>  gcc/config/aarch64/aarch64-protos.h |   5 +
>  gcc/config/aarch64/cygming.h        | 175 ++++++++++++++++++++++++++++
>  3 files changed, 184 insertions(+)
>  create mode 100644 gcc/config/aarch64/cygming.h
>
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index 3aca257c322..4471599454b 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -1267,7 +1267,11 @@ aarch64*-*-linux*)
>  aarch64-*-mingw*)
>  	tm_file="${tm_file} aarch64/aarch64-abi-ms.h"
>  	tm_file="${tm_file} aarch64/aarch64-coff.h"
> +	tm_file="${tm_file} aarch64/cygming.h"
> +	tm_file="${tm_file} mingw/mingw32.h"
> +	tm_file="${tm_file} mingw/mingw-stdint.h"
>  	tmake_file="${tmake_file} aarch64/t-aarch64"
> +	target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
>  	case ${enable_threads} in
>  	  "" | yes | win32)
>  	    thread_file='win32'
> diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
> index bd719b992a5..759e1a0f9da 100644
> --- a/gcc/config/aarch64/aarch64-protos.h
> +++ b/gcc/config/aarch64/aarch64-protos.h
> @@ -1110,6 +1110,11 @@ extern void aarch64_output_patchable_area (unsigned int, bool);
>  
>  extern void aarch64_adjust_reg_alloc_order ();
>  
> +extern void mingw_pe_maybe_record_exported_symbol (tree, const char *, int);
> +extern unsigned int mingw_pe_section_type_flags (tree, const char *, int);
> +extern void mingw_pe_unique_section (tree, int);
> +extern void mingw_pe_encode_section_info (tree, rtx, int);
> +
>  bool aarch64_optimize_mode_switching (aarch64_mode_entity);
>  void aarch64_restore_za (rtx);
>  
> diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h
> new file mode 100644
> index 00000000000..2f239c42a89
> --- /dev/null
> +++ b/gcc/config/aarch64/cygming.h
> @@ -0,0 +1,175 @@
> +/* Operating system specific defines to be used when targeting GCC for
> +   hosting on Windows32, using a Unix style C library and tools.
> +   Copyright (C) 1995-2024 Free Software Foundation, Inc.
> +
> +This file is part of GCC.
> +
> +GCC is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 3, or (at your option)
> +any later version.
> +
> +GCC is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +GNU General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GCC; see the file COPYING3.  If not see
> +<http://www.gnu.org/licenses/>.  */
> +
> +#ifndef GCC_AARCH64_CYGMING_H
> +#define GCC_AARCH64_CYGMING_H
> +
> +#undef PREFERRED_DEBUGGING_TYPE
> +#define PREFERRED_DEBUGGING_TYPE DINFO_TYPE_NONE
> +
> +#define FASTCALL_PREFIX '@'
> +
> +#define print_reg(rtx, code, file)

How about:

#define print_reg(rtx, code, file) (gcc_unreachable ())

so that attempts to use this are a noisy runtime failure?

> +#define SYMBOL_FLAG_DLLIMPORT 0
> +#define SYMBOL_FLAG_DLLEXPORT 0
> +
> +#define SYMBOL_REF_DLLEXPORT_P(X) \
> +	((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLEXPORT) != 0)
> +
> +/* Disable SEH and declare the required SEH-related macros that are
> +still needed for compilation.  */
> +#undef TARGET_SEH
> +#define TARGET_SEH 0
> +
> +#define SSE_REGNO_P(N) 0
> +#define GENERAL_REGNO_P(N) 0
> +#define SEH_MAX_FRAME_SIZE 0

Similarly here, how about:

#define SSE_REGNO_P(N) (gcc_unreachable (), 0)
#define GENERAL_REGNO_P(N) (gcc_unreachable (), 0)
#define SEH_MAX_FRAME_SIZE (gcc_unreachable (), 0)

Thanks,
Richard

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 10/13] Rename "x86 Windows Options" to "Cygwin and MinGW Options"
  2024-03-04 17:46 ` [PATCH v2 10/13] Rename "x86 Windows Options" to "Cygwin and MinGW Options" Evgeny Karpov
@ 2024-04-10 18:35   ` Richard Sandiford
  0 siblings, 0 replies; 40+ messages in thread
From: Richard Sandiford @ 2024-04-10 18:35 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

Evgeny Karpov <Evgeny.Karpov@microsoft.com> writes:
> From: Zac Walker <zacwalker@microsoft.com>
> Date: Fri, 1 Mar 2024 02:17:39 +0100
> Subject: [PATCH v2 10/13] Rename "x86 Windows Options" to "Cygwin and MinGW
>  Options"
>
> Rename "x86 Windows Options" to "Cygwin and MinGW Options".
> It will be used also for AArch64.
>
> gcc/ChangeLog:
>
> 	* config/i386/mingw-w64.opt.urls: Rename options' name and
> 	regenerate option URLs.
> 	* config/lynx.opt.urls: Likewise.
> 	* config/mingw/cygming.opt.urls: Likewise.
> 	* config/mingw/mingw.opt.urls: Likewise.
> 	* doc/invoke.texi: Likewise.
> ---
>  gcc/config/i386/mingw-w64.opt.urls |  2 +-
>  gcc/config/lynx.opt.urls           |  2 +-
>  gcc/config/mingw/cygming.opt.urls  | 18 +++++++++---------
>  gcc/config/mingw/mingw.opt.urls    |  2 +-
>  gcc/doc/invoke.texi                | 12 ++++++++++--
>  5 files changed, 22 insertions(+), 14 deletions(-)
>
> diff --git a/gcc/config/i386/mingw-w64.opt.urls b/gcc/config/i386/mingw-w64.opt.urls
> index 6bb53ef29b2..5cceba1d1a1 100644
> --- a/gcc/config/i386/mingw-w64.opt.urls
> +++ b/gcc/config/i386/mingw-w64.opt.urls
> @@ -1,5 +1,5 @@
>  ; Autogenerated by regenerate-opt-urls.py from gcc/config/i386/mingw-w64.opt and generated HTML
>  
>  municode
> -UrlSuffix(gcc/x86-Windows-Options.html#index-municode)
> +UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-municode)
>  
> diff --git a/gcc/config/lynx.opt.urls b/gcc/config/lynx.opt.urls
> index 63e7b9c4b33..b547138f7ff 100644
> --- a/gcc/config/lynx.opt.urls
> +++ b/gcc/config/lynx.opt.urls
> @@ -1,5 +1,5 @@
>  ; Autogenerated by regenerate-opt-urls.py from gcc/config/lynx.opt and generated HTML
>  
>  mthreads
> -UrlSuffix(gcc/x86-Windows-Options.html#index-mthreads-1)
> +UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mthreads-1)
>  
> diff --git a/gcc/config/mingw/cygming.opt.urls b/gcc/config/mingw/cygming.opt.urls
> index 87799befe3c..c624e22e442 100644
> --- a/gcc/config/mingw/cygming.opt.urls
> +++ b/gcc/config/mingw/cygming.opt.urls
> @@ -1,30 +1,30 @@
>  ; Autogenerated by regenerate-opt-urls.py from gcc/config/i386/cygming.opt and generated HTML
>  
>  mconsole
> -UrlSuffix(gcc/x86-Windows-Options.html#index-mconsole)
> +UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mconsole)
>  
>  mdll
> -UrlSuffix(gcc/x86-Windows-Options.html#index-mdll)
> +UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mdll)
>  
>  mnop-fun-dllimport
> -UrlSuffix(gcc/x86-Windows-Options.html#index-mnop-fun-dllimport)
> +UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mnop-fun-dllimport)
>  
>  ; skipping UrlSuffix for 'mthreads' due to multiple URLs:
> +;   duplicate: 'gcc/Cygwin-and-MinGW-Options.html#index-mthreads-1'
>  ;   duplicate: 'gcc/x86-Options.html#index-mthreads'
> -;   duplicate: 'gcc/x86-Windows-Options.html#index-mthreads-1'
>  
>  mwin32
> -UrlSuffix(gcc/x86-Windows-Options.html#index-mwin32)
> +UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mwin32)
>  
>  mwindows
> -UrlSuffix(gcc/x86-Windows-Options.html#index-mwindows)
> +UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mwindows)
>  
>  mpe-aligned-commons
> -UrlSuffix(gcc/x86-Windows-Options.html#index-mpe-aligned-commons)
> +UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mpe-aligned-commons)
>  
>  fset-stack-executable
> -UrlSuffix(gcc/x86-Windows-Options.html#index-fno-set-stack-executable)
> +UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-fno-set-stack-executable)
>  
>  fwritable-relocated-rdata
> -UrlSuffix(gcc/x86-Windows-Options.html#index-fno-writable-relocated-rdata)
> +UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-fno-writable-relocated-rdata)
>  
> diff --git a/gcc/config/mingw/mingw.opt.urls b/gcc/config/mingw/mingw.opt.urls
> index 2cbbaadf310..f8ee5be6a53 100644
> --- a/gcc/config/mingw/mingw.opt.urls
> +++ b/gcc/config/mingw/mingw.opt.urls
> @@ -1,7 +1,7 @@
>  ; Autogenerated by regenerate-opt-urls.py from gcc/config/i386/mingw.opt and generated HTML
>  
>  mcrtdll=
> -UrlSuffix(gcc/x86-Windows-Options.html#index-mcrtdll)
> +UrlSuffix(gcc/Cygwin-and-MinGW-Options.html#index-mcrtdll)
>  
>  ; skipping UrlSuffix for 'pthread' due to multiple URLs:
>  ;   duplicate: 'gcc/Link-Options.html#index-pthread-1'
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index bdf05be387d..e2e473e095f 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -1493,6 +1493,8 @@ See RS/6000 and PowerPC Options.
>  -munroll-only-small-loops -mlam=@var{choice}}
>  
>  @emph{x86 Windows Options}
> +
> +@emph{Cygwin and MinGW Options}
>  @gccoptlist{-mconsole  -mcrtdll=@var{library}  -mdll
>  -mnop-fun-dllimport  -mthread
>  -municode  -mwin32  -mwindows  -fno-set-stack-executable}
> @@ -20976,6 +20978,7 @@ platform.
>  * C6X Options::
>  * CRIS Options::
>  * C-SKY Options::
> +* Cygwin and MinGW Options::
>  * Darwin Options::
>  * DEC Alpha Options::
>  * eBPF Options::
> @@ -36112,8 +36115,13 @@ positions 62:57 can be used for metadata.
>  
>  @node x86 Windows Options
>  @subsection x86 Windows Options
> -@cindex x86 Windows Options
> -@cindex Windows Options for x86

The old index entries are probably worth keeping.

Looks good otherwise.

Thanks,
Richard

> +
> +@xref{Cygwin and MinGW Options}.
> +
> +@node Cygwin and MinGW Options
> +@subsection Cygwin and MinGW Options
> +@cindex Cygwin and MinGW Options
> +@cindex Options for Cygwin and MinGW
>  
>  These additional options are available for Microsoft Windows targets:

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
                   ` (16 preceding siblings ...)
  2024-03-18 21:05 ` [PATCH " Radek Barton
@ 2024-04-10 18:40 ` Richard Sandiford
  2024-04-11 14:14   ` Evgeny Karpov
  17 siblings, 1 reply; 40+ messages in thread
From: Richard Sandiford @ 2024-04-10 18:40 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

Evgeny Karpov <Evgeny.Karpov@microsoft.com> writes:
> Hello,
>
> v2 is ready for the review!
> Based on the v1 review: https://gcc.gnu.org/pipermail/gcc-patches/2024-February/thread.html#646203
>
> Testing for the x86_64-w64-mingw32 target is in progress to avoid
> regression due to refactoring.

Thanks for the updates and sorry again for the slow review.
I've replied to some of the patches in the series but otherwise
it looks good to me.

If you agree with the suggested changes then the series is OK for
stage 1, assuming no objections from those with an interest in the
x86 cygwin/mingw port.

Richard

> Regards,
> Evgeny
>
>
> Changes from v1 to v2:
> Adjust the target name to aarch64-*-mingw* to exclude the big-endian
> target from support.
> Exclude 64-bit ISA.
> Rename enum calling_abi to aarch64_calling_abi.
> Move AArch64 MS ABI definitions FIXED_REGISTERS,
> CALL_REALLY_USED_REGISTERS, and STATIC_CHAIN_REGNUM from aarch64.h 
> to aarch64-abi-ms.h.
> Rename TARGET_ARM64_MS_ABI to TARGET_AARCH64_MS_ABI.
> Exclude TARGET_64BIT from the aarch64 target.
> Exclude HAVE_GAS_WEAK.
> Set HAVE_GAS_ALIGNED_COMM to 1 by default.
> Use a reference from "x86 Windows Options" to 
> "Cygwin and MinGW Options".
> Update commit descriptions to follow standard style.
> Rebase from 4th March 2024.

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-04-10 18:40 ` Richard Sandiford
@ 2024-04-11 14:14   ` Evgeny Karpov
  2024-04-11 14:34     ` Richard Sandiford
  0 siblings, 1 reply; 40+ messages in thread
From: Evgeny Karpov @ 2024-04-11 14:14 UTC (permalink / raw)
  To: Richard Sandiford
  Cc: gcc-patches, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton


Wednesday, April 10, 2024 8:40 PM
Richard Sandiford <richard.sandiford@arm.com> wrote:

> Thanks for the updates and sorry again for the slow review.
> I've replied to some of the patches in the series but otherwise it looks good to
> me.
> 
> If you agree with the suggested changes then the series is OK for stage 1,
> assuming no objections from those with an interest in the
> x86 cygwin/mingw port.
> 
> Richard

Thank you, Richard, for the review!
v3 addresses all comments on v2.
https://gcc.gnu.org/pipermail/gcc-patches/2024-April/thread.html#649261

Regards,
Evgeny

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-04-11 14:14   ` Evgeny Karpov
@ 2024-04-11 14:34     ` Richard Sandiford
  0 siblings, 0 replies; 40+ messages in thread
From: Richard Sandiford @ 2024-04-11 14:34 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, Richard Earnshaw (lists), Andrew Pinski (QUIC),
	Maxim Kuvyrkov, Radek Barton

Evgeny Karpov <Evgeny.Karpov@microsoft.com> writes:
> Wednesday, April 10, 2024 8:40 PM
> Richard Sandiford <richard.sandiford@arm.com> wrote:
>
>> Thanks for the updates and sorry again for the slow review.
>> I've replied to some of the patches in the series but otherwise it looks good to
>> me.
>> 
>> If you agree with the suggested changes then the series is OK for stage 1,
>> assuming no objections from those with an interest in the
>> x86 cygwin/mingw port.
>> 
>> Richard
>
> Thank you, Richard, for the review!
> v3 addresses all comments on v2.
> https://gcc.gnu.org/pipermail/gcc-patches/2024-April/thread.html#649261

Thanks, the new series looks good to me.

Richard

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 00/13] Add aarch64-w64-mingw32 target
  2024-03-06  8:40 LIU Hao
@ 2024-03-06 14:20 ` Evgeny Karpov
  0 siblings, 0 replies; 40+ messages in thread
From: Evgeny Karpov @ 2024-03-06 14:20 UTC (permalink / raw)
  To: LIU Hao, GCC Patches

Wednesday, March 6, 2024
LIU Hao wrote:

> May I suggest you keep the mcf thread model for aarch-w64-mingw32? I
> requested Martin Storsjö to test it on a physical Windows 11 on ARM machine
> with Clang and all tests passed. I think it should work once the GCC support is
> complete.
> 
> 
> --
> Best regards,
> LIU Hao

The MCF thread model will be added to the aarch64-w64-mingw32 target
in the next patch series. Most probably, this will occur when the
mingw unit tests are integrated into the aarch64-w64-mingw32 target.

Regards,
Evgeny

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 00/13] Add aarch64-w64-mingw32 target
@ 2024-03-06  8:40 LIU Hao
  2024-03-06 14:20 ` Evgeny Karpov
  0 siblings, 1 reply; 40+ messages in thread
From: LIU Hao @ 2024-03-06  8:40 UTC (permalink / raw)
  To: Evgeny.Karpov, GCC Patches


[-- Attachment #1.1: Type: text/plain, Size: 274 bytes --]

May I suggest you keep the mcf thread model for aarch-w64-mingw32? I requested Martin Storsjö to 
test it on a physical Windows 11 on ARM machine with Clang and all tests passed. I think it should 
work once the GCC support is complete.


-- 
Best regards,
LIU Hao

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2024-04-11 14:34 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
2024-03-04 17:30 ` [PATCH v2 01/13] Introduce " Evgeny Karpov
2024-03-04 17:33 ` [PATCH v2 02/13] aarch64: The aarch64-w64-mingw32 target implements Evgeny Karpov
2024-04-10 18:17   ` Richard Sandiford
2024-03-04 17:36 ` [PATCH v2 03/13] aarch64: Mark x18 register as a fixed register for MS ABI Evgeny Karpov
2024-04-10 18:25   ` Richard Sandiford
2024-03-04 17:39 ` [PATCH v2 04/13] aarch64: Add aarch64-w64-mingw32 COFF Evgeny Karpov
2024-04-10 18:31   ` Richard Sandiford
2024-03-04 17:39 ` [PATCH v2 05/13] Reuse MinGW from i386 for AArch64 Evgeny Karpov
2024-03-04 17:41 ` [PATCH v2 06/13] Rename section and encoding functions from i386 which will be used in aarch64 Evgeny Karpov
2024-03-04 17:43 ` [PATCH v2 07/13] Exclude i386 functionality from aarch64 build Evgeny Karpov
2024-03-04 17:44 ` [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64 Evgeny Karpov
2024-03-18 13:26   ` Christophe Lyon
2024-03-18 21:35   ` Evgeny Karpov
2024-03-19 13:40     ` Christophe Lyon
2024-03-20 21:53       ` rep.dot.nop
2024-04-10 18:34   ` Richard Sandiford
2024-03-04 17:45 ` [PATCH v2 09/13] aarch64: Add SEH to machine_function Evgeny Karpov
2024-03-04 17:46 ` [PATCH v2 10/13] Rename "x86 Windows Options" to "Cygwin and MinGW Options" Evgeny Karpov
2024-04-10 18:35   ` Richard Sandiford
2024-03-04 17:49 ` [PATCH v2 11/13] aarch64: Build and add objects for Cygwin and MinGW for AArch64 Evgeny Karpov
2024-03-04 17:50 ` [PATCH v2 12/13] aarch64: Add aarch64-w64-mingw32 target to libatomic Evgeny Karpov
2024-03-04 17:51 ` [PATCH v2 13/13] Add aarch64-w64-mingw32 target to libgcc Evgeny Karpov
2024-03-04 17:55 ` [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
2024-03-04 19:25 ` Evgeny Karpov
2024-03-07 20:47 ` Evgeny Karpov
2024-03-18 13:33   ` Christophe Lyon
2024-03-18 22:10   ` Evgeny Karpov
2024-03-18 22:58     ` Fangrui Song
2024-03-18 23:22       ` Andrew Pinski
2024-03-19  7:50       ` Martin Storsjö
2024-03-21 10:28   ` [PING][PATCH " Evgeny Karpov
2024-03-18 21:05 ` [PATCH " Radek Barton
2024-03-20 11:50   ` Radek Barton
2024-03-20 19:37     ` NightStrike
2024-04-10 18:40 ` Richard Sandiford
2024-04-11 14:14   ` Evgeny Karpov
2024-04-11 14:34     ` Richard Sandiford
2024-03-06  8:40 LIU Hao
2024-03-06 14:20 ` Evgeny Karpov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).