Hi Evgeny,

I think the GDB parts need approval from GDB maintainers (thus cc'ing gdb-patches).

Thanks 
Christophe 



Le jeu. 29 oct. 2026, 21:27, Evgeny Karpov <evgeny.karpov@arm.com> a écrit :
The patch adds support for aarch64-pc-cygwin target.

Co-authored-by: Radek Barton <radek.barton@microsoft.com>
---
 bfd/config.bfd          | 2 +-
 binutils/configure      | 2 +-
 binutils/configure.ac   | 2 +-
 config.guess            | 3 +++
 gas/configure.tgt       | 3 ++-
 gdb/configure.host      | 1 +
 gdbserver/configure.srv | 9 +++++++++
 ld/configure.tgt        | 4 ++--
 ld/emultempl/pe.em      | 5 +++--
 ld/emultempl/pep.em     | 8 ++++++--
 10 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/bfd/config.bfd b/bfd/config.bfd
index 9900e5c7470..99e9bcd8316 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -254,7 +254,7 @@ case "${targ}" in
     targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec aarch64_pei_le_vec aarch64_pe_le_vec"
     want64=true
     ;;
-  aarch64-*-pe* | aarch64-*-mingw* | aarch64-*-windows*)
+  aarch64-*-pe* | aarch64-*-mingw* | aarch64-*-windows* | aarch64-*-cygwin*)
     targ_defvec=aarch64_pe_le_vec
     targ_selvecs="aarch64_pe_le_vec aarch64_pei_le_vec aarch64_pe_bigobj_le_vec aarch64_elf64_le_vec aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec pdb_vec"
     want64=true
diff --git a/binutils/configure b/binutils/configure
index c8202c3f3f0..c455cb4c0d9 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -16912,7 +16912,7 @@ do
     esac

     case $targ in
-    aarch64-*-pe* | aarch64-*-mingw*)
+    aarch64-*-pe* | aarch64-*-mingw* | aarch64-*-cygwin*)
        BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
        if test -z "$DLLTOOL_DEFAULT"; then
            DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_AARCH64"
diff --git a/binutils/configure.ac b/binutils/configure.ac
index ce6e85ac4a6..e9fda4f42bb 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -374,7 +374,7 @@ changequote([,])dnl
     esac

     case $targ in
-    aarch64-*-pe* | aarch64-*-mingw*)
+    aarch64-*-pe* | aarch64-*-mingw* | aarch64-*-cygwin*)
        BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
        if test -z "$DLLTOOL_DEFAULT"; then
            DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_AARCH64"
diff --git a/config.guess b/config.guess
index a9d01fde461..08e5cb3fabe 100755
--- a/config.guess
+++ b/config.guess
@@ -955,6 +955,9 @@ EOF
     i*:UWIN*:*)
        GUESS=$UNAME_MACHINE-pc-uwin
        ;;
+    aarch64:CYGWIN*:*:*)
+       GUESS=aarch64-pc-cygwin
+       ;;
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
        GUESS=x86_64-pc-cygwin
        ;;
diff --git a/gas/configure.tgt b/gas/configure.tgt
index ba3d1194ae9..47d5c09420c 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -139,7 +139,8 @@ case ${generic_target} in
   aarch64*-*-nto*)                     fmt=elf;;
   aarch64*-*-openbsd*)                 fmt=elf;;
   aarch64*-*-phoenix*)                 fmt=elf;;
-  aarch64*-*-pe* | aarch64*-*-mingw*)  fmt=coff em=pepaarch64 ;;
+  aarch64*-*-pe* | aarch64*-*-mingw* | aarch64*-*-cygwin*)
+    fmt=coff em=pepaarch64 ;;
   alpha-*-*vms*)                       fmt=evax ;;
   alpha-*-osf*)                                fmt=ecoff ;;
   alpha-*-linux*ecoff*)                        fmt=ecoff ;;
diff --git a/gdb/configure.host b/gdb/configure.host
index c93390b9171..ee9d340c59f 100644
--- a/gdb/configure.host
+++ b/gdb/configure.host
@@ -85,6 +85,7 @@ aarch64*-*-freebsd*)  gdb_host=fbsd ;;
 aarch64*-*-mingw*)     gdb_host=mingw64a
                        gdb_host_obs=mingw-hdep.o
                        ;;
+aarch64*-*-cygwin*)    gdb_host=cygwin64 ;;

 alpha*-*-linux*)       gdb_host=alpha-linux ;;
 alpha*-*-netbsdaout* | alpha*-*-knetbsdaout*-gnu)
diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv
index 5dfdcd7d999..f1a107d95ca 100644
--- a/gdbserver/configure.srv
+++ b/gdbserver/configure.srv
@@ -73,6 +73,15 @@ case "${gdbserver_host}" in
                        srv_tgtobj="${srv_tgtobj} nat/netbsd-nat.o"
                        srv_tgtobj="${srv_tgtobj} arch/aarch64-insn.o arch/aarch64.o"
                        ;;
+  aarch64-*-cygwin*)   srv_regobj=""
+                       srv_tgtobj="aarch64-low.o nat/aarch64-dregs.o"
+                       srv_tgtobj="${srv_tgtobj} nat/aarch64-xstate.o"
+                       srv_tgtobj="${srv_tgtobj} aarch64-fp.o"
+                       srv_tgtobj="${srv_tgtobj} win32-low.o"
+                       srv_tgtobj="${srv_tgtobj} win32-aarch64-low.o"
+                       srv_tgtobj="${srv_tgtobj} nat/windows-nat.o"
+                       srv_tgtobj="${srv_tgtobj} arch/aarch64.o"
+                       ;;
   arc*-*-linux*)
                        srv_regobj=""
                        srv_tgtobj="linux-arc-low.o arch/arc.o $srv_linux_obj"
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 55eb6e94b84..2496bc14659 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -125,7 +125,7 @@ aarch64-*-haiku*)   targ_emul=aarch64haiku
 aarch64-*-nto*)                targ_emul=aarch64nto
                        targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb"
                        ;;
-aarch64-*-pe* | aarch64-*-mingw*)
+aarch64-*-pe* | aarch64-*-mingw* | aarch64-*-cygwin*)
                        targ_emul=aarch64pe
                        targ_extra_emuls="arm64pe"
                        targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o pdb.o"
@@ -1055,7 +1055,7 @@ spu-*-elf*)
   NATIVE_LIB_DIRS='/lib'
   ;;

-i[03-9x]86-*-cygwin* | x86_64-*-cygwin*)
+i[03-9x]86-*-cygwin* | x86_64-*-cygwin* | aarch64-*-cygwin*)
   NATIVE_LIB_DIRS='/usr/lib /usr/lib/w32api'
   ;;

diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 1d02a86be96..d65dc6b286e 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -7,7 +7,7 @@ else
 fi

 case ${target} in
-  *-*-mingw*)
+  *-*-mingw* | aarch64-*-cygwin*)
     mingw_behavior=1
     ;;
   *)
@@ -70,7 +70,8 @@ EOF

 case ${target} in
   x86_64-*-mingw* | x86_64-*-pe | x86_64-*-pep | x86_64-*-cygwin | \
-  i[3-7]86-*-mingw32* | i[3-7]86-*-cygwin* | i[3-7]86-*-winnt | i[3-7]86-*-pe)
+  i[3-7]86-*-mingw32* | i[3-7]86-*-cygwin* | i[3-7]86-*-winnt | \
+  i[3-7]86-*-pe | aarch64-*-cygwin*)
 fragment <<EOF
 #include "pdb.h"
 EOF
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index de462cf3f02..847f182320d 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -7,6 +7,10 @@ else
 fi

 case ${target} in
+  aarch64-*-cygwin*)
+    move_default_addr_high=1
+    mingw_behavior=1
+    ;;
   *-*-cygwin*)
     move_default_addr_high=1
     mingw_behavior=0
@@ -83,8 +87,8 @@ EOF

 case ${target} in
   x86_64-*-mingw* | x86_64-*-pe | x86_64-*-pep | x86_64-*-cygwin | \
-  i[3-7]86-*-mingw32* | i[3-7]86-*-cygwin* | i[3-7]86-*-winnt | i[3-7]86-*-pe | \
-  aarch64-*-mingw* | aarch64-*-pe* )
+  i[3-7]86-*-mingw32* | i[3-7]86-*-cygwin* | i[3-7]86-*-winnt | \
+  i[3-7]86-*-pe | aarch64-*-mingw* | aarch64-*-pe* | aarch64-*-cygwin*)
 fragment <<EOF
 #include "pdb.h"
 EOF