This option is meant to be used alongside --host=aarch64-w64-mingw32 to enable
a hybrid ARM64X build. Enable the compilation of all ARM64EC-specific files in
preparation for using -marm64x and ensure that including them on unintended
targets is harmless via preprocessor guards.
Building ARM64EC-only toolchain with --host=arm64ec-w64-mingw32 remains
unchanged.
---
mingw-w64-crt/Makefile.am | 13 +++++++++----
mingw-w64-crt/configure.ac | 14 +++++++++++++-
mingw-w64-crt/crt/chpe.S | 4 ++++
mingw-w64-crt/math/fabsf.c | 5 +++++
mingw-w64-crt/misc/arm64ec/longjmp.c | 4 ++++
mingw-w64-crt/misc/arm64ec/setjmp.c | 4 ++++
mingw-w64-crt/stdio/scanf.S | 2 +-
7 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 443f6686d..00daabb57 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -20,11 +20,17 @@ else
endif
AM_CPPFLAGS=$(sysincludes)
-AM_CFLAGS=-pipe -std=gnu99 -fno-builtin -D_CRTBLD -D_WIN32_WINNT=0x0f00
-D__MSVCRT_VERSION__=0x600 -D__USE_MINGW_ANSI_STDIO=0 @IMAGEBASE_CFLAGS@
@CFGUARD_CFLAGS@ @ADD_C_CXX_WARNING_FLAGS@ @ADD_C_ONLY_WARNING_FLAGS@
+COMMON_CFLAGS=-pipe -std=gnu99 -fno-builtin -D_CRTBLD -D_WIN32_WINNT=0x0f00
-D__MSVCRT_VERSION__=0x600 -D__USE_MINGW_ANSI_STDIO=0 @IMAGEBASE_CFLAGS@
@CFGUARD_CFLAGS@ @ADD_C_CXX_WARNING_FLAGS@ @ADD_C_ONLY_WARNING_FLAGS@
+AM_CFLAGS=$(COMMON_CFLAGS)
AM_CXXFLAGS=@ADD_C_CXX_WARNING_FLAGS@ @ADD_CXX_ONLY_WARNING_FLAGS@
AM_CCASFLAGS=@CFGUARD_CFLAGS@
CPPFLAGSARM32=$(AM_CPPFLAGS) -mfpu=vfpv3
CPPFLAGSARM64=$(AM_CPPFLAGS)
+if ARM64X
+ AM_CFLAGS += -marm64x
+ AM_CXXFLAGS += -marm64x
+ AM_CCASFLAGS += -marm64x
+endif
CPPFLAGS32=$(AM_CPPFLAGS) -m32 -masm=att
CPPFLAGS64=$(AM_CPPFLAGS) -m64 -masm=att
AM_DLLTOOLFLAGS=-k --as=$(AS) --output-lib $@
@@ -880,13 +886,12 @@ src_msvcrtarm64=\
stdio/_wstat32.c \
stdio/_wstat32i64.c \
stdio/gets.c \
+ stdio/scanf.S \
string/msvcr80plus_wcstok.c
if ARM64EC
src_msvcrtarm64+=math/fabsf.c
src_msvcrtarm64_x64=libarm64/stdio/scanf.x86_64.o
-else
-src_msvcrtarm64+=stdio/scanf.S
endif
src_pre_msvcrt20=\
@@ -2589,7 +2594,7 @@ libarm64/%.o: crt/%.c
$(AM_V_CC)$(COMPILE) $(CPPFLAGSARM64) -c $< -o $@
libarm64/%.x86_64.o: %.S
- $(AM_V_CC)$(MKDIR_P) $(@D) && $(COMPILE) $(CPPFLAGSARM64) -target
x86_64-windows-gnu -c $< -o $@
+ $(AM_V_CC)$(MKDIR_P) $(@D) && $(CC) $(COMMON_CFLAGS) $(CPPFLAGSARM64)
-target x86_64-windows-gnu -c $< -o $@
# These source files aren't compiled in to any library yet. I'm not sure how
/ where to do so.
# The source files that I did compile somewhere I just guessed at anyway.
diff --git a/mingw-w64-crt/configure.ac b/mingw-w64-crt/configure.ac
index 1f1c11eb6..969815a2c 100644
--- a/mingw-w64-crt/configure.ac
+++ b/mingw-w64-crt/configure.ac
@@ -170,6 +170,18 @@ AS_VAR_IF([enable_libarm64],[yes],[
AS_IF([AS_VAR_TEST_SET([LIB32]) || AS_VAR_TEST_SET([LIB64]) ||
AS_VAR_TEST_SET([LIBARM32])],
[AC_MSG_WARN([Building the runtime to use libarm64 with lib32, lib64 or
libarm32 is unsupported.])])])
+AC_MSG_CHECKING([whether to build the ARM64X libraries])
+AC_ARG_ENABLE([arm64x],
+ [AS_HELP_STRING([--enable-arm64x], [Enable hybrid ARM64X (ARM64 and ARM64EC)
libraries])],
+ [],
+ [AS_VAR_SET([enable_arm64x],[no])])
+AC_MSG_RESULT([$enable_arm64x])
+AS_CASE([$enable_arm64x],
+ [no],[],
+ [yes],[AS_VAR_SET([ARM64X])],
+ [AC_MSG_ERROR([invalid argument. Must be either yes or no.])])
+AM_CONDITIONAL([ARM64X], [AS_VAR_TEST_SET([ARM64X])])
+
AS_CASE([$host_cpu],
[x86_64],[
libx8664suffx=lib
@@ -210,7 +222,7 @@ AC_SUBST([LIBX8632SUFFIXDIR],[$libx8632suffx])
AC_SUBST([LIBARM64SUFFIXDIR],[$libarm64suffx])
AC_SUBST([LIBARM32SUFFIXDIR],[$libarm32suffx])
-AM_CONDITIONAL([ARM64EC],[test $host_cpu = arm64ec])
+AM_CONDITIONAL([ARM64EC],[test $host_cpu = arm64ec -o x$enable_arm64x = xyes])
# Checks for features.
diff --git a/mingw-w64-crt/crt/chpe.S b/mingw-w64-crt/crt/chpe.S
index 20d962231..8acf4884a 100644
--- a/mingw-w64-crt/crt/chpe.S
+++ b/mingw-w64-crt/crt/chpe.S
@@ -4,6 +4,8 @@
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
+#ifdef __arm64ec__
+
#define EXPORT_SYM(x) .globl x; x:
/*
@@ -106,3 +108,5 @@ EXPORT_SYM(__icall_helper_arm64ec)
.seh_endepilogue
br x11
.seh_endproc
+
+#endif
diff --git a/mingw-w64-crt/math/fabsf.c b/mingw-w64-crt/math/fabsf.c
index 702b9d02c..0e3a802d2 100644
--- a/mingw-w64-crt/math/fabsf.c
+++ b/mingw-w64-crt/math/fabsf.c
@@ -3,6 +3,9 @@
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
+
+#ifndef __aarch64__
+
float fabsf (float x);
float
@@ -16,3 +19,5 @@ fabsf (float x)
return __builtin_fabsf(x);
#endif
}
+
+#endif
diff --git a/mingw-w64-crt/misc/arm64ec/longjmp.c
b/mingw-w64-crt/misc/arm64ec/longjmp.c
index 4ad0435e0..e295f31d6 100644
--- a/mingw-w64-crt/misc/arm64ec/longjmp.c
+++ b/mingw-w64-crt/misc/arm64ec/longjmp.c
@@ -4,6 +4,8 @@
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
+#ifdef __arm64ec__
+
#undef __MSVCRT_VERSION__
#define _UCRT
@@ -29,3 +31,5 @@ void __cdecl longjmp( jmp_buf b, int retval )
}
void (__cdecl *__MINGW_IMP_SYMBOL(longjmp))( jmp_buf b, int retval ) = longjmp;
+
+#endif
diff --git a/mingw-w64-crt/misc/arm64ec/setjmp.c
b/mingw-w64-crt/misc/arm64ec/setjmp.c
index 18f90b0e6..ef5012a5f 100644
--- a/mingw-w64-crt/misc/arm64ec/setjmp.c
+++ b/mingw-w64-crt/misc/arm64ec/setjmp.c
@@ -4,6 +4,8 @@
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
+#ifdef __arm64ec__
+
#undef __MSVCRT_VERSION__
#define _UCRT
@@ -105,3 +107,5 @@ int __attribute__((naked)) __intrinsic_setjmpex( jmp_buf
buf, void *frame )
"b \"#do_setjmpex\"\n\t"
".seh_endproc" );
}
+
+#endif
diff --git a/mingw-w64-crt/stdio/scanf.S b/mingw-w64-crt/stdio/scanf.S
index 50e628a89..8898ade0a 100644
--- a/mingw-w64-crt/stdio/scanf.S
+++ b/mingw-w64-crt/stdio/scanf.S
@@ -25,7 +25,7 @@
expanded as variadic arguments when calling func
*/
-#if defined (__x86_64__)
+#if defined(__x86_64__) && !defined(__arm64ec__)
.text
.align 16
--
2.53.0
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public