MFH: r557165

databases/mariadb105-server: fix build on powerpc64

Add powerpc64 as an alternative to ppc64.

Fix crc32c the same way it was fixed already for databases/rocksdb.

Approved by:	tier 2 blanket
This commit is contained in:
Piotr Kubaj 2020-12-06 19:42:52 +00:00
parent 8cabdc0499
commit 65ca4d5615
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/branches/2020Q4/; revision=557166
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,11 @@
--- mysys/CMakeLists.txt.orig 2020-12-06 15:42:44 UTC
+++ mysys/CMakeLists.txt
@@ -115,7 +115,7 @@ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64
COMPILE_FLAGS "-march=armv8-a+crc+crypto")
ENDIF()
ENDIF()
-ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
+ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(ppc64|powerpc64)")
SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_ppc64.c crc32/crc32c_ppc.c)
SET_SOURCE_FILES_PROPERTIES(crc32/crc32_ppc64.c crc32/crc32c_ppc.c PROPERTIES
COMPILE_FLAGS "${COMPILE_FLAGS} -maltivec -mvsx -mpower8-vector -mcrypto -mpower8-vector")

View File

@ -0,0 +1,24 @@
--- mysys/crc32/crc32c.cc.orig 2020-12-06 15:58:40 UTC
+++ mysys/crc32/crc32c.cc
@@ -475,6 +475,21 @@ static int arch_ppc_probe(void) {
return arch_ppc_crc32;
}
+#elif __FreeBSD__
+#include <machine/cpu.h>
+#include <sys/auxv.h>
+#include <sys/elf_common.h>
+static int arch_ppc_probe(void) {
+ unsigned long cpufeatures;
+ arch_ppc_crc32 = 0;
+
+#if defined(__powerpc64__)
+ elf_aux_info(AT_HWCAP2, &cpufeatures, sizeof(cpufeatures));
+ if (cpufeatures & PPC_FEATURE2_HAS_VEC_CRYPTO) arch_ppc_crc32 = 1;
+#endif /* __powerpc64__ */
+
+ return arch_ppc_crc32;
+}
#endif // __linux__
static bool isAltiVec() {