Skip to content

Commit 0f1f207

Browse files
Blackhexeukarpov
authored andcommitted
Add aarch64-pc-cygwin target
Co-authored-by: Evgeny Karpov <[email protected]>
1 parent cd6d335 commit 0f1f207

File tree

12 files changed

+95
-36
lines changed

12 files changed

+95
-36
lines changed

config.guess

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,9 @@ EOF
911911
i*:UWIN*:*)
912912
echo "$UNAME_MACHINE"-pc-uwin
913913
exit ;;
914+
aarch64:CYGWIN*:*:*)
915+
echo aarch64-pc-cygwin
916+
exit ;;
914917
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
915918
echo x86_64-pc-cygwin
916919
exit ;;

gcc/config.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ case $build in
5353
hppa*64*-*-hpux11* )
5454
build_install_headers_dir=install-headers-cpio
5555
;;
56-
i[34567]86-*-cygwin* | x86_64-*-cygwin* )
56+
i[34567]86-*-cygwin* | x86_64-*-cygwin* | aarch64-*-cygwin*)
5757
build_xm_file=i386/xm-cygwin.h
5858
build_exeext=.exe
5959
;;

gcc/config.gcc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,36 @@ aarch64*-*-gnu*)
12721272
tmake_file="${tmake_file} aarch64/t-aarch64"
12731273
tm_defines="${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1"
12741274
;;
1275+
aarch64-*-cygwin*)
1276+
tm_file="${tm_file} aarch64/aarch64-abi-ms.h"
1277+
tm_file="${tm_file} aarch64/aarch64-coff.h"
1278+
tm_file="${tm_file} aarch64/cygming.h"
1279+
tm_file="${tm_file} i386/cygwin.h"
1280+
tm_file="${tm_file} i386/cygwin-w64.h"
1281+
tm_file="${tm_file} i386/cygwin-stdint.h"
1282+
tm_file="${tm_file} mingw/winnt.h"
1283+
tm_file="${tm_file} mingw/winnt-dll.h"
1284+
xm_file=i386/xm-cygwin.h
1285+
tmake_file="${tmake_file} aarch64/t-aarch64"
1286+
tmake_file="${tmake_file} mingw/t-cygming t-slibgcc"
1287+
target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
1288+
target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt-dll.cc"
1289+
extra_options="${extra_options} mingw/cygming.opt i386/cygwin.opt"
1290+
extra_objs="${extra_objs} winnt.o winnt-dll.o"
1291+
c_target_objs="${c_target_objs} msformat-c.o"
1292+
cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
1293+
d_target_objs="${d_target_objs} cygwin-d.o"
1294+
target_has_targetdm="yes"
1295+
aarch64_multilibs="llp64"
1296+
if test x$enable_threads = xyes; then
1297+
thread_file='posix'
1298+
fi
1299+
default_use_cxa_atexit=yes
1300+
use_gcc_stdint=wrap
1301+
tm_defines="${tm_defines} TARGET_64BIT=1 TARGET_CYGWIN64=1 TARGET_64BIT_MS_ABI=1 TARGET_AARCH64_MS_ABI=1"
1302+
TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG},llp64"
1303+
TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
1304+
;;
12751305
aarch64-*-mingw*)
12761306
tm_file="${tm_file} aarch64/aarch64-abi-ms.h"
12771307
tm_file="${tm_file} aarch64/aarch64-coff.h"

gcc/config.host

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ case ${host} in
228228
;;
229229
esac
230230
;;
231-
i[34567]86-*-cygwin* | x86_64-*-cygwin*)
231+
i[34567]86-*-cygwin* | x86_64-*-cygwin* | aarch64-*-cygwin*)
232232
host_xm_file=i386/xm-cygwin.h
233233
out_host_hook_obj=host-cygwin.o
234234
host_xmake_file="${host_xmake_file} i386/x-cygwin"

gcc/config/aarch64/aarch64-protos.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,4 +1246,22 @@ extern bool aarch64_gcs_enabled ();
12461246
extern unsigned aarch64_data_alignment (const_tree exp, unsigned align);
12471247
extern unsigned aarch64_stack_alignment (const_tree exp, unsigned align);
12481248

1249+
/* SEH support */
1250+
extern void i386_pe_seh_init (FILE *);
1251+
extern void i386_pe_seh_end_prologue (FILE *);
1252+
// extern void aarch64_pe_seh_function_prologue (FILE *);
1253+
// extern void aarch64_pe_seh_cold_init (FILE *, const char *);
1254+
extern void i386_pe_seh_unwind_emit (FILE *, rtx_insn *);
1255+
extern void i386_pe_seh_emit_except_personality (rtx);
1256+
extern void i386_pe_seh_init_sections (void);
1257+
// extern void aarch64_pe_seh_asm_final_postscan_insn (FILE *stream, rtx_insn *insn, rtx*, int);
1258+
1259+
/* In winnt */
1260+
// extern void aarch64_print_reg (rtx, int, FILE*);
1261+
extern void i386_pe_end_function (FILE *f, const char *, tree);
1262+
extern void i386_pe_end_cold_function (FILE *f, const char *, tree);
1263+
// extern void aarch64_pe_end_epilogue (FILE *file);
1264+
// extern void aarch64_pe_begin_epilogue (FILE *file);
1265+
extern void i386_pe_record_external_function (tree, const char *);
1266+
12491267
#endif /* GCC_AARCH64_PROTOS_H */

gcc/config/aarch64/cygming.h

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ along with GCC; see the file COPYING3. If not see
7777
// #undef LOCAL_LABEL_PREFIX
7878
// #define LOCAL_LABEL_PREFIX (TARGET_64BIT ? "." : "")
7979

80-
#include <stdbool.h>
81-
#ifdef __MINGW32__
82-
#include <stdio.h>
83-
#endif
84-
8580
#define TARGET_ASM_NAMED_SECTION mingw_pe_asm_named_section
8681

8782
/* Select attributes for named sections. */
@@ -93,24 +88,6 @@ along with GCC; see the file COPYING3. If not see
9388
#undef TARGET_SEH
9489
#define TARGET_SEH 1
9590

96-
/* SEH support */
97-
extern void i386_pe_seh_init (FILE *);
98-
extern void i386_pe_seh_end_prologue (FILE *);
99-
// extern void aarch64_pe_seh_function_prologue (FILE *);
100-
// extern void aarch64_pe_seh_cold_init (FILE *, const char *);
101-
extern void i386_pe_seh_unwind_emit (FILE *, rtx_insn *);
102-
extern void i386_pe_seh_emit_except_personality (rtx);
103-
extern void i386_pe_seh_init_sections (void);
104-
// extern void aarch64_pe_seh_asm_final_postscan_insn (FILE *stream, rtx_insn *insn, rtx*, int);
105-
106-
/* In winnt */
107-
// extern void aarch64_print_reg (rtx, int, FILE*);
108-
extern void i386_pe_end_function (FILE *f, const char *, tree);
109-
extern void i386_pe_end_cold_function (FILE *f, const char *, tree);
110-
// extern void aarch64_pe_end_epilogue (FILE *file);
111-
// extern void aarch64_pe_begin_epilogue (FILE *file);
112-
extern void i386_pe_record_external_function (tree, const char *);
113-
11491
#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P mingw_pe_valid_dllimport_attribute_p
11592

11693
/* Output function declarations at the end of the file. */
@@ -156,21 +133,14 @@ extern void i386_pe_record_external_function (tree, const char *);
156133
#define TARGET_OS_CPP_BUILTINS() \
157134
do \
158135
{ \
159-
builtin_define ("__MSVCRT__"); \
160-
builtin_define ("__MINGW32__"); \
161-
builtin_define ("_WIN32"); \
162136
builtin_define ("__SEH__"); \
163-
builtin_define_std ("WIN32"); \
164-
builtin_define_std ("WINNT"); \
165137
builtin_define_with_int_value ("_INTEGRAL_MAX_BITS", \
166138
TYPE_PRECISION (intmax_type_node)); \
167-
builtin_define ("__MINGW64__"); \
168-
builtin_define_std ("WIN64"); \
169-
builtin_define ("_WIN64"); \
170139
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
171140
builtin_define ("__fastcall=__attribute__((__fastcall__))"); \
172141
builtin_define ("__thiscall=__attribute__((__thiscall__))"); \
173142
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
143+
EXTRA_OS_CPP_BUILTINS (); \
174144
} \
175145
while (0)
176146

gcc/config/i386/cygwin-w64.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ along with GCC; see the file COPYING3. If not see
5050

5151
#undef SUB_LINK_SPEC
5252
#undef SUB_LINK_ENTRY
53+
#if defined(TARGET_AARCH64_MS_ABI)
54+
#define SUB_LINK_SPEC "-m aarch64pe"
55+
#else
5356
#define SUB_LINK_SPEC "%{" SPEC_64 ":-m i386pep} %{" SPEC_32 ":-m i386pe}"
57+
#endif
5458
#define SUB_LINK_ENTRY "%{" SPEC_64 ":" SUB_LINK_ENTRY64 "} %{" SPEC_32 ":" SUB_LINK_ENTRY32 "}"
5559

5660
#undef MULTILIB_DEFAULTS

gcc/config/mingw/mingw32.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ along with GCC; see the file COPYING3. If not see
4242
#define DEFINE_THREAD_MODEL
4343
#endif
4444

45+
#if defined (TARGET_AARCH64_MS_ABI)
46+
# define ENABLE_TARGET_64BIT_BUILTINS 1
47+
#else
48+
# define ENABLE_TARGET_64BIT_BUILTINS (TARGET_64BIT && ix86_abi == MS_ABI)
49+
#endif
50+
4551
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
4652
is for compatibility with native compiler. */
4753
#define EXTRA_OS_CPP_BUILTINS() \
@@ -54,7 +60,7 @@ along with GCC; see the file COPYING3. If not see
5460
builtin_define_std ("WINNT"); \
5561
builtin_define_with_int_value ("_INTEGRAL_MAX_BITS", \
5662
TYPE_PRECISION (intmax_type_node));\
57-
if (TARGET_64BIT && ix86_abi == MS_ABI) \
63+
if (ENABLE_TARGET_64BIT_BUILTINS) \
5864
{ \
5965
builtin_define ("__MINGW64__"); \
6066
builtin_define_std ("WIN64"); \

gcc/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28949,7 +28949,7 @@ fi
2894928949

2895028950
;;
2895128951

28952-
i[34567]86-*-* | x86_64-*-*)
28952+
i[34567]86-*-* | x86_64-*-* | aarch64-*-*)
2895328953
case $target_os in
2895428954
cygwin*)
2895528955
# Full C++ conformance when using a shared libstdc++-v3 requires some

gcc/configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4778,7 +4778,7 @@ foo:
47784778
;;
47794779

47804780
changequote(,)dnl
4781-
i[34567]86-*-* | x86_64-*-*)
4781+
i[34567]86-*-* | x86_64-*-* | aarch64-*-*)
47824782
changequote([,])dnl
47834783
case $target_os in
47844784
cygwin*)

0 commit comments

Comments
 (0)