OSDN Git Service

Enable clang for modules failed with TLS.
authorChih-Hung Hsieh <chh@google.com>
Tue, 10 Nov 2015 19:15:43 +0000 (11:15 -0800)
committerChih-Hung Hsieh <chh@google.com>
Thu, 12 Nov 2015 00:22:38 +0000 (16:22 -0800)
New 3.8 clang/llvm can compile TLS code now.
* For x86_64, still disable clang due to f128 bug.
* For b/25643775, arm and arm64, disable clang in unit tests.
* Fix thread_local_test.cpp to compile with clang and
  limit gcc workaround only to arm and aarch64.

BUG: 25643775

Change-Id: Iecd006bf1fc417dbcce2c63343a59c4bf1fa77ea

libc/Android.mk
tests/Android.mk
tests/thread_local_test.cpp

index 4ffdf57..2808707 100644 (file)
@@ -1043,9 +1043,6 @@ LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
 LOCAL_CPPFLAGS := $(libc_common_cppflags) -Wold-style-cast
 LOCAL_C_INCLUDES := $(libc_common_c_includes)
 LOCAL_MODULE := libc_thread_atexit_impl
-# TODO: Clang tries to use __tls_get_addr which is not supported yet
-# remove after it is implemented.
-LOCAL_CLANG := false
 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 LOCAL_CXX_STL := none
 LOCAL_SYSTEM_SHARED_LIBRARIES :=
index 8de3b22..f401d33 100644 (file)
@@ -142,7 +142,9 @@ libBionicStandardTests_ldlibs_host := \
 # Clang/llvm has incompatible long double (fp128) for x86_64.
 # https://llvm.org/bugs/show_bug.cgi?id=23897
 # This affects most of math_test.cpp.
+ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86_64))
 libBionicStandardTests_clang_target := false
+endif
 
 module := libBionicStandardTests
 module_tag := optional
@@ -309,9 +311,14 @@ bionic-unit-tests_shared_libraries_target := \
     libdl_preempt_test_1 \
     libdl_preempt_test_2
 
-# TODO: clang support for thread_local on arm is done via __aeabi_read_tp()
-# which bionic does not support. Reenable this once this question is resolved.
+# Clang/llvm has incompatible long double (fp128) for x86_64.
+# https://llvm.org/bugs/show_bug.cgi?id=23897
+# This affects most of math_test.cpp.
+# For arm and arm64 target, b/25643775:
+# external/libcxx/include/sstream:859: warning: relocation refers to discarded section
+ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86_64 arm arm64))
 bionic-unit-tests_clang_target := false
+endif
 
 bionic-unit-tests_shared_libraries_target += libdl_test_df_1_global
 
index aeba2ba..1422ed2 100644 (file)
@@ -18,7 +18,8 @@
 #include <stdint.h>
 #include <string.h>
 
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__clang__) && \
+    (defined(__arm__) || defined(__aarch64__))
 // Gcc has a bug with -O -fdata-section for the arm target: http://b/22772147.
 // Until that bug is fixed, disable optimization since
 // it is not essential for this test.