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<char, std::__1::char_traits<char>,
  std::__1::allocator<char> > 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
This commit is contained in:
Chih-Hung Hsieh 2015-11-16 11:13:04 -08:00
parent 1b42c54471
commit 1e79540807
2 changed files with 10 additions and 9 deletions

View File

@ -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

View File

@ -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<char, std::__1::char_traits<char>,
// std::__1::allocator<char> >
// will be correctly kept for other module's references.
#if defined(__clang__) && (defined(__arm__) || defined(__aarch64__))
#pragma clang optimize off
#endif
#include <gtest/gtest.h>
#if defined(__clang__) && (defined(__arm__) || defined(__aarch64__))
#pragma clang optimize on
#endif
#include <dlfcn.h>
#include <libgen.h>