[lttng-dev] [PATCH 1/7] Require __atomic builtins to build
Ondřej Surý
ondrej at sury.org
Fri Mar 17 17:37:49 EDT 2023
Add autoconf checks for all __atomic builtins that urcu require, and
adjust the gcc and clang versions in the README.md.
Signed-off-by: Ondřej Surý <ondrej at sury.org>
---
README.md | 33 +++++++++------------------------
configure.ac | 15 +++++++++++++++
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/README.md b/README.md
index ba5bb08..a65a07a 100644
--- a/README.md
+++ b/README.md
@@ -68,30 +68,15 @@ Should also work on:
(more testing needed before claiming support for these OS).
-Linux ARM depends on running a Linux kernel 2.6.15 or better, GCC 4.4 or
-better.
-
-The C compiler used needs to support at least C99. The C++ compiler used
-needs to support at least C++11.
-
-The GCC compiler versions 3.3, 3.4, 4.0, 4.1, 4.2, 4.3, 4.4 and 4.5 are
-supported, with the following exceptions:
-
- - GCC 3.3 and 3.4 have a bug that prevents them from generating volatile
- accesses to offsets in a TLS structure on 32-bit x86. These versions are
- therefore not compatible with `liburcu` on x86 32-bit
- (i386, i486, i586, i686).
- The problem has been reported to the GCC community:
- <http://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg281255.html>
- - GCC 3.3 cannot match the "xchg" instruction on 32-bit x86 build.
- See <http://kerneltrap.org/node/7507>
- - Alpha, ia64 and ARM architectures depend on GCC 4.x with atomic builtins
- support. For ARM this was introduced with GCC 4.4:
- <http://gcc.gnu.org/gcc-4.4/changes.html>.
- - Linux aarch64 depends on GCC 5.1 or better because prior versions
- perform unsafe access to deallocated stack.
-
-Clang version 3.0 (based on LLVM 3.0) is supported.
+Linux ARM depends on running a Linux kernel 2.6.15 or better.
+
+The C compiler used needs to support at least C99 and __atomic
+builtins. The C++ compiler used needs to support at least C++11
+and __atomic builtins.
+
+The GCC compiler versions 4.7 or better are supported.
+
+Clang version 3.1 (based on LLVM 3.1) is supported.
Glibc >= 2.4 should work but the older version we test against is
currently 2.17.
diff --git a/configure.ac b/configure.ac
index 909cf1d..cb7ba18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -198,6 +198,21 @@ AC_SEARCH_LIBS([clock_gettime], [rt], [
AC_DEFINE([CONFIG_RCU_HAVE_CLOCK_GETTIME], [1], [clock_gettime() is detected.])
])
+# Require __atomic builtins
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[int x, y;]],
+ [[__atomic_store_n(&x, 0, __ATOMIC_RELEASE);
+ __atomic_load_n(&x, __ATOMIC_CONSUME);
+ y = __atomic_exchange_n(&x, 1, __ATOMIC_ACQ_REL);
+ __atomic_compare_exchange_n(&x, &y, 0, 0, __ATOMIC_ACQ_REL, __ATOMIC_CONSUME);
+ __atomic_add_fetch(&x, 1, __ATOMIC_ACQ_REL);
+ __atomic_sub_fetch(&x, 1, __ATOMIC_ACQ_REL);
+ __atomic_and_fetch(&x, 0x01, __ATOMIC_ACQ_REL);
+ __atomic_or_fetch(&x, 0x01, __ATOMIC_ACQ_REL);
+ __atomic_thread_fence(__ATOMIC_ACQ_REL)]])],
+ [],
+ [AC_MSG_ERROR([The compiler does not support __atomic builtins])])
## ##
## Optional features selection ##
--
2.39.2
More information about the lttng-dev
mailing list