From e9d19b38c88eecdef254a74c22c504fc8db9b355 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 5 Jul 2013 17:21:06 -0700 Subject: [PATCH] common/crc32c: skip cpu detection incantation on not x86_64 On i386 this fails to build with common/crc32c-intel.c: In function 'ceph_have_crc32c_intel': error: common/crc32c-intel.c:79:9: PIC register clobbered by 'ebx' in 'asm' ARM had more to complain about. Not sure where this test came from, but it is clearly not meant for anything other than x86_64. Signed-off-by: Sage Weil Reviewed-by: Samuel Just --- src/common/crc32c-intel.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/common/crc32c-intel.c b/src/common/crc32c-intel.c index 4c3456466637d..1c4689e3b7681 100644 --- a/src/common/crc32c-intel.c +++ b/src/common/crc32c-intel.c @@ -5,6 +5,11 @@ #include #include #include + + +/* this probably isn't specific enough for x86_64? fix me someday */ +#ifdef __LP64__ + /* * * Based on a posting to lkml by Austin Zhang * * Further based on the fio crc32c-intel.c implementation by Jens Axboe. @@ -17,10 +22,6 @@ * * Volume 2A: Instruction Set Reference, A-M * */ -int crc32c_intel_available = 0; - -/* TODO: Need some kind of ifdef here for arch... */ - #if BITS_PER_LONG == 64 #define REX_PRE "0x48, " #define SCALE_F 8 @@ -89,12 +90,24 @@ static void do_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, int ceph_have_crc32c_intel(void) { - unsigned int eax, ebx, ecx, edx; - - eax = 1; - + /* i know how to check this on x86_64... */ + unsigned int eax = 1, ebx, ecx, edx; do_cpuid(&eax, &ebx, &ecx, &edx); if ((ecx & (1 << 20)) != 0) return 1; return 0; } + +#else /* __LP64__ */ + +uint32_t ceph_crc32c_le_intel(uint32_t crc, unsigned char const *data, unsigned length) +{ + return 0; /* this shouldn't get called! */ +} + +int ceph_have_crc32c_intel(void) +{ + return 0; /* clearly not x86_64 */ +} + +#endif -- 2.39.5