From: Ondřej Surý Date: Thu, 1 Jun 2023 11:38:42 +0000 (+0200) Subject: Disable URCU inlining if inlined rcu_dereference() fails to compile X-Git-Tag: v9.19.14~12^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f760ee3f8ce205cfe3620e7f2e0f97429f7c2beb;p=thirdparty%2Fbind9.git Disable URCU inlining if inlined rcu_dereference() fails to compile 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. --- diff --git a/configure.ac b/configure.ac index 44e5b201ed8..247846f1704 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ]], + [[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. # diff --git a/lib/isc/include/isc/urcu.h b/lib/isc/include/isc/urcu.h index 48a1ac46dad..42a410f5555 100644 --- a/lib/isc/include/isc/urcu.h +++ b/lib/isc/include/isc/urcu.h @@ -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 #elif defined(RCU_QSBR)