summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid CARLIER <devnexen@gmail.com>2021-01-23 17:50:24 +0000
committerRobert Bindar <robert@mariadb.org>2021-01-28 15:42:17 +0200
commita2cd2cd328d20e4f1ce52140be1d2b8f02f2b270 (patch)
tree2cd673aa87c9c598fc86726fc6e0bdd3d51e327c
parent744e9752d887c3be20c655d882f6ec1b7e0fd727 (diff)
downloadmariadb-git-bb-10.5-robert-build.tar.gz
Mac M1 build support proposal (minus rocksdb option)bb-10.5-robert-build
-rw-r--r--include/my_global.h2
-rw-r--r--mysys/crc32/crc32_arm64.c24
2 files changed, 25 insertions, 1 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 081e4d6e932..da0d9920e06 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -152,7 +152,7 @@
# if defined(__i386__) || defined(__ppc__)
# define SIZEOF_CHARP 4
# define SIZEOF_LONG 4
-# elif defined(__x86_64__) || defined(__ppc64__)
+# elif defined(__x86_64__) || defined(__ppc64__) || defined(__aarch64__) || defined(__arm64__)
# define SIZEOF_CHARP 8
# define SIZEOF_LONG 8
# else
diff --git a/mysys/crc32/crc32_arm64.c b/mysys/crc32/crc32_arm64.c
index 02c43c350c8..62606c7ddea 100644
--- a/mysys/crc32/crc32_arm64.c
+++ b/mysys/crc32/crc32_arm64.c
@@ -4,6 +4,29 @@
#if defined(HAVE_ARMV8_CRC)
+#if defined(__APPLE__)
+#include <sys/sysctl.h>
+
+static int pmull_supported;
+
+int crc32_aarch64_available(void)
+{
+ int ret;
+ size_t len = sizeof(ret);
+ if (sysctlbyname("hw.optional.armv8_crc32", &ret, &len, NULL, 0) == -1)
+ return 0;
+ return ret;
+}
+
+const char *crc32c_aarch64_available(void)
+{
+ if (crc32_aarch64_available() == 0)
+ return NULL;
+ pmull_supported = 1;
+ return "Using ARMv8 crc32 + pmull instructions";
+}
+
+#else
#include <sys/auxv.h>
#if defined(__FreeBSD__)
static unsigned long getauxval(unsigned int key)
@@ -50,6 +73,7 @@ const char *crc32c_aarch64_available(void)
return "Using ARMv8 crc32 instructions";
}
+#endif /* __APPLE__ */
#endif /* HAVE_ARMV8_CRC */
#ifndef HAVE_ARMV8_CRC_CRYPTO_INTRINSICS