]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Revert __HAVE_64B_ATOMICS configure check
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 13 Nov 2025 17:26:08 +0000 (14:26 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 14 Nov 2025 17:05:20 +0000 (14:05 -0300)
The 53807741fb44edb8e7c094cb5e7d4ff4e92a6ec1 added a configure check
for 64-bit atomic operations that were not previously enabled on some
32-bit ABIs.

However, the NPTL semaphore code casts a sem_t to a new_sem and issues
a 64-bit atomic operation for __HAVE_64B_ATOMICS.  Since sem_t has
32-bit alignment on 32-bit architectures, this prevents the use of
64-bit atomics even if the ABI supports them.

Assume 64-bit atomic support from __WORDSIZE, which maps to how glibc
defines it before the broken change.  Also rename __HAVE_64B_ATOMICS
to USE_64B_ATOMICS to define better the flag meaning.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
28 files changed:
config.h.in
configure
configure.ac
htl/pt-internal.h
include/atomic.h
include/atomic_wide_counter.h
misc/atomic_wide_counter.c
nptl/pthread_cond_common.c
nptl/sem_getvalue.c
nptl/sem_init.c
nptl/sem_post.c
nptl/sem_waitcommon.c
nptl/semaphoreP.h
nptl/tst-sem11.c
nptl/tst-sem13.c
stdlib/setenv.h
sysdeps/alpha/atomic-machine.h
sysdeps/generic/atomic-machine.h
sysdeps/htl/sem-destroy.c
sysdeps/htl/sem-getvalue.c
sysdeps/htl/sem-post.c
sysdeps/htl/sem-timedwait.c
sysdeps/htl/sem-waitfast.c
sysdeps/nptl/internaltypes.h
sysdeps/nptl/rseq-access.h
sysdeps/riscv/atomic-machine.h
sysdeps/sparc/atomic-machine.h
sysdeps/x86/atomic-machine.h

index 4204dbf123655510fa839490ad6cd87794af5d31..a7cc17df8ede5c803ed73dfff5c1b52828a48b39 100644 (file)
 /* An integer used to scale the timeout of test programs.  */
 #define TIMEOUTFACTOR 1
 
-/* Set to 1 if 64 bit atomics are supported.  */
-#undef __HAVE_64B_ATOMICS 0
-
 /*
 \f */
 
index df51b0c1a37a84162d87be2e0124dd1a41a76cc9..d1e956cc3d3b8392f01b20cd1643ad0a26e2b020 100755 (executable)
--- a/configure
+++ b/configure
@@ -7702,48 +7702,6 @@ if test "$libc_cv_gcc_builtin_memset" = yes ; then
 
 fi
 
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit atomic support" >&5
-printf %s "checking for 64-bit atomic support... " >&6; }
-if test ${libc_cv_gcc_has_64b_atomics+y}
-then :
-  printf %s "(cached) " >&6
-else case e in #(
-  e) cat > conftest.c <<\EOF
-typedef struct { long long t; } X;
-extern void has_64b_atomics(void);
-void f(void)
-{
-  X x;
-  /* Use address of structure with 64-bit type.  This avoids incorrect
-     implementations which return true even if long long is not 64-bit aligned.
-     This works on GCC and LLVM - other cases have bugs and they disagree.  */
-  _Static_assert (__atomic_always_lock_free (sizeof (x), &x), "no_64b_atomics");
-}
-EOF
-if { ac_try='${CC-cc} -O2 -S conftest.c'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; };
-then
-  libc_cv_gcc_has_64b_atomics=yes
-else
-  libc_cv_gcc_has_64b_atomics=no
-fi
-rm -f conftest*  ;;
-esac
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_gcc_has_64b_atomics" >&5
-printf "%s\n" "$libc_cv_gcc_has_64b_atomics" >&6; }
-if test "$libc_cv_gcc_has_64b_atomics" = yes; then
-  printf "%s\n" "#define __HAVE_64B_ATOMICS 1" >>confdefs.h
-
-else
-  printf "%s\n" "#define __HAVE_64B_ATOMICS 0" >>confdefs.h
-
- fi
-
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for redirection of built-in functions" >&5
 printf %s "checking for redirection of built-in functions... " >&6; }
 if test ${libc_cv_gcc_builtin_redirection+y}
index dd0b7a4c7c4059517ae4345d2fde21f5e8988d3c..35f69f99c1e81c7aedd09e5c2360db3e11068ab2 100644 (file)
@@ -1493,33 +1493,6 @@ if test "$libc_cv_gcc_builtin_memset" = yes ; then
   AC_DEFINE(HAVE_BUILTIN_MEMSET)
 fi
 
-AC_CACHE_CHECK(for 64-bit atomic support, libc_cv_gcc_has_64b_atomics, [dnl
-cat > conftest.c <<\EOF
-typedef struct { long long t; } X;
-extern void has_64b_atomics(void);
-void f(void)
-{
-  X x;
-  /* Use address of structure with 64-bit type.  This avoids incorrect
-     implementations which return true even if long long is not 64-bit aligned.
-     This works on GCC and LLVM - other cases have bugs and they disagree.  */
-  _Static_assert (__atomic_always_lock_free (sizeof (x), &x), "no_64b_atomics");
-}
-EOF
-dnl
-if AC_TRY_COMMAND([${CC-cc} -O2 -S conftest.c]);
-then
-  libc_cv_gcc_has_64b_atomics=yes
-else
-  libc_cv_gcc_has_64b_atomics=no
-fi
-rm -f conftest* ])
-if test "$libc_cv_gcc_has_64b_atomics" = yes; then
-  AC_DEFINE(__HAVE_64B_ATOMICS, 1)
-else
-  AC_DEFINE(__HAVE_64B_ATOMICS, 0)
- fi
-
 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
 cat > conftest.c <<\EOF
 extern char *strstr (const char *, const char *) __asm ("my_strstr");
index c0aa4aa9dca4577dbd923e976e893abb04145749..63dcc0a6ba93442587b4694e3327c1a1ee57a79e 100644 (file)
@@ -343,7 +343,7 @@ libc_hidden_proto (__pthread_default_condattr)
    See nptl implementation for the details.  */
 struct new_sem
 {
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   /* The data field holds both value (in the least-significant 32 bits) and
      nwaiters.  */
 # if __BYTE_ORDER == __LITTLE_ENDIAN
index bac7423ec541fec79c25a32f3d3969c12657ddc9..ed0dfbde3f98af4e9bb094c64c585d4b88891794 100644 (file)
 #endif
 
 
-/* This is equal to 1 iff the architecture supports 64b atomic operations.  */
-#ifndef __HAVE_64B_ATOMICS
-#error Unable to determine if 64-bit atomics are present.
-#endif
-
 /* The following functions are a subset of the atomic operations provided by
    C11.  Usually, a function named atomic_OP_MO(args) is equivalent to C11's
    atomic_OP_explicit(args, memory_order_MO); exceptions noted below.  */
 /* We require 32b atomic operations; some archs also support 64b atomic
    operations.  */
 void __atomic_link_error (void);
-# if __HAVE_64B_ATOMICS == 1
+# if USE_64B_ATOMICS == 1
 #  define __atomic_check_size(mem) \
    if ((sizeof (*mem) != 4) && (sizeof (*mem) != 8))                         \
      __atomic_link_error ();
@@ -142,7 +137,7 @@ void __atomic_link_error (void);
    need other atomic operations of such sizes, and restricting the support to
    loads and stores makes this easier for archs that do not have native
    support for atomic operations to less-than-word-sized data.  */
-# if __HAVE_64B_ATOMICS == 1
+# if USE_64B_ATOMICS == 1
 #  define __atomic_check_size_ls(mem) \
    if ((sizeof (*mem) != 1) && (sizeof (*mem) != 2) && (sizeof (*mem) != 4)   \
        && (sizeof (*mem) != 8))                                                      \
index abf660f7d06d8626c1ab2a447572d3afdad7614a..5b1979e6019499f891603168acf5152048ace331 100644 (file)
@@ -22,7 +22,7 @@
 #include <atomic.h>
 #include <bits/atomic_wide_counter.h>
 
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
 
 static inline uint64_t
 __atomic_wide_counter_load_relaxed (__atomic_wide_counter *c)
@@ -65,7 +65,7 @@ __atomic_wide_counter_fetch_xor_release (__atomic_wide_counter *c,
   return atomic_fetch_xor_release (&c->__value64, val);
 }
 
-#else /* !__HAVE_64B_ATOMICS */
+#else /* !USE_64B_ATOMICS */
 
 uint64_t __atomic_wide_counter_load_relaxed (__atomic_wide_counter *c)
   attribute_hidden;
@@ -98,6 +98,6 @@ __atomic_wide_counter_add_relaxed (__atomic_wide_counter *c,
   __atomic_wide_counter_fetch_add_relaxed (c, val);
 }
 
-#endif /* !__HAVE_64B_ATOMICS */
+#endif /* !USE_64B_ATOMICS */
 
 #endif /* _ATOMIC_WIDE_COUNTER_H */
index e96e595738c339ae18ffc94a567e4854bc40b529..65f4288db29387ceb2801ee0edd5cc469854b058 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <atomic_wide_counter.h>
 
-#if !__HAVE_64B_ATOMICS
+#if !USE_64B_ATOMICS
 
 /* Values we add or xor are less than or equal to 1<<31, so we only
    have to make overflow-and-addition atomic wrt. to concurrent load
@@ -124,4 +124,4 @@ __atomic_wide_counter_load_relaxed (__atomic_wide_counter *c)
   return ((uint64_t) (h & ~((unsigned int) 1 << 31)) << 31) + l;
 }
 
-#endif /* !__HAVE_64B_ATOMICS */
+#endif /* !USE_64B_ATOMICS */
index 2708d262958f26a96e42f494af0012f0cc515d0b..de3580b56fdaeeb53e8146d5479dce5e5e1f663c 100644 (file)
@@ -52,7 +52,7 @@ __condvar_add_g1_start_relaxed (pthread_cond_t *cond, unsigned int val)
   __atomic_wide_counter_add_relaxed (&cond->__data.__g1_start, val);
 }
 
-#if __HAVE_64B_ATOMICS == 1
+#if USE_64B_ATOMICS == 1
 
 static inline uint64_t
 __condvar_fetch_xor_wseq_release (pthread_cond_t *cond, unsigned int val)
@@ -60,7 +60,7 @@ __condvar_fetch_xor_wseq_release (pthread_cond_t *cond, unsigned int val)
   return atomic_fetch_xor_release (&cond->__data.__wseq.__value64, val);
 }
 
-#else /* !__HAVE_64B_ATOMICS */
+#else /* !USE_64B_ATOMICS */
 
 /* The xor operation needs to be an atomic read-modify-write.  The write
    itself is not an issue as it affects just the lower-order half but not bits
@@ -103,7 +103,7 @@ __condvar_fetch_xor_wseq_release (pthread_cond_t *cond, unsigned int val)
   return ((uint64_t) h << 31) + l2;
 }
 
-#endif /* !__HAVE_64B_ATOMICS */
+#endif /* !USE_64B_ATOMICS */
 
 /* The lock that signalers use.  See pthread_cond_wait_common for uses.
    The lock is our normal three-state lock: not acquired (0) / acquired (1) /
index 53012f785a7ed15da015eb00d5330e58ed856c96..80b00be545131e4bab89a11ff8959bcf5b824b37 100644 (file)
@@ -33,7 +33,7 @@ __new_sem_getvalue (sem_t *sem, int *sval)
      necessary, use a stronger MO here and elsewhere (e.g., potentially
      release MO in all places where we consume a token).  */
 
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   *sval = atomic_load_relaxed (&isem->data) & SEM_VALUE_MASK;
 #else
   *sval = atomic_load_relaxed (&isem->value) >> SEM_VALUE_SHIFT;
index 76e1aceb70d1777a0da0deb38b4115a7416d30b5..9cd81803af134fa38cbf8b84b2888aa8d97f8609 100644 (file)
@@ -38,7 +38,7 @@ __new_sem_init (sem_t *sem, int pshared, unsigned int value)
   struct new_sem *isem = (struct new_sem *) sem;
 
   /* Use the values the caller provided.  */
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   isem->data = value;
 #else
   isem->value = value << SEM_VALUE_SHIFT;
index 659e931417e6fc3089511293e954f46395c5297d..e2845dd1aa07eeeb20ef57a1c826ae380bdac176 100644 (file)
@@ -34,7 +34,7 @@ __new_sem_post (sem_t *sem)
   struct new_sem *isem = (struct new_sem *) sem;
   int private = isem->private;
 
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   /* Add a token to the semaphore.  We use release MO to make sure that a
      thread acquiring this token synchronizes with us and other threads that
      added tokens before (the release sequence includes atomic RMW operations
index 95450ee35d0fa13545626702941eeffd36633663..a58df013280e541ae534c6f9e7a700e8f3038cce 100644 (file)
@@ -77,7 +77,7 @@
    requirement because the semaphore must not be destructed while any sem_wait
    is still executing.  */
 
-#if !__HAVE_64B_ATOMICS
+#if !USE_64B_ATOMICS
 static void
 __sem_wait_32_finish (struct new_sem *sem);
 #endif
@@ -87,7 +87,7 @@ __sem_wait_cleanup (void *arg)
 {
   struct new_sem *sem = (struct new_sem *) arg;
 
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   /* Stop being registered as a waiter.  See below for MO.  */
   atomic_fetch_add_relaxed (&sem->data, -((uint64_t) 1 << SEM_NWAITERS_SHIFT));
 #else
@@ -107,7 +107,7 @@ do_futex_wait (struct new_sem *sem, clockid_t clockid,
 {
   int err;
 
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   err = __futex_abstimed_wait_cancelable64 (
       (unsigned int *) &sem->data + SEM_VALUE_OFFSET, 0,
       clockid, abstime,
@@ -132,7 +132,7 @@ __new_sem_wait_fast (struct new_sem *sem, int definitive_result)
      synchronize memory); thus, relaxed MO is sufficient for the initial load
      and the failure path of the CAS.  If the weak CAS fails and we need a
      definitive result, retry.  */
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   uint64_t d = atomic_load_relaxed (&sem->data);
   do
     {
@@ -166,7 +166,7 @@ __new_sem_wait_slow64 (struct new_sem *sem, clockid_t clockid,
 {
   int err = 0;
 
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   /* Add a waiter.  Relaxed MO is sufficient because we can rely on the
      ordering provided by the RMW operations we use.  */
   uint64_t d = atomic_fetch_add_relaxed (&sem->data,
@@ -280,7 +280,7 @@ __new_sem_wait_slow64 (struct new_sem *sem, clockid_t clockid,
          /* If there is no token, wait.  */
          if ((v >> SEM_VALUE_SHIFT) == 0)
            {
-             /* See __HAVE_64B_ATOMICS variant.  */
+             /* See USE_64B_ATOMICS variant.  */
              err = do_futex_wait (sem, clockid, abstime);
              if (err == ETIMEDOUT || err == EINTR)
                {
@@ -313,7 +313,7 @@ error:
 }
 
 /* Stop being a registered waiter (non-64b-atomics code only).  */
-#if !__HAVE_64B_ATOMICS
+#if !USE_64B_ATOMICS
 static void
 __sem_wait_32_finish (struct new_sem *sem)
 {
index 39e0d152f8145e91226943de1b8bf244400b0763..36498529f178c79510c22df8ac4d77c5570e0b70 100644 (file)
@@ -24,7 +24,7 @@
 
 static inline void __new_sem_open_init (struct new_sem *sem, unsigned value)
 {
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   sem->data = value;
 #else
   sem->value = value << SEM_VALUE_SHIFT;
index 872cead8b570a1f8a4db5c3c01a313ea4dfed562..7c946c30d114031dbf69e6bd0f7f46345b060135 100644 (file)
@@ -52,7 +52,7 @@ do_test (void)
       puts ("sem_init failed");
       return 1;
     }
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   if ((u.ns.data >> SEM_NWAITERS_SHIFT) != 0)
 #else
   if (u.ns.nwaiters != 0)
@@ -89,7 +89,7 @@ do_test (void)
       goto again;
     }
 
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   if ((u.ns.data >> SEM_NWAITERS_SHIFT) != 0)
 #else
   if (u.ns.nwaiters != 0)
index d7baa2ae582d563b172b3d4e1eca5ff1ba388fb8..17067dd572e6446d47e6e4304cc1a7ecb6aba98c 100644 (file)
@@ -30,7 +30,7 @@ do_test_wait (waitfn_t waitfn, const char *fnname)
   TEST_VERIFY_EXIT (waitfn (&u.s, &ts) < 0);
   TEST_COMPARE (errno, EINVAL);
 
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   unsigned int nwaiters = (u.ns.data >> SEM_NWAITERS_SHIFT);
 #else
   unsigned int nwaiters = u.ns.nwaiters;
@@ -42,7 +42,7 @@ do_test_wait (waitfn_t waitfn, const char *fnname)
   errno = 0;
   TEST_VERIFY_EXIT (waitfn (&u.s, &ts) < 0);
   TEST_COMPARE (errno, ETIMEDOUT);
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   nwaiters = (u.ns.data >> SEM_NWAITERS_SHIFT);
 #else
   nwaiters = u.ns.nwaiters;
index 7cbf9f2059f91da15dbebb20a9c4d35f434b024b..aed97efd4e3a6deb66bdc56e59a64f2d0b4e67c1 100644 (file)
@@ -61,7 +61,7 @@ __environ_is_from_array_list (char **ep)
    but given that counter wrapround is probably impossible to hit
    (2**32 operations in unsetenv concurrently with getenv), using
    <atomic_wide_counter.h> seems unnecessary.  */
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
 typedef uint64_t environ_counter;
 #else
 typedef uint32_t environ_counter;
index 9aec23174881f2396be65aa9619742387b7ca726..b7ce8c4726d0a6aa2ab770afc35924e5f1d6d51e 100644 (file)
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <stdint.h>
+#ifndef _ALPHA_ATOMIC_MACHINE_H
+#define _ALPHA_ATOMIC_MACHINE_H
+
+#include_next <atomic-machine.h>
 
 #define atomic_write_barrier() __asm ("wmb" : : : "memory");
+
+#endif
index 9f8528c1f2a7943405d83296760bfe9c7a7d6a65..ef72d9ba0d43994d94b9249b146de3519af0beac 100644 (file)
      and adaptive mutexes to optimize spin-wait loops.
 */
 
+#include <bits/wordsize.h>
+
+/* NB: The NPTL semaphore code casts a sem_t to a new_sem and issues a 64-bit
+   atomic operation for USE_64B_ATOMICS.  However, the sem_t has 32-bit
+   alignment on 32-bit architectures, which prevents using 64-bit atomics even
+   if the ABI supports it.  */
+#if __WORDSIZE == 64
+# define USE_64B_ATOMICS 1
+#else
+# define USE_64B_ATOMICS 0
+#endif
+
 #endif /* atomic-machine.h */
index daecf1a7e4fdccc010c36075752bc9ea1419a64d..dbf61b885e402e9fced58f32029dd1220cd5e6b4 100644 (file)
@@ -28,7 +28,7 @@ __sem_destroy (sem_t *sem)
 {
   struct new_sem *isem = (struct new_sem *) sem;
   if (
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
       atomic_load_relaxed (&isem->data) >> SEM_NWAITERS_SHIFT
 #else
       atomic_load_relaxed (&isem->value) & SEM_NWAITERS_MASK
index 799ddacc9b938cf3fae45d61fa83d0866c61acac..73bb96576decb5d51d9ebffa343cd71d91ce65dc 100644 (file)
@@ -25,7 +25,7 @@ __sem_getvalue (sem_t *restrict sem, int *restrict value)
 {
   struct new_sem *isem = (struct new_sem *) sem;
 
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   *value = atomic_load_relaxed (&isem->data) & SEM_VALUE_MASK;
 #else
   *value = atomic_load_relaxed (&isem->value) >> SEM_VALUE_SHIFT;
index 419a5ec2c43352f1b5a222c0d714ff9265f7f4f1..f42fb2867018d02e6771003f376fb273af6fd385 100644 (file)
@@ -31,7 +31,7 @@ __sem_post (sem_t *sem)
   struct new_sem *isem = (struct new_sem *) sem;
   int flags = isem->pshared ? GSYNC_SHARED : 0;
 
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   uint64_t d = atomic_load_relaxed (&isem->data);
 
   do
index 8f2b4d3f8b7ba5475ee7030bc2babf5514ee2125..755d502f8c862d92ffacd2c0f5191618cac74277 100644 (file)
@@ -27,7 +27,7 @@
 #include <pt-internal.h>
 #include <shlib-compat.h>
 
-#if !__HAVE_64B_ATOMICS
+#if !USE_64B_ATOMICS
 static void
 __sem_wait_32_finish (struct new_sem *isem);
 #endif
@@ -37,7 +37,7 @@ __sem_wait_cleanup (void *arg)
 {
   struct new_sem *isem = arg;
 
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   atomic_fetch_add_relaxed (&isem->data, -((uint64_t) 1 << SEM_NWAITERS_SHIFT));
 #else
   __sem_wait_32_finish (isem);
@@ -60,7 +60,7 @@ __sem_timedwait_internal (sem_t *restrict sem,
 
   int cancel_oldtype = LIBC_CANCEL_ASYNC();
 
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   uint64_t d = atomic_fetch_add_relaxed (&isem->data,
                 (uint64_t) 1 << SEM_NWAITERS_SHIFT);
 
@@ -170,7 +170,7 @@ error:
   return ret;
 }
 
-#if !__HAVE_64B_ATOMICS
+#if !USE_64B_ATOMICS
 /* Stop being a registered waiter (non-64b-atomics code only).  */
 static void
 __sem_wait_32_finish (struct new_sem *isem)
index 61bb1db6bfe10ec2c6ab6f7f67ee0b83f347a3ac..3ee4d417c877d634919c179d7774f70db98f036c 100644 (file)
@@ -24,7 +24,7 @@
 int
 __sem_waitfast (struct new_sem *isem, int definitive_result)
 {
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   uint64_t d = atomic_load_relaxed (&isem->data);
 
   do
index efda6ea06062d57e0f983077ebfef23cf119f13b..73ddd44872f4f94b28b8994a3732817fd522bdd3 100644 (file)
@@ -159,7 +159,7 @@ struct pthread_key_struct
 /* Semaphore variable structure.  */
 struct new_sem
 {
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
   /* The data field holds both value (in the least-significant 32 bits) and
      nwaiters.  */
 # if __BYTE_ORDER == __LITTLE_ENDIAN
index 450f2dcca3148529d0a3871f98d9d1a398e380b3..451cbf2743f32b2d22a586fe67fe99c06b0f5a40 100644 (file)
@@ -28,7 +28,7 @@
 
 /* Static assert for types that can't be loaded/stored atomically on the
    current architecture.  */
-#if __HAVE_64B_ATOMICS
+#if USE_64B_ATOMICS
 #define __RSEQ_ASSERT_ATOMIC(member) \
    _Static_assert (sizeof (RSEQ_SELF()->member) == 1                         \
                   || sizeof (RSEQ_SELF()->member) == 4                       \
index b6494b3c83703b46c40e8a47e9011d96202dd770..e375c6665e978393654040044f096ece2ce3e592 100644 (file)
@@ -21,6 +21,8 @@
 
 #ifdef __riscv_atomic
 
+#include_next <atomic-machine.h>
+
 /* Miscellaneous.  */
 
 # define asm_amo(which, ordering, mem, value) ({               \
index b8c1e96eb468a659f8cfab682f73894f42ddff76..2ffcbb2fcf3f3ed4b56c9b87556d48b69c2bad10 100644 (file)
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#ifndef _ATOMIC_MACHINE_H
-#define _ATOMIC_MACHINE_H      1
+#ifndef _SPARC_ATOMIC_MACHINE_H
+#define _SPARC_ATOMIC_MACHINE_H        1
+
+#include_next <atomic-machine.h>
 
 #ifdef __sparc_v9__
 # define atomic_full_barrier() \
index 0681f57987939ee44a6cfc2e2cee0c573435b1e2..cfa6b62d323fb72b2be1e55e2ed2c2baf6431f00 100644 (file)
 #ifndef _X86_ATOMIC_MACHINE_H
 #define _X86_ATOMIC_MACHINE_H 1
 
+#ifdef __x86_64__
+# define USE_64B_ATOMICS               1
+#else
+# define USE_64B_ATOMICS               0
+#endif
+
 #define atomic_spin_nop() __asm ("pause")
 
 #endif /* atomic-machine.h */