Skip to content

Commit

Permalink
Add aarch64-pc-cygwin target to advanced.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackhex committed Mar 26, 2024
1 parent 9316f0f commit 9658bdd
Show file tree
Hide file tree
Showing 10 changed files with 1,301 additions and 22 deletions.
13 changes: 12 additions & 1 deletion .github/scripts/binutils/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ if [ "$RUN_CONFIG" = 1 ] || [ ! -f "$BINUTILS_BUILD_PATH/Makefile" ] ; then
--enable-host-shared \
--enable-64-bit-bfd \
--enable-install-libiberty \
--enable-targets=x86_64-pep \
--with-sysroot=$TOOLCHAIN_PATH \
--with-build-sysroot=$TOOLCHAIN_PATH \
--with-system-zlib \
Expand All @@ -42,6 +41,18 @@ if [ "$RUN_CONFIG" = 1 ] || [ ! -f "$BINUTILS_BUILD_PATH/Makefile" ] ; then
;;
esac

case "$ARCH-$PLATFORM" in
x86_64-*cygwin*)
TARGET_OPTIONS="$TARGET_OPTIONS \
--enable-targets=x86_64-pep"
;;
aarch64-*cygwin*)
TARGET_OPTIONS="$TARGET_OPTIONS \
--enable-targets=aarch64-pep \
--disable-sim"
;;
esac

$SOURCE_PATH/$BINUTILS_VERSION/configure \
--prefix=$TOOLCHAIN_PATH \
--build=$BUILD \
Expand Down
6 changes: 6 additions & 0 deletions .github/scripts/binutils/patch-cygwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ echo "::group::Patch Cygwin binutils"

patch -p2 -i $PATCH_DIR/binutils-2.42-cygwin-config-rpath.patch
patch -p2 -i $PATCH_DIR/binutils-2.42-cygwin-pep-dll-double-definition.patch

case "$ARCH" in
aarch64)
patch -p1 -i $PATCHES_PATH/binutils/0001-aarch64-cygwin.patch
;;
esac
echo "::endgroup::"

echo 'Success!'
2 changes: 1 addition & 1 deletion .github/scripts/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ LIBJPEG_TURBO_VERSION=${LIBJPEG_TURBO_VERSION:-libjpeg-turbo-main}
FFMPEG_VERSION=${FFMPEG_VERSION:-ffmpeg-master}

ARCH=${ARCH:-aarch64}
PLATFORM=${PLATFORM:-w64-mingw32}
PLATFORM=${PLATFORM:-pc-cygwin}
if [[ "$PLATFORM" =~ (mingw|cygwin) ]]; then
CRT=${CRT:-msvcrt}
else
Expand Down
17 changes: 17 additions & 0 deletions .github/scripts/toolchain/patch-cygwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ echo "::group::Patch Cygwin GCC"
patch -p1 -i $PATCH_DIR/0011-Cygwin-define-STD_UNIX.patch
patch -p1 -i $PATCH_DIR/0101-Cygwin-enable-libgccjit-not-just-for-MingW.patch
patch -p1 -i $PATCH_DIR/0102-Cygwin-testsuite-fixes-for-libgccjit.patch

case "$ARCH" in
aarch64)
patch -p1 -i $PATCHES_PATH/gcc/0001-aarch64-cygwin.patch
patch -p1 -i $PATCHES_PATH/gcc/0002-cygming-extern.patch
;;
esac
echo "::endgroup::"

echo echo "::group::Patch MinGW"
cd $SOURCE_PATH/$MINGW_VERSION

git reset --hard
git clean -fdx

patch -p1 -i $PATCHES_PATH/mingw/0001-aarch64-cygwin.patch
echo "::endgroup::"

echo "::group::Patch Cygwin"
Expand All @@ -43,6 +59,7 @@ echo "::group::Patch Cygwin"
fi

patch -p1 -i $PATCHES_PATH/cygwin/0003-master.patch
patch -p1 -i $PATCHES_PATH/cygwin/0004-aarch64-cygwin.patch
echo "::endgroup::"

echo 'Success!'
27 changes: 7 additions & 20 deletions .github/workflows/advanced.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ on:
cygwin_branch:
description: 'Cygwin branch to build'
required: false
default: 'woarm64'
default: 'main'
cygwin_packages_branch:
description: 'Cygwin packages branch to build'
required: false
default: 'main'
cocom_branch:
description: 'COCOM branch to build'
required: false
default: 'main'
default: 'master'
openblas_branch:
description: 'OpenBLAS branch to test'
required: false
Expand Down Expand Up @@ -72,8 +72,8 @@ env:
MINGW_BRANCH: ${{ inputs.mingw_branch || 'woarm64' }}
MINGW_VERSION: mingw-w64-master

CYGWIN_REPO: Windows-on-ARM-Experiments/newlib-cygwin
CYGWIN_BRANCH: ${{ inputs.cygwin_branch || 'woarm64' }}
CYGWIN_REPO: https://cygwin.com/git/newlib-cygwin.git
CYGWIN_BRANCH: ${{ inputs.cygwin_branch || 'main' }}
CYGWIN_VERSION: cygwin-master

CYGWIN_PACKAGES_REPO: Windows-on-ARM-Experiments/cygwin-packages
Expand Down Expand Up @@ -122,22 +122,9 @@ jobs:
strategy:
fail-fast: false
matrix:
arch: [aarch64, x86_64]
platform: [w64-mingw32, pc-linux-gnu, pc-cygwin]
crt: [msvcrt, ucrt, libc]
exclude:
- platform: w64-mingw32
crt: libc
- platform: pc-linux-gnu
crt: msvcrt
- platform: pc-linux-gnu
crt: ucrt
- platform: pc-cygwin
crt: ucrt
- platform: pc-cygwin
crt: libc
- platform: pc-cygwin
arch: aarch64
arch: [aarch64]
platform: [pc-cygwin]
crt: [msvcrt]

env:
ARCH: ${{ matrix.arch }}
Expand Down
160 changes: 160 additions & 0 deletions patches/binutils/0001-aarch64-cygwin.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 6553aac1e99d..c3be7e0fe585 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -248,7 +248,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-*-pe* | aarch64-*-mingw* | aarch64-*-cygwin*)
targ_defvec=aarch64_pe_le_vec
targ_selvecs="aarch64_pe_le_vec aarch64_pei_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 2b9f52720c3e..654476cd2e1d 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -16426,7 +16426,7 @@ do
esac

case $targ in
- aarch64-*-mingw*)
+ 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 dac72c1bdd4d..28a51bdd7e93 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -369,7 +369,7 @@ changequote([,])dnl
esac

case $targ in
- aarch64-*-mingw*)
+ 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 cdfc4392047c..91a44145ed1a 100755
--- a/config.guess
+++ b/config.guess
@@ -951,6 +951,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 7c66734e362b..94fa2407f416 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -138,7 +138,7 @@ case ${generic_target} in
aarch64*-*-netbsd*) fmt=elf em=nbsd;;
aarch64*-*-nto*) fmt=elf;;
aarch64*-*-openbsd*) 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 da71675b201b..05debc74ab3c 100644
--- a/gdb/configure.host
+++ b/gdb/configure.host
@@ -81,6 +81,7 @@ case "${host}" in

aarch64*-*-linux*) gdb_host=linux ;;
aarch64*-*-freebsd*) gdb_host=fbsd ;;
+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 9e861a75088a..c986da39f051 100644
--- a/gdbserver/configure.srv
+++ b/gdbserver/configure.srv
@@ -66,6 +66,13 @@ 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 aarch64-fp.o"
+ srv_tgtobj="${srv_tgtobj} win32-low.o 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 27b63e5112ad..f6a5d0feab9e 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -127,7 +127,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-aarch64.o pe-dll.o pdb.o"
@@ -1145,7 +1145,7 @@ spu-*-elf*)
NATIVE_LIB_DIRS='/lib'
;;

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

diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 9ab5e6ef481c..0a2ff3f7fb48 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -69,6 +69,7 @@ fragment <<EOF
EOF

case ${target} in
+ aarch64-*-mingw* | aarch64-*-pe* | aarch64-*-cygwin | \
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)
fragment <<EOF
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index 5c9dddfc9369..2b282e130879 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -78,9 +78,9 @@ fragment <<EOF
EOF

case ${target} in
+ aarch64-*-mingw* | aarch64-*-pe* | aarch64-*-cygwin | \
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)
fragment <<EOF
#include "pdb.h"
EOF
diff --git a/readline/readline/support/config.guess b/readline/readline/support/config.guess
index cc7a81070119..9c9b836c8ba4 100755
--- a/readline/readline/support/config.guess
+++ b/readline/readline/support/config.guess
@@ -915,6 +915,9 @@ EOF
i*:UWIN*:*)
echo "$UNAME_MACHINE"-pc-uwin
exit ;;
+ aarch64:CYGWIN*:*:*)
+ echo aarch64-pc-cygwin
+ ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-pc-cygwin
exit ;;
Loading

0 comments on commit 9658bdd

Please sign in to comment.