From: Ivan Maidanski Date: Thu, 9 Mar 2017 22:03:05 +0000 (+0300) Subject: Use __thread keyword for Android NDK r12b+ Clang (arm) X-Git-Tag: v8.0.0~873 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=523cb84ebc8d8a3ef717dfff8aaab4d4e8b0df5d;p=platform%2Fupstream%2Flibgc.git Use __thread keyword for Android NDK r12b+ Clang (arm) * include/private/gcconfig.h (GC_CLANG_PREREQ_FULL): New macro (to check the required patch_level of Clang). * include/private/thread_local_alloc.h [PLATFORM_ANDROID && ARM32] (USE_COMPILER_TLS): Define for clang-3.8.256229 or later. --- diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index 331e25a..591c776 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -36,8 +36,13 @@ #if defined(__clang__) && defined(__clang_major__) # define GC_CLANG_PREREQ(major, minor) \ ((__clang_major__ << 16) + __clang_minor__ >= ((major) << 16) + (minor)) +# define GC_CLANG_PREREQ_FULL(major, minor, patchlevel) \ + (GC_CLANG_PREREQ(major, (minor) + 1) \ + || (__clang_major__ == (major) && __clang_minor__ == (minor) \ + && __clang_patchlevel__ >= (patchlevel))) #else # define GC_CLANG_PREREQ(major, minor) 0 /* FALSE */ +# define GC_CLANG_PREREQ_FULL(major, minor, patchlevel) 0 #endif /* Machine dependent parameters. Some tuning parameters can be found */ diff --git a/include/private/thread_local_alloc.h b/include/private/thread_local_alloc.h index 5b9bec3..1b71cbf 100644 --- a/include/private/thread_local_alloc.h +++ b/include/private/thread_local_alloc.h @@ -51,9 +51,8 @@ # elif (defined(LINUX) && !defined(ARM32) && !defined(AVR32) \ && GC_GNUC_PREREQ(3, 3) \ && !(defined(__clang__) && defined(PLATFORM_ANDROID))) \ - || (defined(PLATFORM_ANDROID) && !defined(__clang__) \ - && defined(ARM32) && GC_GNUC_PREREQ(4, 6)) - /* As of Android NDK r10e, Clang cannot find __tls_get_addr. */ + || (defined(PLATFORM_ANDROID) && defined(ARM32) \ + && (GC_GNUC_PREREQ(4, 6) || GC_CLANG_PREREQ_FULL(3, 8, 256229))) # define USE_COMPILER_TLS # elif defined(GC_DGUX386_THREADS) || defined(GC_OSF1_THREADS) \ || defined(GC_AIX_THREADS) || defined(GC_DARWIN_THREADS) \