From 8a077bd2a93d3e12e20013e76e57a35240f5f481 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 1 Sep 2017 17:32:22 +0800 Subject: [PATCH] arch/arm: set ceph_arch_aarch64_crc32 only if the build host supports crc32cx 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 --- src/arch/arm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/arch/arm.c b/src/arch/arm.c index e3cfb5c594f..a8562f59674 100644 --- a/src/arch/arm.c +++ b/src/arch/arm.c @@ -1,3 +1,4 @@ +#include "acconfig.h" #include "arch/probe.h" /* flags we export */ @@ -45,10 +46,8 @@ int ceph_arch_arm_probe(void) 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) -- 2.39.5