Index: compiler-rt/lib/scudo/standalone/mem_map_fuchsia.cpp =================================================================== --- compiler-rt/lib/scudo/standalone/mem_map_fuchsia.cpp +++ compiler-rt/lib/scudo/standalone/mem_map_fuchsia.cpp @@ -41,7 +41,7 @@ static uptr getRootVmarBase() { static atomic_uptr CachedResult = {0}; - uptr Result = atomic_load_relaxed(&CachedResult); + uptr Result = atomic_load(&CachedResult, memory_order_acquire); if (UNLIKELY(!Result)) { zx_info_vmar_t VmarInfo; zx_status_t Status = @@ -50,7 +50,7 @@ CHECK_EQ(Status, ZX_OK); CHECK_NE(VmarInfo.base, 0); - atomic_store_relaxed(&CachedResult, VmarInfo.base); + atomic_store(&CachedResult, VmarInfo.base, memory_order_release); Result = VmarInfo.base; } @@ -61,7 +61,7 @@ static zx_handle_t getPlaceholderVmo() { static atomic_u32 StoredVmo = {ZX_HANDLE_INVALID}; - zx_handle_t Vmo = atomic_load_relaxed(&StoredVmo); + zx_handle_t Vmo = atomic_load(&StoredVmo, memory_order_acquire); if (UNLIKELY(Vmo == ZX_HANDLE_INVALID)) { // Create a zero-sized placeholder VMO. zx_status_t Status = _zx_vmo_create(0, 0, &Vmo); @@ -72,9 +72,9 @@ // Atomically store its handle. If some other thread wins the race, use its // handle and discard ours. - zx_handle_t OldValue = - atomic_compare_exchange(&StoredVmo, ZX_HANDLE_INVALID, Vmo); - if (OldValue != ZX_HANDLE_INVALID) { + zx_handle_t OldValue = atomic_compare_exchange_strong( + &StoredVmo, ZX_HANDLE_INVALID, Vmo, memory_order_acq_rel); + if (UNLIKELY(OldValue != ZX_HANDLE_INVALID)) { Status = _zx_handle_close(Vmo); CHECK_EQ(Status, ZX_OK);