]> git.ipfire.org Git - thirdparty/glibc.git/commit
atomic: Consolidate atomic_read_barrier implementation
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 11 Sep 2025 13:49:45 +0000 (10:49 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 4 Nov 2025 07:14:01 +0000 (04:14 -0300)
commit304b22d7f97c23b068d8058986a2afc05da17ffc
tree6400cf842b61101cd4cdabe6d3f850acf8f59ac7
parent70ee250fb8b1ea870d5d7e2e7fdf4ea7850efa11
atomic: Consolidate atomic_read_barrier implementation

All ABIs, except alpha, powerpc, and x86_64, define it to
atomic_full_barrier/__sync_synchronize, which can be mapped to
__atomic_thread_fence (__ATOMIC_SEQ_CST) in most cases, with the
exception of aarch64 (where the acquire fence is generated as
'dmb ishld' instead of 'dmb ish').

For s390x, it defaults to a memory barrier where __sync_synchronize
emits a 'bcr 15,0' (which the manual describes as pipeline
synchronization).

For PowerPC, it allows the use of lwsync for additional chips
(since _ARCH_PWR4 does not cover all chips that support it).

Tested on aarch64-linux-gnu, where the acquire produces a different
instruction that the current code.

Co-authored-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
include/atomic.h
sysdeps/alpha/atomic-machine.h
sysdeps/generic/malloc-machine.h
sysdeps/powerpc/atomic-machine.h
sysdeps/x86/atomic-machine.h