HWCAP_CRC32 is defined by the linux kernel source. so it's defined as
long as the linux kernel source is new enough. but the compiler on the
building host is not necessarily able to build the `crc32cx`
instruction. if we happen to have an incapable compiler on a machine with
recent linux kernel source, the dummy "ceph_crc32c_aarch64()" will be
selected by `ceph_choose_crc32()`. and it always return 0.
See-also: http://tracker.ceph.com/issues/19705
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit
8a077bd2a93d3e12e20013e76e57a35240f5f481)
+#include "acconfig.h"
#include "arch/probe.h"
/* flags we export */
ceph_arch_neon = (get_hwcap() & HWCAP_NEON) == HWCAP_NEON;
#elif __aarch64__ && __linux__
ceph_arch_neon = (get_hwcap() & HWCAP_ASIMD) == HWCAP_ASIMD;
-# ifdef HWCAP_CRC32
+# if defined(HAVE_ARMV8_CRC) && defined(HWCAP_CRC32)
ceph_arch_aarch64_crc32 = (get_hwcap() & HWCAP_CRC32) == HWCAP_CRC32;
-# else
- ceph_arch_aarch64_crc32 = 0; // sorry!
# endif
#else
if (0)