From: Billy Laws <blaw...@gmail.com>

ARM64EC targets are identified by the __arm64ec__, _M_ARM64EC, and _ARM64EC_ macros.

ARM64EC code functions as an __x86_64__ compiler while utilizing the AArch64 instruction set. Consequently, it defines the __x86_64__, _M_AMD64, and _AMD64_ macros, but not
__aarch64__, _M_ARM64, or _ARM64_.

Signed-off-by: Jacek Caban <ja...@codeweavers.com>
---

I'm submitting this as the initial step in supporting the ARM64EC target in mingw-w64. This implementation is extracted from Billy Laws' mingw-w64 fork [1].

With the current LLVM git, ARM64EC is roughly supported across tools (clang, lld-link, llvm-dlltool, llvm-ar, etc.). However, some features remain to be implemented, such as support for hybrid ARM64X binaries. Runtime components, primarily compiler-rt, also still need porting. Despite these gaps, I believe it's a good time to begin incorporating the foundational elements into mingw-w64.

[1] https://github.com/bylaws/mingw-w64

 mingw-w64-headers/crt/_mingw_mac.h | 7 +++++++
 mingw-w64-headers/include/winnt.h  | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/mingw-w64-headers/crt/_mingw_mac.h b/mingw-w64-headers/crt/_mingw_mac.h
index e7fd07220..3fe61328e 100644
--- a/mingw-w64-headers/crt/_mingw_mac.h
+++ b/mingw-w64-headers/crt/_mingw_mac.h
@@ -88,6 +88,13 @@
 #  endif
 #endif
 
+#if defined(__arm64ec__) && !defined(_M_ARM64EC)
+#  define _M_ARM64EC 1
+#  ifndef _ARM64EC_
+#    define _ARM64EC_ 1
+#  endif
+#endif
+
 #ifndef _X86_
    /* MS does not prefix symbols by underscores for 64-bit.  */
 #  ifndef __MINGW_USE_UNDERSCORE_PREFIX
diff --git a/mingw-w64-headers/include/winnt.h b/mingw-w64-headers/include/winnt.h
index 5179840f4..f232ad4a7 100644
--- a/mingw-w64-headers/include/winnt.h
+++ b/mingw-w64-headers/include/winnt.h
@@ -48,6 +48,13 @@ extern "C" {
 #endif
 #endif /* _ARM64_ */
 
+#if defined(__arm64ec__) && \
+  !(defined(_X86_) || defined(__i386__) || defined(_IA64_) || defined (__arm__) || defined(__aarch64__))
+#if !defined(_ARM64EC_)
+#define _ARM64EC_
+#endif
+#endif /* _ARM64EC_ */
+
 #if defined(__ia64__) && \
   !(defined(_X86_) || defined(__x86_64) || defined(_AMD64_) || defined (__arm__) || defined(__aarch64__))
 #if !defined(_IA64_)

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to