Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Feb 2022 17:19:56 GMT
From:      Mikael Urankar <mikael@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: b042a3d8ca08 - main - databases/mysql80-server: Fix build on aarch64
Message-ID:  <202202271719.21RHJuqY078429@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mikael:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b042a3d8ca08c0da0f423e0afe49c8e512f5d8ed

commit b042a3d8ca08c0da0f423e0afe49c8e512f5d8ed
Author:     Daniel O'Connor <darius@dons.net.au>
AuthorDate: 2022-02-27 17:08:02 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2022-02-27 17:12:20 +0000

    databases/mysql80-server: Fix build on aarch64
    
      - Replace getauxval with the FreeBSD variant (elf_aux_info)
      - ifdef some gcc'ism and pass the correct cflags for clang
    
    Approved by:    portmgr (build fix blanket)
    PR:             261660
---
 databases/mysql80-server/Makefile                  |   1 +
 .../files/patch-storage_innobase_ut_crc32.cc       | 114 +++++++++++++++++++++
 2 files changed, 115 insertions(+)

diff --git a/databases/mysql80-server/Makefile b/databases/mysql80-server/Makefile
index ba3a5232c6f9..d7c5c133cc6f 100644
--- a/databases/mysql80-server/Makefile
+++ b/databases/mysql80-server/Makefile
@@ -55,6 +55,7 @@ BUILD_DEPENDS_powerpc64le=	libunwind>0:devel/libunwind
 
 CMAKE_BUILD_TYPE=	Release
 CFLAGS+=		-fPIC -DNDEBUG -malign-double
+CFLAGS_aarch64?=	-march=armv8-a+crc+crypto
 
 CMAKE_ARGS+=	-DINSTALL_LAYOUT=FREEBSD \
 		-DINSTALL_LDCONFIGDIR="${LOCALBASE}/libdata/ldconfig" \
diff --git a/databases/mysql80-server/files/patch-storage_innobase_ut_crc32.cc b/databases/mysql80-server/files/patch-storage_innobase_ut_crc32.cc
new file mode 100644
index 000000000000..0e42c96a1843
--- /dev/null
+++ b/databases/mysql80-server/files/patch-storage_innobase_ut_crc32.cc
@@ -0,0 +1,114 @@
+--- storage/innobase/ut/crc32.cc.orig	2021-12-17 17:07:27 UTC
++++ storage/innobase/ut/crc32.cc
+@@ -111,7 +111,9 @@ external tools. */
+ #endif /* CRC32_ARM64 */
+ 
+ #ifdef CRC32_ARM64_DEFAULT
++#ifndef __FreeBSD__
+ #include <asm/hwcap.h>
++#endif
+ #include <sys/auxv.h>
+ #endif /* CRC32_ARM64_DEFAULT */
+ 
+@@ -360,8 +362,25 @@ bool can_use_poly_mul() { return true; }
+ #endif /* CRC32_ARM64_APPLE */
+ 
+ #ifdef CRC32_ARM64_DEFAULT
++#ifdef __FreeBSD__
++bool can_use_crc32() {
++  unsigned long capabilities;
++
++  if (elf_aux_info(AT_HWCAP, &capabilities, sizeof(unsigned long)))
++    return false;
++  return capabilities & HWCAP_CRC32;
++}
++bool can_use_poly_mul() {
++  unsigned long capabilities;
++
++  if (elf_aux_info(AT_HWCAP, &capabilities, sizeof(unsigned long)))
++    return false;
++  return capabilities & HWCAP_CRC32;
++}
++#else
+ bool can_use_crc32() { return getauxval(AT_HWCAP) & HWCAP_CRC32; }
+ bool can_use_poly_mul() { return getauxval(AT_HWCAP) & HWCAP_PMULL; }
++#endif
+ #endif /* CRC32_ARM64_DEFAULT */
+ 
+ /** A helper template to statically unroll a loop with a fixed number of
+@@ -470,25 +489,39 @@ uint64_t crc32_impl::update(uint64_t crc, uint64_t dat
+ 
+ #ifdef CRC32_ARM64
+ #ifdef CRC32_ARM64_DEFAULT
++#ifndef __clang__
+ MY_ATTRIBUTE((target("+crc")))
++#else
++MY_ATTRIBUTE((target("crc")))
++#endif
+ #endif /* CRC32_ARM64_DEFAULT */
+ uint32_t crc32_impl::update(uint32_t crc, unsigned char data) {
+   return __crc32cb(crc, data);
+ }
+ #ifdef CRC32_ARM64_DEFAULT
++#ifndef __clang__
+ MY_ATTRIBUTE((target("+crc")))
++#endif
+ #endif /* CRC32_ARM64_DEFAULT */
+ uint32_t crc32_impl::update(uint32_t crc, uint16_t data) {
+   return __crc32ch(crc, data);
+ }
+ #ifdef CRC32_ARM64_DEFAULT
++#ifndef __clang__
+ MY_ATTRIBUTE((target("+crc")))
++#else
++MY_ATTRIBUTE((target("crc")))
++#endif
+ #endif /* CRC32_ARM64_DEFAULT */
+ uint32_t crc32_impl::update(uint32_t crc, uint32_t data) {
+   return __crc32cw(crc, data);
+ }
+ #ifdef CRC32_ARM64_DEFAULT
++#ifndef __clang__
+ MY_ATTRIBUTE((target("+crc")))
++#else
++MY_ATTRIBUTE((target("crc")))
++#endif
+ #endif /* CRC32_ARM64_DEFAULT */
+ uint64_t crc32_impl::update(uint64_t crc, uint64_t data) {
+   return (uint64_t)__crc32cd((uint32_t)crc, data);
+@@ -534,7 +567,11 @@ static inline uint64_t less_significant_half_of_poly12
+ }
+ template <uint32_t w>
+ #ifdef CRC32_ARM64_DEFAULT
++#ifndef __clang__
+ MY_ATTRIBUTE((target("+crypto")))
++#else
++MY_ATTRIBUTE((target("crypto")))
++#endif
+ #endif /* CRC32_ARM64_DEFAULT */
+ uint64_t use_pclmul::polynomial_mul_rev(uint32_t rev_u) {
+   constexpr uint64_t flipped_w = flip_at_32(w);
+@@ -777,7 +814,11 @@ MY_ATTRIBUTE((target("sse4.2,pclmul"), flatten))
+ MY_ATTRIBUTE((flatten))
+ #endif /* CRC32_ARM64_APPLE */
+ #ifdef CRC32_ARM64_DEFAULT
++#ifndef __clang__
+ MY_ATTRIBUTE((target("+crc+crypto"), flatten))
++#else
++MY_ATTRIBUTE((target("crc,crypto")))
++#endif
+ #endif /* CRC32_ARM64_DEFAULT */
+ uint32_t crc32_using_pclmul(const byte *data, size_t len) {
+   return crc32<use_pclmul>(0, data, len);
+@@ -797,7 +838,11 @@ MY_ATTRIBUTE((target("sse4.2"), flatten))
+ MY_ATTRIBUTE((flatten))
+ #endif /* CRC32_ARM64_APPLE */
+ #ifdef CRC32_ARM64_DEFAULT
++#ifndef __clang__
+ MY_ATTRIBUTE((target("+crc"), flatten))
++#else
++MY_ATTRIBUTE((target("crc")))
++#endif
+ #endif /* CRC32_ARM64_DEFAULT */
+ uint32_t crc32_using_unrolled_loop_poly_mul(const byte *data, size_t len) {
+   return crc32<use_unrolled_loop_poly_mul>(0, data, len);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202202271719.21RHJuqY078429>