Implement a workaround for thread_local on aarch64
Some versions of lld break thread_local on aarch64. There's a
minimally-painful workaround for it, so let's apply that.
Change-Id: I706de9e280cc15006e5767ee10d961cb2d99352c
diff --git a/aos/ipc_lib/aos_sync.cc b/aos/ipc_lib/aos_sync.cc
index d5c3d4e..34d9489 100644
--- a/aos/ipc_lib/aos_sync.cc
+++ b/aos/ipc_lib/aos_sync.cc
@@ -27,10 +27,12 @@
#include <type_traits>
#include "absl/base/call_once.h"
-#include "aos/macros.h"
-#include "aos/util/compiler_memory_barrier.h"
#include "glog/logging.h"
+#include "aos/macros.h"
+#include "aos/thread_local.h"
+#include "aos/util/compiler_memory_barrier.h"
+
using ::aos::linux_code::ipc_lib::FutexAccessorObserver;
// This code was originally based on <https://www.akkadia.org/drepper/futex.pdf>,
@@ -369,7 +371,7 @@
// Starts off at 0 in each new thread (because that's what it gets initialized
// to in most of them or it gets to reset to 0 after a fork by atfork_child()).
-thread_local pid_t my_tid = 0;
+AOS_THREAD_LOCAL pid_t my_tid = 0;
// Gets called before the fork(2) wrapper function returns in the child.
void atfork_child() {
@@ -428,7 +430,7 @@
static_assert(sizeof(aos_robust_list_head) == sizeof(robust_list_head),
"Our aos_robust_list_head doesn't match the kernel's");
-thread_local aos_robust_list_head robust_head;
+AOS_THREAD_LOCAL aos_robust_list_head robust_head;
// Extra offset between mutex values and where we point to for their robust list
// entries (from SetRobustListOffset).