]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
fix(dnsdist): Detect compiler support for ipcrypt on aarch64
authorPieter Lexis <pieter.lexis@powerdns.com>
Tue, 21 Oct 2025 09:02:25 +0000 (11:02 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Tue, 21 Oct 2025 14:51:09 +0000 (16:51 +0200)
The `uint64x2_t` type is not supported for several functions in older
versions of the `arm_neon.h` header (e.g. GCC 13, 14).

pdns/dnsdistdist/configure.ac
pdns/dnsdistdist/ext/ipcrypt2/meson.build
pdns/dnsdistdist/m4/pdns_check_aarch64_uint64x2_t.m4 [new file with mode: 0644]

index afe8ce47289c6ef86f29a331c201c6e53e2af93b..2297d1a78b27186ca5680083dd62d1ff80adbf67 100644 (file)
@@ -146,6 +146,7 @@ AS_IF([test "x$enable_yaml" != "xno"], [
 DNSDIST_WITH_CDB
 PDNS_CHECK_LMDB
 PDNS_ENABLE_IPCIPHER
+PDNS_CHECK_AARCH64_UINT64X2_T
 
 AX_CXX_COMPILE_STDCXX_17([noext], [mandatory])
 
index ce9636fb2f001754dbf3ad8bc9eb9f01f21c841b..6be41f48c0930151439cfa361179d7c95d7b41db 100644 (file)
@@ -1,3 +1,21 @@
+if target_machine.cpu_family() == 'aarch64'
+  code = '''
+#    if defined(_MSC_VER) && defined(_M_ARM64)
+#        include <arm64_neon.h>
+#    else
+#        include <arm_neon.h>
+#    endif
+int main() {
+  uint64x2_t foo = {0, 0};
+  uint64x2_t bar = vshrq_n_u8(foo, 1);
+  return 0;
+}
+'''
+  compiler = meson.get_compiler('cpp')
+  result = compiler.compiles(code, name: 'uint64x2_t tests')
+  assert(result, 'Compiler does not support calculation with uint64x2_t on ARM64')
+endif
+
 lib_ipcrypt2 = static_library(
   'ipcrypt2',
   'ipcrypt2.c',
diff --git a/pdns/dnsdistdist/m4/pdns_check_aarch64_uint64x2_t.m4 b/pdns/dnsdistdist/m4/pdns_check_aarch64_uint64x2_t.m4
new file mode 100644 (file)
index 0000000..96c2437
--- /dev/null
@@ -0,0 +1,24 @@
+AC_DEFUN([PDNS_CHECK_AARCH64_UINT64X2_T], [
+  AC_CANONICAL_BUILD()
+  AS_IF([test "$build_cpu" = "aarch64"], [
+    AC_MSG_CHECKING([whether the compiler supports calculations with uint64x2_t])
+    AC_LANG_PUSH([C++])
+    AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#    if defined(_MSC_VER) && defined(_M_ARM64)
+#        include <arm64_neon.h>
+#    else
+#        include <arm_neon.h>
+#    endif
+int main() {
+  uint64x2_t foo = {0, 0};
+  uint64x2_t bar = vshrq_n_u8(foo, 1);
+  return 0;
+}
+    ])],[
+    AC_MSG_RESULT([ok])
+    ],[
+    AC_MSG_FAILURE([no])
+    ])
+    AC_LANG_POP()
+  ])
+])