Clean up __isthreaded.
__isthreaded is annoying for ARC++ and useless for everyone. Just hard-code
the value in ndk_cruft for LP32 and be done with it.
Bug: N/A
Test: builds
Change-Id: I08f11a404bbec55ed57cb1e18b5116163c7d7d13
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index 016b476..dbacf18 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -52,6 +52,9 @@
// LP64 doesn't need to support any legacy cruft.
#if !defined(__LP64__)
+// By the time any NDK-built code is running, there are plenty of threads.
+int __isthreaded = 1;
+
// These were accidentally declared in <unistd.h> because we stupidly used to inline
// getpagesize() and __getpageshift(). Needed for backwards compatibility with old NDK apps.
unsigned int __page_size = PAGE_SIZE;
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
index 9f4481f..9197aa3 100644
--- a/libc/bionic/pthread_create.cpp
+++ b/libc/bionic/pthread_create.cpp
@@ -49,8 +49,6 @@
void __init_user_desc(struct user_desc*, bool, void*);
#endif
-extern "C" int __isthreaded;
-
// This code is used both by each new pthread and the code that initializes the main thread.
void __init_tls(pthread_internal_t* thread) {
// Slot 0 must point to itself. The x86 Linux kernel reads the TLS from %fs:0.
@@ -230,9 +228,6 @@
void* (*start_routine)(void*), void* arg) {
ErrnoRestorer errno_restorer;
- // Inform the rest of the C library that at least one thread was created.
- __isthreaded = 1;
-
pthread_attr_t thread_attr;
if (attr == NULL) {
pthread_attr_init(&thread_attr);