#
# Make sure that calling uatomic_inc on a 64-bit integer doesn't cause a link
# error on _uatomic_link_error, which is how liburcu signals that it doesn't
-# support atomic operations on 64-bit data types.
+# support atomic operations on 64-bit data types for its generic
+# implementation (which relies on compiler builtins). For certain archs
+# where liburcu carries its own implementation (such as x86_32), it
+# signals lack of support during runtime by emitting an illegal
+# instruction, so we also need to check CAA_BITS_PER_LONG to detect that.
#
AC_DEFUN([AC_HAVE_LIBURCU_ATOMIC64],
[ AC_MSG_CHECKING([for atomic64_t support in liburcu])
[ AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <urcu.h>
+#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
]], [[
long long f = 3;
+
+BUILD_BUG_ON(CAA_BITS_PER_LONG < 64);
uatomic_inc(&f);
]])
], have_liburcu_atomic64=yes