Merge "Don't use __thread in __cxa_thread_finalize()."
diff --git a/libc/Android.bp b/libc/Android.bp
index 2e3cedb..513da1b 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1946,30 +1946,24 @@
arch: {
arm: {
local_include_dirs: ["arch-arm/include"],
- cflags: ["-mthumb-interwork"],
},
arm64: {
local_include_dirs: ["arch-arm64/include"],
},
mips: {
local_include_dirs: ["arch-mips/include"],
- ldflags: ["-melf32ltsmip"],
},
mips64: {
local_include_dirs: ["arch-mips64/include"],
- ldflags: ["-melf64ltsmip"],
},
x86: {
- cflags: ["-m32"],
- ldflags: ["-melf_i386"],
local_include_dirs: ["arch-x86/include"],
},
x86_64: {
- cflags: ["-m64"],
- ldflags: ["-melf_x86_64"],
local_include_dirs: ["arch-x86_64/include"],
},
},
+ clang: false,
}
cc_defaults {
diff --git a/libc/Android.mk b/libc/Android.mk
index 2d97f35..0248c5e 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -1053,6 +1053,7 @@
LOCAL_CPPFLAGS := $(libc_common_cppflags) -Wold-style-cast
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_MODULE := libc_thread_atexit_impl
+LOCAL_CLANG := $(use_clang)
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_CXX_STL := none
LOCAL_SYSTEM_SHARED_LIBRARIES :=
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index f6d3501..27d992b 100755
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -159,7 +159,7 @@
pthread_key_t key;
ASSERT_EQ(0, pthread_key_create(&key, NULL));
- size_t stack_size = 128 * 1024;
+ size_t stack_size = 640 * 1024;
void* stack = mmap(NULL, stack_size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
ASSERT_NE(MAP_FAILED, stack);
memset(stack, 0xff, stack_size);
@@ -217,13 +217,13 @@
while (spin_flag_) {}
return NULL;
}
- static volatile bool spin_flag_;
+ static std::atomic<bool> spin_flag_;
};
// It doesn't matter if spin_flag_ is used in several tests,
// because it is always set to false after each test. Each thread
// loops on spin_flag_ can find it becomes false at some time.
-volatile bool SpinFunctionHelper::spin_flag_ = false;
+std::atomic<bool> SpinFunctionHelper::spin_flag_;
static void* JoinFn(void* arg) {
return reinterpret_cast<void*>(pthread_join(reinterpret_cast<pthread_t>(arg), NULL));
@@ -416,6 +416,8 @@
pthread_t t1;
ASSERT_EQ(0, pthread_create(&t1, NULL, spinhelper.GetFunction(), NULL));
ASSERT_EQ(0, pthread_setname_np(t1, "short 2"));
+ spinhelper.UnSpin();
+ ASSERT_EQ(0, pthread_join(t1, nullptr));
}
TEST(pthread, pthread_setname_np__no_such_thread) {
@@ -466,6 +468,8 @@
ASSERT_EQ(0, pthread_getcpuclockid(t, &c));
timespec ts;
ASSERT_EQ(0, clock_gettime(c, &ts));
+ spinhelper.UnSpin();
+ ASSERT_EQ(0, pthread_join(t, nullptr));
}
TEST(pthread, pthread_getcpuclockid__no_such_thread) {
@@ -534,7 +538,7 @@
// http://b/11693195 --- pthread_join could return before the thread had actually exited.
// If the joiner unmapped the thread's stack, that could lead to SIGSEGV in the thread.
for (size_t i = 0; i < 1024; ++i) {
- size_t stack_size = 64*1024;
+ size_t stack_size = 640*1024;
void* stack = mmap(NULL, stack_size, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0);
pthread_attr_t a;