aarch64: Introduce aarch64-pc-cygwin target

Message ID 20261029202614.37089-1-evgeny.karpov@arm.com
State New
Headers
Series aarch64: Introduce aarch64-pc-cygwin target |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 fail Patch failed to apply

Commit Message

Evgeny Karpov Oct. 29, 2026, 8:26 p.m. UTC
  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(-)
  

Comments

Christophe Lyon Oct. 29, 2026, 8:32 p.m. UTC | #1
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
>
  
Jan Beulich Oct. 30, 2026, 12:32 p.m. UTC | #2
On 29.10.2026 21:26, Evgeny Karpov wrote:
> The patch adds support for aarch64-pc-cygwin target.
> 
> Co-authored-by: Radek Barton <radek.barton@microsoft.com>

First of all, authorship-wise: How is this related to the earlier
submission by Dennis [1] ?

> --- 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 ;;

Nit: The fmt= still wants aligning with the others. There are a few other
examples where the line would be getting too long when everything would be
on one line.

> --- 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

No change to this file should be needed.

> --- 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

If I hadn't removed that line anyway, I'd ask that you please keep the ix86
line untouched.

Jan

[1] https://sourceware.org/pipermail/binutils/2026-September/151272.html
  
Luis Oct. 31, 2026, 12:49 p.m. UTC | #3
I don´t think we have a maintainer for pc-cygwin/Windows on aarch64.

On 29/10/2026 20:32, Christophe Lyon wrote:
> 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 
> <mailto:evgeny.karpov@arm.com>> a écrit :
> 
>     The patch adds support for aarch64-pc-cygwin target.
> 
>     Co-authored-by: Radek Barton <radek.barton@microsoft.com
>     <mailto:radek.barton@microsoft.com>>
>     ---
>       bfd/config.bfd          | 2 +-
>       binutils/configure      | 2 +-
>       binutils/configure.ac <http://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 <http://configure.ac> b/binutils/
>     configure.ac <http://configure.ac>
>     index ce6e85ac4a6..e9fda4f42bb 100644
>     --- a/binutils/configure.ac <http://configure.ac>
>     +++ b/binutils/configure.ac <http://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
>
  
Evgeny Karpov Nov. 4, 2026, 1:39 p.m. UTC | #4
On Fri, 30 Oct 2026, Jan Beulich wrote:
> > The patch adds support for aarch64-pc-cygwin target.
> > 
> > Co-authored-by: Radek Barton <radek.barton@microsoft.com>
> 
> First of all, authorship-wise: How is this related to the earlier
> submission by Dennis [1] ?

This patch is based on work that has been done by Radek Barton
<radek.barton@microsoft.com> and me. The initial patch was submitted as part of
a bundle to the mailing list.
https://sourceware.org/pipermail/binutils/2025-November/145298.html
This submission has a few changes on top of that, which were made by the same
authors.

> >    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 ;;
> 
> Nit: The fmt= still wants aligning with the others. There are a few other
> examples where the line would be getting too long when everything would be
> on one line.

It will be changed.

> >    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
> 
> No change to this file should be needed.

It makes sense after this patch.
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ed4bbf96832daa18d88e5398daee1e79818e5f64

> > -  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
> 
> If I hadn't removed that line anyway, I'd ask that you please keep the ix86
> line untouched.

Ok, that line will remain unchanged in the next version.

Regards,
Evgeny
  
Jan Beulich Nov. 4, 2026, 1:59 p.m. UTC | #5
On 04.11.2026 14:39, Evgeny Karpov wrote:
> On Fri, 30 Oct 2026, Jan Beulich wrote:
>>> The patch adds support for aarch64-pc-cygwin target.
>>>
>>> Co-authored-by: Radek Barton <radek.barton@microsoft.com>
>>
>> First of all, authorship-wise: How is this related to the earlier
>> submission by Dennis [1] ?
> 
> This patch is based on work that has been done by Radek Barton
> <radek.barton@microsoft.com> and me. The initial patch was submitted as part of
> a bundle to the mailing list.
> https://sourceware.org/pipermail/binutils/2025-November/145298.html
> This submission has a few changes on top of that, which were made by the same
> authors.

And Dennis'es name was lost in this submission then?

Jan
  
Evgeny Karpov Nov. 4, 2026, 4:22 p.m. UTC | #6
On Wed, 04 Nov 2026, Jan Beulich wrote:
> > This patch is based on work that has been done by Radek Barton
> > <radek.barton@microsoft.com> and me. The initial patch was submitted as part of
> > a bundle to the mailing list.
> > https://sourceware.org/pipermail/binutils/2025-November/145298.html
> > This submission has a few changes on top of that, which were made by the same
> > authors.
> 
> And Dennis'es name was lost in this submission then?

It looks like Dennis's patch series is a separate stream of work that is based
on the initial patch from the bundle. That stream of work has not been used while
preparing this submission.

Regards,
Evgeny
  

Patch

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