From 006f4387bf44e14ec878432aa31a3bd263eda9e5 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 16 Sep 2015 12:14:34 +0300 Subject: [PATCH] Enable thread-local storage for Android Clang * include/private/thread_local_alloc.h (USE_COMPILER_TLS): Define for Android NDK clang3.6+ arm/arm64/x86/x86_64 (NDK r10e); update comment. --- include/private/thread_local_alloc.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/include/private/thread_local_alloc.h b/include/private/thread_local_alloc.h index ffa98c49..baede5aa 100644 --- a/include/private/thread_local_alloc.h +++ b/include/private/thread_local_alloc.h @@ -38,7 +38,7 @@ # if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32) # if defined(CYGWIN32) && (__GNUC__ >= 4) # if defined(__clang__) - /* As of Cygwin clang3.1, thread-local storage is unsupported. */ + /* As of Cygwin clang3.5.2, thread-local storage is unsupported. */ # define USE_PTHREAD_SPECIFIC # else # define USE_COMPILER_TLS @@ -51,9 +51,16 @@ # elif (defined(LINUX) && !defined(ARM32) && !defined(AVR32) \ && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) \ && !(defined(__clang__) && defined(PLATFORM_ANDROID))) \ - || (defined(PLATFORM_ANDROID) && defined(ARM32) \ - && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) - /* As of Android NDK r8e, Clang cannot find __tls_get_addr. */ + || (defined(PLATFORM_ANDROID) && !defined(__clang__) \ + && defined(ARM32) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) \ + || (defined(PLATFORM_ANDROID) && !defined(MIPS) \ + && (__clang_major__ > 3 \ + || (__clang_major__ == 3 && __clang_minor__ >= 6))) + /* As of Android NDK r10e, Clang/mips cannot find __tls_get_addr. */ + /* Older NKD releases have same issue for arm and x86 if gcc4.6 */ + /* toolchain is used for linking (Android NDK r10e added clang3.6 */ + /* dropping gcc4.6). */ # define USE_COMPILER_TLS # elif defined(GC_DGUX386_THREADS) || defined(GC_OSF1_THREADS) \ || defined(GC_AIX_THREADS) || defined(GC_DARWIN_THREADS) \ -- 2.40.0