blob: 1856c1af76ce11fae0379086fa5cf3fb40b0311f [file] [log] [blame]
Andrew Geisslerbffdb3e2020-08-21 16:13:29 -05001From d88ea260882ca414e940cd6af225617f00503f71 Mon Sep 17 00:00:00 2001
2From: Krunal Bauskar <krunalbauskar@gmail.com>
3Date: Mon, 27 Jul 2020 18:38:10 +0800
4Subject: [PATCH] MDEV-23137: RocksDB: undefined reference to crc32c_arm64
5
6RocksDB fails to build on arm64: undefined reference to
7 `crc32c_arm64(unsigned int, unsigned char const*, unsigned int)'
8
9MariaDB uses storage/rocksdb/build_rocksdb.cmake to compile RocksDB.
10Said cmake missed adding crc32c_arm64 compilation target so if
11machine native architecture supported crc32 then complier would enable
12usage of function defined in crc32c_arm64 causing the listed error.
13
14Added crc32c_arm64 complition target.
15
16closes #1642
17
18Upstream-Status: Backport
19
20Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
21---
22 storage/rocksdb/build_rocksdb.cmake | 10 ++++++++++
23 1 file changed, 10 insertions(+)
24
25diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake
26index 3f3dca7e990..7d2252c5f77 100644
27--- a/storage/rocksdb/build_rocksdb.cmake
28+++ b/storage/rocksdb/build_rocksdb.cmake
29@@ -442,6 +442,16 @@ else()
30 util/crc32c_ppc.c
31 util/crc32c_ppc_asm.S)
32 endif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
33+ # aarch
34+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
35+ CHECK_CXX_COMPILER_FLAG("-march=armv8-a+crc+crypto" HAS_ARMV8_CRC)
36+ if(HAS_ARMV8_CRC)
37+ message(STATUS " HAS_ARMV8_CRC yes")
38+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8-a+crc+crypto -Wno-unused-function")
39+ list(APPEND ROCKSDB_SOURCES
40+ util/crc32c_arm64.cc)
41+ endif(HAS_ARMV8_CRC)
42+ endif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
43 endif()
44 SET(SOURCES)
45 FOREACH(s ${ROCKSDB_SOURCES})
46--
472.17.1
48