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