mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-15 09:30:06 +00:00
3b5ebe85aa
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 <andreas@gaisler.com>
38 lines
1.4 KiB
Plaintext
38 lines
1.4 KiB
Plaintext
GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
|
|
# Local configure fragment for sysdeps/sparc/sparc32
|
|
|
|
# Test if compiler targets at least sparcv8.
|
|
AC_CACHE_CHECK([for at least sparcv8 support],
|
|
[libc_cv_sparcv8],
|
|
[AC_EGREP_CPP(yes,[#if defined (__sparc_v8__) || defined (__sparc_v9__)
|
|
yes
|
|
#endif
|
|
], libc_cv_sparcv8=yes, libc_cv_sparcv8=no)])
|
|
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 <<EOF
|
|
_Bool foo (int *ptr, int *expected, int desired)
|
|
{
|
|
return __atomic_compare_exchange_n (ptr, expected, desired, 0,
|
|
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
|
|
}
|
|
EOF
|
|
libc_cv_cas_uses_libatomic=no
|
|
if AC_TRY_COMMAND(${CC-cc} -S conftest.c -o conftest.s 1>&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
|