This is an automated email from the ASF dual-hosted git repository.
huixxi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git
The following commit(s) were added to refs/heads/master by this push:
new 863476db Fix unit test running error under arch64
new e6881ee3 Merge pull request #2324 from leaf-potato/unittest
863476db is described below
commit 863476db686b22378c315621b85562306ab4f96f
Author: Ran Miller <[email protected]>
AuthorDate: Sun Jul 23 22:30:14 2023 +0800
Fix unit test running error under arch64
---
src/butil/thread_local.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/butil/thread_local.h b/src/butil/thread_local.h
index 74f9533b..a3cb1ff0 100644
--- a/src/butil/thread_local.h
+++ b/src/butil/thread_local.h
@@ -31,7 +31,7 @@
#endif // _MSC_VER
#define BAIDU_VOLATILE_THREAD_LOCAL(type, var_name, default_value)
\
- BAIDU_THREAD_LOCAL type var_name = default_value;
\
+ BAIDU_THREAD_LOCAL type var_name = default_value;
\
static __attribute__((noinline, unused)) type get_##var_name(void) {
\
asm volatile("");
\
return var_name;
\
@@ -46,10 +46,10 @@
var_name = v;
\
}
-#if defined(__clang__)
-// Clang compiler is incorrectly caching the address of thread_local variables
-// across a suspend-point. The following macros used to disable the volatile
-// thread local access optimization.
+#if (defined (__aarch64__) && defined (__GNUC__)) || defined(__clang__)
+// GNU compiler under aarch and Clang compiler is incorrectly caching the
+// address of thread_local variables across a suspend-point. The following
+// macros used to disable the volatile thread local access optimization.
#define BAIDU_GET_VOLATILE_THREAD_LOCAL(var_name) get_##var_name()
#define BAIDU_GET_PTR_VOLATILE_THREAD_LOCAL(var_name) get_ptr_##var_name()
#define BAIDU_SET_VOLATILE_THREAD_LOCAL(var_name, value) set_##var_name(value)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]