From: Pieter Lexis Date: Tue, 21 Oct 2025 09:02:25 +0000 (+0200) Subject: fix(dnsdist): Detect compiler support for ipcrypt on aarch64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c7dc5afdeabb0d3cb36af15cbfb9cf8cd910e86e;p=thirdparty%2Fpdns.git fix(dnsdist): Detect compiler support for ipcrypt on aarch64 The `uint64x2_t` type is not supported for several functions in older versions of the `arm_neon.h` header (e.g. GCC 13, 14). --- diff --git a/pdns/dnsdistdist/configure.ac b/pdns/dnsdistdist/configure.ac index afe8ce4728..2297d1a78b 100644 --- a/pdns/dnsdistdist/configure.ac +++ b/pdns/dnsdistdist/configure.ac @@ -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]) diff --git a/pdns/dnsdistdist/ext/ipcrypt2/meson.build b/pdns/dnsdistdist/ext/ipcrypt2/meson.build index ce9636fb2f..6be41f48c0 100644 --- a/pdns/dnsdistdist/ext/ipcrypt2/meson.build +++ b/pdns/dnsdistdist/ext/ipcrypt2/meson.build @@ -1,3 +1,21 @@ +if target_machine.cpu_family() == 'aarch64' + code = ''' +# if defined(_MSC_VER) && defined(_M_ARM64) +# include +# else +# include +# 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 index 0000000000..96c2437ac7 --- /dev/null +++ b/pdns/dnsdistdist/m4/pdns_check_aarch64_uint64x2_t.m4 @@ -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 +# else +# include +# 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() + ]) +])