databases/galera26: fix build on aarch64

The __bswapXX_var macro are not available on arm*, use bswapXX instead
Add cpu feature detection on arm*

PR:		250664
Reported by:	Vincent Milum Jr
Approved by:	portmgr (tier-2 blanket)
This commit is contained in:
Mikael Urankar 2020-11-09 15:59:42 +00:00
parent 528f8f7211
commit 7a6e9183c8
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=554729
4 changed files with 50 additions and 3 deletions

View file

@ -13,9 +13,6 @@ COMMENT= Synchronous multi-master replication engine
LICENSE= GPLv2
BROKEN_aarch64= fails to compile: gu_int128.h: use of undeclared identifier '__bswap64_var'
BROKEN_armv6= fails to compile: gu_int128.h: use of undeclared identifier '__bswap64_var'
BROKEN_armv7= fails to compile: gu_int128.h: use of undeclared identifier '__bswap64_var'
NOT_FOR_ARCHS= i386
# On i386 older versions of clang produce:
# cannot compile this atomic library call yet ... __atomic_add_fetch

View file

@ -0,0 +1,12 @@
--- galerautils/SConscript.orig 2020-10-27 20:24:02 UTC
+++ galerautils/SConscript
@@ -48,7 +48,9 @@ if not crc32c_no_hardware:
int main()
{
+ #if defined(__linux__)
(void)getauxval(AT_HWCAP);
+ #endif
(void)__crc32b(0, 0);
(void)__crc32h(0, 0);

View file

@ -0,0 +1,22 @@
--- galerautils/src/gu_byteswap.h.orig 2020-10-12 06:33:51 UTC
+++ galerautils/src/gu_byteswap.h
@@ -54,10 +54,15 @@ static GU_FORCE_INLINE uint64_t GU_ROTL64 (uint64_t x,
# define gu_bswap32 _OSSwapInt32
# define gu_bswap64 _OSSwapInt64
#elif defined(__FreeBSD__)
-/* do not use bswapXX, because gcc44 gives old-style cast warnings */
-# define gu_bswap16 __bswap16_var
-# define gu_bswap32 __bswap32_var
-# define gu_bswap64 __bswap64_var
+# if defined(__aarch64__) || defined(__arm__)
+# define gu_bswap16 bswap16
+# define gu_bswap32 bswap32
+# define gu_bswap64 bswap64
+# else
+# define gu_bswap16 __bswap16_var
+# define gu_bswap32 __bswap32_var
+# define gu_bswap64 __bswap64_var
+# endif // __FreeBSD__
#elif defined(__sun__)
# define gu_bswap16 BSWAP_16
# define gu_bswap32 BSWAP_32

View file

@ -0,0 +1,16 @@
--- galerautils/src/gu_crc32c_arm64.c.orig 2020-10-27 20:24:41 UTC
+++ galerautils/src/gu_crc32c_arm64.c
@@ -74,7 +74,13 @@ gu_crc32c_arm64(gu_crc32c_t state, const void* data, s
gu_crc32c_func_t
gu_crc32c_hardware()
{
+#if defined(__linux__)
unsigned long int const hwcaps = getauxval(AT_HWCAP);
+#endif
+#if defined(__FreeBSD__)
+ unsigned long hwcaps;
+ elf_aux_info(AT_HWCAP, &hwcaps, sizeof(hwcaps));
+#endif
if (hwcaps & HWCAP_CRC32)
{
gu_info ("CRC-32C: using hardware acceleration.");