From: Chih-Hung Hsieh Date: Mon, 16 Nov 2015 19:13:04 +0000 (-0800) Subject: Enable clang to compile more tests. X-Git-Tag: android-x86-7.1-r1~360^2^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=1e79540807c692fa8dbd494dfe290c3aab85420e;p=android-x86%2Fbionic.git Enable clang to compile more tests. * Disable optimization only in gtest.h of atexit_test.c for arm/aarch64 to keep VTT for std::__1::basic_stringstream, std::__1::allocator > to link with g++ compiled modules. * bionic-unit-tests source files are not affected by clang x86_64 fp128 bug so they can be compiled with clang. BUG: 25643775 Change-Id: I3da2a0de61edcdca07b7fcd73a16de9da4a1f7d6 --- diff --git a/tests/Android.mk b/tests/Android.mk index 8f2d3cf04..e2fae5247 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -313,15 +313,6 @@ bionic-unit-tests_shared_libraries_target := \ libdl_preempt_test_1 \ libdl_preempt_test_2 -# 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 module := bionic-unit-tests diff --git a/tests/atexit_test.cpp b/tests/atexit_test.cpp index e92889d1c..67fbfd2be 100644 --- a/tests/atexit_test.cpp +++ b/tests/atexit_test.cpp @@ -14,7 +14,17 @@ * limitations under the License. */ +// To work around b/25643775, we disable clang optimization so that +// VTT for std::__1::basic_stringstream, +// std::__1::allocator > +// will be correctly kept for other module's references. +#if defined(__clang__) && (defined(__arm__) || defined(__aarch64__)) +#pragma clang optimize off +#endif #include +#if defined(__clang__) && (defined(__arm__) || defined(__aarch64__)) +#pragma clang optimize on +#endif #include #include