From 3b5ebe85aabfa44583a18a7ef51bc4d387e362c1 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Tue, 12 Nov 2019 19:11:10 +0000 Subject: sparc: Use atomic compiler builtins on sparc This patch removes the arch-specific atomic instruction, relying on compiler builtins. The __sparc32_atomic_locks support is removed and a configure check is added to check if compiler uses libatomic to implement CAS. It also removes the sparc specific sem_* and pthread_barrier_* implementations. It in turn allows buidling against a LEON3/LEON4 sparcv8 target, although it will still be incompatible with generic sparcv9. Checked on sparcv9-linux-gnu and sparc64-linux-gnu. I also checked with build against sparcv8-linux-gnu with -mcpu=leon3. Tested-by: Andreas Larsson --- sysdeps/sparc/sparc32/configure.ac | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'sysdeps/sparc/sparc32/configure.ac') diff --git a/sysdeps/sparc/sparc32/configure.ac b/sysdeps/sparc/sparc32/configure.ac index 2e336f5c16..462a423a2e 100644 --- a/sysdeps/sparc/sparc32/configure.ac +++ b/sysdeps/sparc/sparc32/configure.ac @@ -11,3 +11,27 @@ AC_CACHE_CHECK([for at least sparcv8 support], if test $libc_cv_sparcv8 = no; then AC_MSG_ERROR([no support for pre-v8 sparc]) fi + +# Test if compiler generates external calls to libatomic for CAS operation. +# It is suffice to check for int only and the test is similar of C11 +# atomic_compare_exchange_strong using GCC builtins. +AC_CACHE_CHECK(for external libatomic calls, + libc_cv_cas_uses_libatomic, + [cat > conftest.c <&AS_MESSAGE_LOG_FD); then + if grep '__atomic_compare_exchange_4' conftest.s >/dev/null; then + libc_cv_cas_uses_libatomic=yes + fi + fi + rm -f conftest.c conftest.s + ]) +if test $libc_cv_cas_uses_libatomic = yes; then + AC_MSG_ERROR([external dependency of libatomic is not supported]) +fi -- cgit 1.4.1