The patch adds support for aarch64-pc-cygwin target.
Co-authored-by: Radek Barton <[email protected]>
gcc/ChangeLog:
* config.build: Add aarch64-*-cygwin.
* config.gcc: Likewise.
* config.host: Likewise.
* config/aarch64/aarch64-abi-ms.h (__NO_BINARY80__): Add.
* config/aarch64/cygming.h (TARGET_OS_CPP_BUILTINS): Update.
(TARGET_ASM_ASSEMBLE_VISIBILITY): Add.
* config/cygwin/cygwin-stdint.h (INT64_TYPE): Define types for AArch64.
(UINT64_TYPE): Likewise.
(INT_LEAST64_TYPE): Likewise.
(UINT_LEAST64_TYPE): Likewise.
(UINT_FAST8_TYPE): Likewise.
(defined): Likewise.
(INT_FAST16_TYPE): Likewise.
(INT_FAST32_TYPE): Likewise.
(INT_FAST64_TYPE): Likewise.
(UINT_FAST16_TYPE): Likewise.
(UINT_FAST32_TYPE): Likewise.
(UINT_FAST64_TYPE): Likewise.
(INTPTR_TYPE): Likewise.
(UINTPTR_TYPE): Likewise.
* config/cygwin/cygwin-w64.h (defined): Add aarch64-*-cygwin.
(SUB_LINK_SPEC): Likewise.
(LONG_TYPE_SIZE): Define types for AArch64.
(SIZE_TYPE): Likewise.
(PTRDIFF_TYPE): Likewise.
* config/cygwin/cygwin.h (defined): Likewise.
(ENABLE_CYGWIN32_BUILTIN): Likewise.
(EXTRA_OS_CPP_BUILTINS): Likewise.
* config/mingw/mingw32.h (defined): Likewise.
(ENABLE_TARGET_64BIT_BUILTINS): Likewise.
* configure: Regenerate.
* configure.ac: Add aarch64-*-cygwin.
libgcc/ChangeLog:
* config.host: Add aarch64-*-cygwin.
* unwind-generic.h (__gcc_personality_seh0): Add.
---
gcc/config.build | 2 +-
gcc/config.gcc | 28 +++++++++++++++++++++
gcc/config.host | 2 +-
gcc/config/aarch64/aarch64-abi-ms.h | 2 ++
gcc/config/aarch64/cygming.h | 12 +++------
gcc/config/cygwin/cygwin-stdint.h | 39 +++++++++++++++++++++++------
gcc/config/cygwin/cygwin-w64.h | 19 ++++++++++----
gcc/config/cygwin/cygwin.h | 8 +++++-
gcc/config/mingw/mingw32.h | 8 +++++-
gcc/configure | 9 +++++++
gcc/configure.ac | 8 ++++++
libgcc/config.host | 27 ++++++++++++++++++++
libgcc/unwind-generic.h | 4 +++
13 files changed, 144 insertions(+), 24 deletions(-)
diff --git a/gcc/config.build b/gcc/config.build
index 0dcc539d04a..d4c0fd02cbc 100644
--- a/gcc/config.build
+++ b/gcc/config.build
@@ -53,7 +53,7 @@ case $build in
hppa*64*-*-hpux11* )
build_install_headers_dir=install-headers-cpio
;;
- i[34567]86-*-cygwin* | x86_64-*-cygwin* )
+ i[34567]86-*-cygwin* | x86_64-*-cygwin* | aarch64-*-cygwin*)
build_xm_file=cygwin/xm-cygwin.h
build_exeext=.exe
;;
diff --git a/gcc/config.gcc b/gcc/config.gcc
index bafdc8ebfe5..497a083dcdc 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1323,6 +1323,34 @@ aarch64*-*-gnu*)
tmake_file="${tmake_file} aarch64/t-aarch64"
tm_defines="${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1"
;;
+aarch64-*-cygwin*)
+ 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} cygwin/cygwin.h"
+ tm_file="${tm_file} cygwin/cygwin-w64.h"
+ tm_file="${tm_file} cygwin/cygwin-stdint.h"
+ tm_file="${tm_file} mingw/winnt.h"
+ tm_file="${tm_file} mingw/winnt-dll.h"
+ xm_file=cygwin/xm-cygwin.h
+ tmake_file="${tmake_file} aarch64/t-aarch64"
+ tmake_file="${tmake_file} aarch64/t-aarch64-mingw"
+ tmake_file="${tmake_file} mingw/t-cygming t-slibgcc"
+ target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
+ target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt-dll.cc"
+ extra_options="${extra_options} mingw/cygming.opt cygwin/cygwin.opt"
+ extra_objs="${extra_objs} aarch64-abi-ms.o winnt.o winnt-dll.o"
+ c_target_objs="${c_target_objs} msformat-c.o"
+ cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
+ d_target_objs="${d_target_objs} cygwin-d.o"
+ target_has_targetdm="yes"
+ if test x$enable_threads = xyes; then
+ thread_file='posix'
+ fi
+ default_use_cxa_atexit=yes
+ use_gcc_stdint=wrap
+ tm_defines="${tm_defines} TARGET_AARCH64_MS_ABI=1"
+ ;;
aarch64-*-mingw*)
tm_file="${tm_file} aarch64/aarch64-abi-ms.h"
tm_file="${tm_file} aarch64/aarch64-coff.h"
diff --git a/gcc/config.host b/gcc/config.host
index 574e3985d1f..3a34581ac22 100644
--- a/gcc/config.host
+++ b/gcc/config.host
@@ -231,7 +231,7 @@ case ${host} in
;;
esac
;;
- i[34567]86-*-cygwin* | x86_64-*-cygwin*)
+ i[34567]86-*-cygwin* | x86_64-*-cygwin* | aarch64-*-cygwin*)
host_xm_file=cygwin/xm-cygwin.h
out_host_hook_obj=host-cygwin.o
host_xmake_file="${host_xmake_file} cygwin/x-cygwin"
diff --git a/gcc/config/aarch64/aarch64-abi-ms.h
b/gcc/config/aarch64/aarch64-abi-ms.h
index f25e476b3a8..9c513b6a0d3 100644
--- a/gcc/config/aarch64/aarch64-abi-ms.h
+++ b/gcc/config/aarch64/aarch64-abi-ms.h
@@ -35,6 +35,8 @@ along with GCC; see the file COPYING3. If not see
(((r) >= R19_REGNUM && (r) <= R30_REGNUM) \
|| ((r) >= V8_REGNUM && (r) <= V15_REGNUM))
+#define __NO_BINARY80__
+
#define ASM_COMMENT_START "//"
/* ASM_OUTPUT_TYPE_DIRECTIVE is not yet supported by binutils for the
diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h
index 4ade1fd2085..009a6caeba2 100644
--- a/gcc/config/aarch64/cygming.h
+++ b/gcc/config/aarch64/cygming.h
@@ -130,21 +130,14 @@ along with GCC; see the file COPYING3. If not see
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
- builtin_define ("__MSVCRT__"); \
- builtin_define ("__MINGW32__"); \
- builtin_define ("_WIN32"); \
builtin_define ("__SEH__"); \
- 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__))"); \
+ EXTRA_OS_CPP_BUILTINS ();
\
} \
while (0)
@@ -234,6 +227,9 @@ along with GCC; see the file COPYING3. If not see
aarch64_handle_ms_abi_attribute, NULL }, \
{ "ms_abi va_list", 0, 0, false, false, false, false, NULL, NULL }
+#undef TARGET_ASM_ASSEMBLE_VISIBILITY
+#define TARGET_ASM_ASSEMBLE_VISIBILITY mingw_pe_assemble_visibility
+
#undef SUB_TARGET_RECORD_STUB
#define SUB_TARGET_RECORD_STUB(NAME, DECL) mingw_pe_record_stub((NAME), \
DECL_WEAK ((DECL)))
diff --git a/gcc/config/cygwin/cygwin-stdint.h
b/gcc/config/cygwin/cygwin-stdint.h
index d67ffe80ac3..7fd6a2827e0 100644
--- a/gcc/config/cygwin/cygwin-stdint.h
+++ b/gcc/config/cygwin/cygwin-stdint.h
@@ -24,38 +24,63 @@ along with GCC; see the file COPYING3. If not see
#define INT8_TYPE "signed char"
#define INT16_TYPE "short int"
#define INT32_TYPE "int"
-#define INT64_TYPE (TARGET_64BIT ? "long int" : "long long int")
#define UINT8_TYPE "unsigned char"
#define UINT16_TYPE "short unsigned int"
#define UINT32_TYPE "unsigned int"
-#define UINT64_TYPE (TARGET_64BIT ? "long unsigned int" : "long long unsigned
int")
/* Minimum-width integer types */
#define INT_LEAST8_TYPE "signed char"
#define INT_LEAST16_TYPE "short int"
#define INT_LEAST32_TYPE "int"
-#define INT_LEAST64_TYPE (TARGET_64BIT ? "long int" : "long long int")
#define UINT_LEAST8_TYPE "unsigned char"
#define UINT_LEAST16_TYPE "short unsigned int"
#define UINT_LEAST32_TYPE "unsigned int"
-#define UINT_LEAST64_TYPE (TARGET_64BIT ? "long unsigned int" : "long long
unsigned int")
/* Fastest minimum-width integer types */
#define INT_FAST8_TYPE "signed char"
+
+#define UINT_FAST8_TYPE "unsigned char"
+
+#if defined (TARGET_AARCH64_MS_ABI)
+#define INT64_TYPE "long int"
+
+#define UINT64_TYPE "long unsigned int"
+
+#define INT_LEAST64_TYPE "long int"
+
+#define UINT_LEAST64_TYPE "long unsigned int"
+
+#define INT_FAST16_TYPE "long int"
+#define INT_FAST32_TYPE "long int"
+#define INT_FAST64_TYPE "long int"
+
+#define UINT_FAST16_TYPE "long unsigned int"
+#define UINT_FAST32_TYPE "long unsigned int"
+#define UINT_FAST64_TYPE "long unsigned int"
+
+#define INTPTR_TYPE "long int"
+#define UINTPTR_TYPE "long unsigned int"
+#else
+#define INT64_TYPE (TARGET_64BIT ? "long int" : "long long int")
+
+#define UINT64_TYPE (TARGET_64BIT ? "long unsigned int" : "long long unsigned
int")
+
+#define INT_LEAST64_TYPE (TARGET_64BIT ? "long int" : "long long int")
+
+#define UINT_LEAST64_TYPE (TARGET_64BIT ? "long unsigned int" : "long long
unsigned int")
+
#define INT_FAST16_TYPE (TARGET_64BIT ? "long int" : "int")
#define INT_FAST32_TYPE (TARGET_64BIT ? "long int" : "int")
#define INT_FAST64_TYPE (TARGET_64BIT ? "long int" : "long long int")
-#define UINT_FAST8_TYPE "unsigned char"
#define UINT_FAST16_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
#define UINT_FAST32_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
#define UINT_FAST64_TYPE (TARGET_64BIT ? "long unsigned int" : "long long
unsigned int")
-/* Integer types capable of holding object pointers */
-
#define INTPTR_TYPE (TARGET_64BIT ? "long int" : "int")
#define UINTPTR_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
+#endif
\ No newline at end of file
diff --git a/gcc/config/cygwin/cygwin-w64.h b/gcc/config/cygwin/cygwin-w64.h
index 614cc2259a7..e8a8433e737 100644
--- a/gcc/config/cygwin/cygwin-w64.h
+++ b/gcc/config/cygwin/cygwin-w64.h
@@ -50,7 +50,11 @@ along with GCC; see the file COPYING3. If not see
#undef SUB_LINK_SPEC
#undef SUB_LINK_ENTRY
+#if defined (TARGET_AARCH64_MS_ABI)
+#define SUB_LINK_SPEC "-m aarch64pe"
+#else
#define SUB_LINK_SPEC "%{" SPEC_64 ":-m i386pep} %{" SPEC_32 ":-m i386pe}"
+#endif
#define SUB_LINK_ENTRY "%{" SPEC_64 ":" SUB_LINK_ENTRY64 "} %{" SPEC_32 ":"
SUB_LINK_ENTRY32 "}"
#undef MULTILIB_DEFAULTS
@@ -69,16 +73,21 @@ along with GCC; see the file COPYING3. If not see
--dll-search-prefix=cyg \
%{!shared: %{!mdll: %{" SPEC_32 ":--large-address-aware} --tsaware}}"
-/* Cygwin64 will have a 64-bit long type. */
-#undef LONG_TYPE_SIZE
#undef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE (TARGET_64BIT ? 64 : 32)
+#undef SIZE_TYPE
+#undef PTRDIFF_TYPE
+#if defined (TARGET_AARCH64_MS_ABI)
+#define LONG_TYPE_SIZE 64
+#define SIZE_TYPE "long unsigned int"
+#define PTRDIFF_TYPE "long int"
+#else
+/* Cygwin64 will have a 64-bit long type. */
+#define LONG_TYPE_SIZE (TARGET_64BIT ? 64 : 32)
/* Override default "long long unsigned int" from cygming.h. */
-#undef SIZE_TYPE
#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
-#undef PTRDIFF_TYPE
#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
+#endif
#undef LIBGCC_SONAME
#define LIBGCC_SONAME "cyggcc_s-seh-1.dll"
diff --git a/gcc/config/cygwin/cygwin.h b/gcc/config/cygwin/cygwin.h
index 0e915706f22..54e0ce08288 100644
--- a/gcc/config/cygwin/cygwin.h
+++ b/gcc/config/cygwin/cygwin.h
@@ -18,11 +18,17 @@ 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/>. */
+#if defined (TARGET_AARCH64_MS_ABI)
+#define ENABLE_CYGWIN32_BUILTIN 0
+#else
+#define ENABLE_CYGWIN32_BUILTIN (!TARGET_64BIT)
+#endif
+
#define EXTRA_OS_CPP_BUILTINS() \
do \
{ \
builtin_define ("__CYGWIN__"); \
- if (!TARGET_64BIT) \
+ if (ENABLE_CYGWIN32_BUILTIN) \
builtin_define ("__CYGWIN32__"); \
builtin_define ("__unix__"); \
builtin_define ("__unix"); \
diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h
index 4b2a6753def..e1509bbcba7 100644
--- a/gcc/config/mingw/mingw32.h
+++ b/gcc/config/mingw/mingw32.h
@@ -42,6 +42,12 @@ along with GCC; see the file COPYING3. If not see
#define DEFINE_THREAD_MODEL
#endif
+#if defined (TARGET_AARCH64_MS_ABI)
+# define ENABLE_TARGET_64BIT_BUILTINS 1
+#else
+# define ENABLE_TARGET_64BIT_BUILTINS (TARGET_64BIT && ix86_abi == MS_ABI)
+#endif
+
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \
@@ -54,7 +60,7 @@ along with GCC; see the file COPYING3. If not see
builtin_define_std ("WINNT"); \
builtin_define_with_int_value ("_INTEGRAL_MAX_BITS", \
TYPE_PRECISION (intmax_type_node));\
- if (TARGET_64BIT && ix86_abi == MS_ABI) \
+ if (ENABLE_TARGET_64BIT_BUILTINS) \
{ \
builtin_define ("__MINGW64__"); \
builtin_define_std ("WIN64"); \
diff --git a/gcc/configure b/gcc/configure
index b8074c8f364..e022d28c33a 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -29103,6 +29103,15 @@ if test "${enable_fix_cortex_a53_843419+set}" = set;
then :
fi
+ case $target_os in
+ cygwin*)
+ gcc_ac_cygwin_dll_wrappers=yes
+
+cat >>confdefs.h <<_ACEOF
+#define USE_CYGWIN_LIBSTDCXX_WRAPPERS `if test $gcc_ac_cygwin_dll_wrappers =
yes; then echo 1; else echo 0; fi`
+_ACEOF
+
+ esac
;;
# All TARGET_ABI_OSF targets.
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 49008385924..9169b39e2ea 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4657,6 +4657,14 @@ AS_HELP_STRING([--disable-fix-cortex-a53-843419],
esac
],
[])
+ case $target_os in
+ cygwin*)
+ gcc_ac_cygwin_dll_wrappers=yes
+ AC_DEFINE_UNQUOTED(USE_CYGWIN_LIBSTDCXX_WRAPPERS,
+ [`if test $gcc_ac_cygwin_dll_wrappers = yes; then echo 1; else echo
0; fi`],
+ [Define if you want to generate code by default that assumes that the
+ Cygwin DLL exports wrappers to support libstdc++ function
replacement.])
+ esac
;;
# All TARGET_ABI_OSF targets.
diff --git a/libgcc/config.host b/libgcc/config.host
index df609f15d21..b2e365c3364 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -839,6 +839,33 @@ i[34567]86-*-solaris2* | x86_64-*-solaris2*)
;;
i[4567]86-wrs-vxworks*|x86_64-wrs-vxworks*)
;;
+aarch64-*-cygwin*)
+ # Shared libgcc DLL install dir depends on cross/native build.
+ if test x${build} = x${host} ; then
+ tmake_dlldir_file="cygwin/t-dlldir"
+ else
+ tmake_dlldir_file="cygwin/t-dlldir-x"
+ fi
+ tmake_file="${tmake_file} mingw/t-seh-eh"
+ tmake_file="${tmake_file} ${tmake_dlldir_file}"
+ tmake_file="${tmake_file} t-dfprules"
+ tmake_file="${tmake_file} mingw/t-slibgcc-cygming"
+ tmake_file="${tmake_file} mingw/t-cygming"
+ tmake_file="${tmake_file} cygwin/t-cygwin"
+ tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
+ tmake_file="${tmake_file} ${cpu_type}/t-lse"
+ tmake_file="${tmake_file} t-crtfm"
+ extra_parts="$extra_parts crtbegin.o"
+ extra_parts="$extra_parts crtbeginS.o"
+ extra_parts="$extra_parts crtend.o "
+ extra_parts="$extra_parts crtfastmath.o"
+ if test x$enable_vtable_verify = xyes; then
+ extra_parts="$extra_parts vtv_start.o"
+ extra_parts="$extra_parts vtv_end.o"
+ extra_parts="$extra_parts vtv_start_preinit.o"
+ extra_parts="$extra_parts vtv_end_preinit.o"
+ fi
+ ;;
i[34567]86-*-cygwin*)
extra_parts="crtbegin.o crtbeginS.o crtend.o crtfastmath.o"
if test x$enable_vtable_verify = xyes; then
diff --git a/libgcc/unwind-generic.h b/libgcc/unwind-generic.h
index ee74f59e5aa..20666357dfd 100644
--- a/libgcc/unwind-generic.h
+++ b/libgcc/unwind-generic.h
@@ -275,6 +275,10 @@ extern void * _Unwind_FindEnclosingFunction (void *pc);
#endif
#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
+EXCEPTION_DISPOSITION
+__gcc_personality_seh0 (PEXCEPTION_RECORD ms_exc, void *this_frame,
+ PCONTEXT ms_orig_context, PDISPATCHER_CONTEXT ms_disp);
+
/* Handles the mapping from SEH to GCC interfaces. */
EXCEPTION_DISPOSITION _GCC_specific_handler (PEXCEPTION_RECORD, void *,
PCONTEXT, PDISPATCHER_CONTEXT,