Skip to content

Commit 039ed1f

Browse files
author
Tor Didriksen
committed
Bug #34017614 Add support for Apple M1 to MySQL 5.7 [WL#12928]
Backport d02d37ef9ceceebd6ac3f69dc2a776e87d336764 WL#12928 Add ARM support to MySQL Cluster Note that this uses std::atomic_thread_fence which requires (at least) -std=c++11 We normally build with -std=c++03 for MySQL 5.7, but not on macOS. By not specifying any -std=<standard> we get whatever is default, which is currently gnu++14. Change-Id: I43f54151e04e2e856c774f8014e379905cc38d55
1 parent 08265b1 commit 039ed1f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

storage/ndb/src/kernel/vm/mt-asm.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
1+
/* Copyright (c) 2008, 2022, Oracle and/or its affiliates.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License, version 2.0,
@@ -139,6 +139,21 @@ xcng(volatile unsigned * addr, int val)
139139
return prev;
140140
}
141141

142+
#elif defined(__aarch64__)
143+
#include <atomic>
144+
#define NDB_HAVE_MB
145+
#define NDB_HAVE_RMB
146+
#define NDB_HAVE_WMB
147+
#define NDB_HAVE_READ_BARRIER_DEPENDS
148+
//#define NDB_HAVE_XCNG
149+
150+
#define mb() std::atomic_thread_fence(std::memory_order_seq_cst)
151+
#define rmb() std::atomic_thread_fence(std::memory_order_seq_cst)
152+
#define wmb() std::atomic_thread_fence(std::memory_order_seq_cst)
153+
#define read_barrier_depends() do {} while(0)
154+
155+
#define cpu_pause() __asm__ __volatile__ ("yield")
156+
142157
#else
143158
#define NDB_NO_ASM "Unsupported architecture (gcc)"
144159
#endif

0 commit comments

Comments
 (0)