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/libc/aos_strerror.cc b/aos/libc/aos_strerror.cc
index 1353242..b045f24 100644
--- a/aos/libc/aos_strerror.cc
+++ b/aos/libc/aos_strerror.cc
@@ -1,9 +1,11 @@
#include "aos/libc/aos_strerror.h"
#include <assert.h>
-#include <sys/types.h>
-#include <string.h>
#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include "aos/thread_local.h"
// This code uses an overloaded function to handle the result from either
// version of strerror_r correctly without needing a way to get the choice out
@@ -15,14 +17,15 @@
// Handle the result from the GNU version of strerror_r. It never fails, so
// that's pretty easy...
-__attribute__((unused))
-char *aos_strerror_handle_result(int /*error*/, char *ret, char * /*buffer*/) {
+__attribute__((unused)) char *aos_strerror_handle_result(int /*error*/,
+ char *ret,
+ char * /*buffer*/) {
return ret;
}
// Handle the result from the POSIX version of strerror_r.
-__attribute__((unused))
-char *aos_strerror_handle_result(int error, int ret, char *buffer) {
+__attribute__((unused)) char *aos_strerror_handle_result(int error, int ret,
+ char *buffer) {
if (ret != 0) {
#ifndef NDEBUG
// assert doesn't use the return value when building optimized.
@@ -37,7 +40,7 @@
} // namespace
const char *aos_strerror(int error) {
- static thread_local char buffer[kBufferSize];
+ AOS_THREAD_LOCAL char buffer[kBufferSize];
// Call the overload for whichever version we're using.
return aos_strerror_handle_result(