]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Disable URCU inlining if inlined rcu_dereference() fails to compile
authorOndřej Surý <ondrej@isc.org>
Thu, 1 Jun 2023 11:38:42 +0000 (13:38 +0200)
committerOndřej Surý <ondrej@isc.org>
Thu, 1 Jun 2023 14:51:38 +0000 (16:51 +0200)
In some cases, the inlined version rcu_dereference() would not compile
when working on pointer to opaque struct (namely Ubuntu Jammy).  Detect
such condition in the autoconf and disable the inlining of the small
functions if it breaks the build.

configure.ac
lib/isc/include/isc/urcu.h

index 44e5b201ed8858a1746992eac9729f19f2e86a86..247846f1704cb623be01aa016959244646d7ab59 100644 (file)
@@ -247,6 +247,19 @@ AC_DEFINE_UNQUOTED([RCU_VERSION], ["$RCU_VERSION"], [Compile-time Userspace-RCU
 CFLAGS="$CFLAGS $LIBURCU_CFLAGS"
 LIBS="$LIBS $LIBURCU_LIBS"
 
+#
+# Userspace-RCU inlining doesn't work for rcu_deference() with some combination
+# of C compiler and library version.
+#
+AC_MSG_CHECKING([whether we can inline small liburcu functions])
+AC_COMPILE_IFELSE(
+  [AC_LANG_PROGRAM([[#define URCU_INLINE_SMALL_FUNCTIONS 1
+                    #include <urcu.h>]],
+                  [[struct opaque *a; struct opaque *b = rcu_dereference(a);]])],
+  [AC_MSG_RESULT([yes])
+   AC_DEFINE([URCU_INLINE_SMALL_FUNCTIONS], [1], [Inline small (less than 10 lines) functions])],
+  [AC_MSG_RESULT([no])])
+
 # Fuzzing is not included in pairwise testing as fuzzing tools are
 # not present in the relevant Docker image.
 #
index 48a1ac46dad6a4bf7d3e4e2bd34bce2b485f878a..42a410f5555f5ed226174991bdd6a57b9cb18d39 100644 (file)
@@ -19,9 +19,6 @@
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-parameter"
 
-/* Inline small (less than 10 lines) functions */
-#define URCU_INLINE_SMALL_FUNCTIONS
-
 #if defined(RCU_MEMBARRIER) || defined(RCU_MB) || defined(RCU_SIGNAL)
 #include <urcu.h>
 #elif defined(RCU_QSBR)