]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Update vm_basic_types.h for apple silicon
authorJohn Wolfe <jwolfe@vmware.com>
Tue, 27 Oct 2020 00:29:54 +0000 (17:29 -0700)
committerJohn Wolfe <jwolfe@vmware.com>
Tue, 27 Oct 2020 00:29:54 +0000 (17:29 -0700)
Apple silicon compilers will define __arm64__ as their
name for their new CPU. But they also define __aarch64__ which
existing 64-bit ARM CPUs use.  Add a little bit of logic
to enforce and document this.

open-vm-tools/lib/include/vm_basic_types.h

index e46c789fbf4e31c96137465dd92d861779662df0..1eb06c2f7dba6d377f050c213a606109a4c14915 100644 (file)
 #include "includeCheck.h"
 
 /*
- * Macros __i386__ and __ia64 are intrinsically defined by GCC
+ * Standardize MSVC arch macros to GCC arch macros.
  */
 #if defined _MSC_VER && defined _M_X64
-#  define __x86_64__
+#  define __x86_64__ 1
 #elif defined _MSC_VER && defined _M_IX86
-#  define __i386__
+#  define __i386__ 1
+#elif defined _MSC_VER && defined _M_ARM64
+#  define __aarch64__ 1
+#elif defined _MSC_VER && defined _M_ARM
+#  define __arm__ 1
+#endif
+
+/*
+ * Apple/Darwin uses __arm64__, but defines the more standard
+ * __aarch64__ too. Code below assumes __aarch64__.
+ */
+#if defined __arm64__ && !defined __aarch64__
+#  error Unexpected: defined __arm64__ without __aarch64__
 #endif
 
 /*