1 # 2 # Copyright (C) 2015 The Android Open Source Project 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 # 16 # 17 18 LOCAL_PATH:= $(call my-dir) 19 20 ifeq ($(HOST_OS),linux) 21 ifeq ($(HOST_ARCH),x86_64) 22 23 tsan_rtl_files := \ 24 rtl/tsan_clock.cc \ 25 rtl/tsan_flags.cc \ 26 rtl/tsan_fd.cc \ 27 rtl/tsan_ignoreset.cc \ 28 rtl/tsan_interceptors.cc \ 29 rtl/tsan_interface_ann.cc \ 30 rtl/tsan_interface_atomic.cc \ 31 rtl/tsan_interface.cc \ 32 rtl/tsan_interface_java.cc \ 33 rtl/tsan_md5.cc \ 34 rtl/tsan_mman.cc \ 35 rtl/tsan_mutex.cc \ 36 rtl/tsan_mutexset.cc \ 37 rtl/tsan_report.cc \ 38 rtl/tsan_rtl.cc \ 39 rtl/tsan_rtl_mutex.cc \ 40 rtl/tsan_rtl_report.cc \ 41 rtl/tsan_rtl_thread.cc \ 42 rtl/tsan_stack_trace.cc \ 43 rtl/tsan_stat.cc \ 44 rtl/tsan_suppressions.cc \ 45 rtl/tsan_symbolize.cc \ 46 rtl/tsan_sync.cc \ 47 rtl/tsan_platform_linux.cc \ 48 rtl/tsan_platform_posix.cc \ 49 rtl/tsan_rtl_amd64.S \ 50 51 tsan_rtl_cppflags := -std=c++11 -Wall -Werror -Wno-unused-parameter -Wno-non-virtual-dtor \ 52 -fno-rtti -fno-builtin 53 54 tsan_rtl_c_includes := \ 55 $(LOCAL_PATH)/.. \ 56 57 include $(CLEAR_VARS) 58 LOCAL_MODULE := libtsan 59 LOCAL_CPP_EXTENSION := .cc 60 LOCAL_C_INCLUDES := $(tsan_rtl_c_includes) 61 LOCAL_CPPFLAGS := $(tsan_rtl_cppflags) 62 LOCAL_SRC_FILES := $(tsan_rtl_files) 63 LOCAL_CXX_STL := none 64 LOCAL_SANITIZE := never 65 LOCAL_MULTILIB := 64 66 LOCAL_WHOLE_STATIC_LIBRARIES := libinterception libsan libubsan 67 include $(BUILD_HOST_STATIC_LIBRARY) 68 69 include $(CLEAR_VARS) 70 LOCAL_MODULE := libtsan_cxx 71 LOCAL_CPP_EXTENSION := .cc 72 LOCAL_C_INCLUDES = $(tsan_rtl_c_includes) 73 LOCAL_CPPFLAGS := $(tsan_rtl_cppflags) 74 LOCAL_SRC_FILES := rtl/tsan_new_delete.cc 75 LOCAL_CXX_STL := none 76 LOCAL_SANITIZE := never 77 LOCAL_MULTILIB := 64 78 LOCAL_WHOLE_STATIC_LIBRARIES := libubsan_cxx 79 include $(BUILD_HOST_STATIC_LIBRARY) 80 81 tsan_unit_test_src_files := \ 82 tests/unit/tsan_clock_test.cc \ 83 tests/unit/tsan_dense_alloc_test.cc \ 84 tests/unit/tsan_flags_test.cc \ 85 tests/unit/tsan_mman_test.cc \ 86 tests/unit/tsan_mutex_test.cc \ 87 tests/unit/tsan_mutexset_test.cc \ 88 tests/unit/tsan_shadow_test.cc \ 89 tests/unit/tsan_stack_test.cc \ 90 tests/unit/tsan_sync_test.cc \ 91 tests/unit/tsan_unit_test_main.cc \ 92 tests/unit/tsan_vector_test.cc \ 93 94 tsan_unit_test_c_includes := \ 95 $(LOCAL_PATH)/rtl \ 96 $(LOCAL_PATH)/.. \ 97 98 ifneq (true,$(SKIP_LLVM_TESTS)) 99 ifndef SANITIZE_HOST 100 101 include $(CLEAR_VARS) 102 LOCAL_MODULE := libtsan_unit_test 103 LOCAL_CPP_EXTENSION := .cc 104 LOCAL_C_INCLUDES := $(tsan_unit_test_c_includes) 105 LOCAL_CPPFLAGS := $(tsan_rtl_cppflags) 106 LOCAL_SRC_FILES := $(tsan_unit_test_src_files) 107 LOCAL_SANITIZE := never 108 LOCAL_MULTILIB := 64 109 LOCAL_STATIC_LIBRARIES := libtsan libubsan 110 LOCAL_LDLIBS := -lrt -ldl 111 include $(BUILD_HOST_NATIVE_TEST) 112 113 114 tsan_rtl_test_src_files := \ 115 tests/rtl/tsan_bench.cc \ 116 tests/rtl/tsan_mop.cc \ 117 tests/rtl/tsan_mutex.cc \ 118 tests/rtl/tsan_posix.cc \ 119 tests/rtl/tsan_string.cc \ 120 tests/rtl/tsan_test_util_posix.cc \ 121 tests/rtl/tsan_test.cc \ 122 tests/rtl/tsan_thread.cc \ 123 124 tsan_rtl_test_c_includes := \ 125 $(LOCAL_PATH)/rtl \ 126 $(LOCAL_PATH)/.. \ 127 128 include $(CLEAR_VARS) 129 LOCAL_MODULE := libtsan_rtl_test 130 LOCAL_CPP_EXTENSION := .cc 131 LOCAL_C_INCLUDES := $(tsan_rtl_test_c_includes) 132 LOCAL_CPPFLAGS := $(tsan_rtl_cppflags) 133 LOCAL_SRC_FILES := $(tsan_rtl_test_src_files) 134 LOCAL_SANITIZE := never 135 LOCAL_MULTILIB := 64 136 LOCAL_STATIC_LIBRARIES := libtsan libubsan 137 LOCAL_LDLIBS := -lrt -ldl 138 include $(BUILD_HOST_NATIVE_TEST) 139 140 endif # SANITIZE_HOST 141 endif # SKIP_LLVM_TESTS 142 143 endif # ifeq ($(HOST_ARCH),x86_64) 144 endif # ifeq ($(HOST_OS),linux) 145