summaryrefslogtreecommitdiff
path: root/ruby_atomic.h
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-06-04 13:35:39 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2025-06-04 15:31:28 +0900
commitc5f7d274d78a5ef6818bc5d344a1f27bf2f794c4 (patch)
tree00a8ff76a8de9fba99a7edc5f6462a2b69fa2045 /ruby_atomic.h
parent47f55b4b449c315a9628aa9849428c2c0e98e167 (diff)
Check for 64bit atomic operations
May not be supported on some 32bit architectures. ``` /usr/lib/gcc-cross/m68k-linux-gnu/14/../../../../m68k-linux-gnu/bin/ld: ../../libruby-static.a(vm.o): in function `rbimpl_atomic_u64_set_relaxed': /home/ubuntu/build/ruby/master/m68k-linux/../src/ruby_atomic.h:60:(.text+0x2468): undefined reference to `__atomic_store_8' /usr/lib/gcc-cross/m68k-linux-gnu/14/../../../../m68k-linux-gnu/bin/ld: ../../libruby-static.a(vm.o): in function `rbimpl_atomic_u64_load_relaxed': /home/ubuntu/build/ruby/master/m68k-linux/../src/ruby_atomic.h:43:(.text+0x2950): undefined reference to `__atomic_load_8' ```
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13509
Diffstat (limited to 'ruby_atomic.h')
-rw-r--r--ruby_atomic.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/ruby_atomic.h b/ruby_atomic.h
index 5c9049e001..2b4c16ba07 100644
--- a/ruby_atomic.h
+++ b/ruby_atomic.h
@@ -39,7 +39,7 @@ rbimpl_atomic_load_relaxed(rb_atomic_t *ptr)
static inline uint64_t
rbimpl_atomic_u64_load_relaxed(const uint64_t *value)
{
-#if defined(HAVE_GCC_ATOMIC_BUILTINS)
+#if defined(HAVE_GCC_ATOMIC_BUILTINS_64)
return __atomic_load_n(value, __ATOMIC_RELAXED);
#elif defined(_WIN32)
uint64_t val = *value;
@@ -56,7 +56,7 @@ rbimpl_atomic_u64_load_relaxed(const uint64_t *value)
static inline void
rbimpl_atomic_u64_set_relaxed(uint64_t *address, uint64_t value)
{
-#if defined(HAVE_GCC_ATOMIC_BUILTINS)
+#if defined(HAVE_GCC_ATOMIC_BUILTINS_64)
__atomic_store_n(address, value, __ATOMIC_RELAXED);
#elif defined(_WIN32)
InterlockedExchange64(address, value);