Android.mk revision ff571e2cf5d4a55f7719cd63f05f11c3840f0f57
1# 2# Copyright (C) 2012 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 18LOCAL_PATH:= $(call my-dir) 19 20ifeq ($(TARGET_ARCH),arm) 21 22ASAN_NEEDS_SEGV=0 23ASAN_HAS_EXCEPTIONS=1 24ASAN_FLEXIBLE_MAPPING_AND_OFFSET=0 25 26asan_rtl_files := \ 27 asan_allocator.cc \ 28 asan_allocator2.cc \ 29 asan_fake_stack.cc \ 30 asan_globals.cc \ 31 asan_interceptors.cc \ 32 asan_linux.cc \ 33 asan_mac.cc \ 34 asan_malloc_linux.cc \ 35 asan_malloc_mac.cc \ 36 asan_malloc_win.cc \ 37 asan_new_delete.cc \ 38 asan_poisoning.cc \ 39 asan_posix.cc \ 40 asan_report.cc \ 41 asan_rtl.cc \ 42 asan_stack.cc \ 43 asan_stats.cc \ 44 asan_thread.cc \ 45 asan_thread_registry.cc \ 46 asan_win.cc \ 47 ../interception/interception_linux.cc \ 48 ../sanitizer_common/sanitizer_allocator.cc \ 49 ../sanitizer_common/sanitizer_common.cc \ 50 ../sanitizer_common/sanitizer_flags.cc \ 51 ../sanitizer_common/sanitizer_libc.cc \ 52 ../sanitizer_common/sanitizer_linux.cc \ 53 ../sanitizer_common/sanitizer_mac.cc \ 54 ../sanitizer_common/sanitizer_posix.cc \ 55 ../sanitizer_common/sanitizer_platform_limits_posix.cc \ 56 ../sanitizer_common/sanitizer_printf.cc \ 57 ../sanitizer_common/sanitizer_stackdepot.cc \ 58 ../sanitizer_common/sanitizer_stacktrace.cc \ 59 ../sanitizer_common/sanitizer_symbolizer.cc \ 60 ../sanitizer_common/sanitizer_symbolizer_itanium.cc \ 61 ../sanitizer_common/sanitizer_symbolizer_linux.cc \ 62 ../sanitizer_common/sanitizer_symbolizer_mac.cc \ 63 ../sanitizer_common/sanitizer_symbolizer_win.cc \ 64 ../sanitizer_common/sanitizer_win.cc \ 65 66asan_rtl_cflags := \ 67 -fvisibility=hidden \ 68 -fno-exceptions \ 69 -DASAN_LOW_MEMORY=1 \ 70 -DASAN_NEEDS_SEGV=$(ASAN_NEEDS_SEGV) \ 71 -DASAN_HAS_EXCEPTIONS=$(ASAN_HAS_EXCEPTIONS) \ 72 -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=$(ASAN_FLEXIBLE_MAPPING_AND_OFFSET) \ 73 -Wno-covered-switch-default \ 74 -Wno-sign-compare \ 75 -Wno-unused-parameter \ 76 -D__WORDSIZE=32 77 78asan_test_files := \ 79 tests/asan_globals_test.cc \ 80 tests/asan_test.cc 81 82#tests/asan_noinst_test.cc \ 83#tests/asan_test_main.cc \ 84 85asan_test_cflags := \ 86 -mllvm -asan-blacklist=external/compiler-rt/lib/asan/tests/asan_test.ignore \ 87 -DASAN_LOW_MEMORY=1 \ 88 -DASAN_UAR=0 \ 89 -DASAN_NEEDS_SEGV=$(ASAN_NEEDS_SEGV) \ 90 -DASAN_HAS_EXCEPTIONS=$(ASAN_HAS_EXCEPTIONS) \ 91 -DASAN_HAS_BLACKLIST=1 \ 92 -Wno-covered-switch-default \ 93 -Wno-sign-compare \ 94 -Wno-unused-parameter \ 95 -D__WORDSIZE=32 96 97 98include $(CLEAR_VARS) 99 100LOCAL_MODULE := libasan 101LOCAL_MODULE_TAGS := optional 102LOCAL_C_INCLUDES := bionic external/compiler-rt/lib external/compiler-rt/include 103LOCAL_CFLAGS += $(asan_rtl_cflags) 104LOCAL_SRC_FILES := asan_preinit.cc 105#LOCAL_SRC_FILES := asan_android_stub.cc asan_preinit.cc 106LOCAL_CPP_EXTENSION := .cc 107LOCAL_CLANG := true 108LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 109include $(BUILD_STATIC_LIBRARY) 110 111 112include $(CLEAR_VARS) 113 114LOCAL_MODULE := libasan_preload 115LOCAL_MODULE_TAGS := eng 116LOCAL_C_INCLUDES := \ 117 bionic \ 118 external/compiler-rt/lib \ 119 external/compiler-rt/include 120LOCAL_CFLAGS += $(asan_rtl_cflags) 121LOCAL_SRC_FILES := $(asan_rtl_files) 122LOCAL_CPP_EXTENSION := .cc 123LOCAL_SHARED_LIBRARIES := libc libdl 124LOCAL_CLANG := true 125LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 126include $(BUILD_SHARED_LIBRARY) 127 128 129include $(CLEAR_VARS) 130 131LOCAL_MODULE := asanwrapper 132LOCAL_MODULE_TAGS := eng 133LOCAL_C_INCLUDES := \ 134 bionic \ 135 external/stlport/stlport 136LOCAL_SRC_FILES := asanwrapper.cc 137LOCAL_CPP_EXTENSION := .cc 138LOCAL_SHARED_LIBRARIES := libstlport libc 139LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 140 141include $(BUILD_EXECUTABLE) 142 143 144include $(CLEAR_VARS) 145 146LOCAL_MODULE := libasan_noinst_test 147LOCAL_MODULE_TAGS := tests 148LOCAL_C_INCLUDES := \ 149 bionic \ 150 external/stlport/stlport \ 151 external/gtest/include \ 152 external/compiler-rt/include \ 153 external/compiler-rt/lib \ 154 external/compiler-rt/lib/asan/tests \ 155 external/compiler-rt/lib/sanitizer_common/tests 156LOCAL_CFLAGS += \ 157 -Wno-unused-parameter \ 158 -Wno-sign-compare \ 159 -DASAN_UAR=0 \ 160 -DASAN_HAS_BLACKLIST=1 \ 161 -DASAN_HAS_EXCEPTIONS=$(ASAN_HAS_EXCEPTIONS) \ 162 -DASAN_NEEDS_SEGV=$(ASAN_NEEDS_SEGV) \ 163 -D__WORDSIZE=32 164LOCAL_SRC_FILES := tests/asan_noinst_test.cc tests/asan_test_main.cc 165LOCAL_CPP_EXTENSION := .cc 166LOCAL_CLANG := true 167LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 168include $(BUILD_STATIC_LIBRARY) 169 170 171include $(CLEAR_VARS) 172 173LOCAL_MODULE := asan_test 174LOCAL_MODULE_TAGS := tests 175LOCAL_C_INCLUDES := \ 176 bionic \ 177 external/stlport/stlport \ 178 external/gtest/include \ 179 external/compiler-rt/lib \ 180 external/compiler-rt/lib/asan/tests \ 181 external/compiler-rt/lib/sanitizer_common/tests 182LOCAL_CFLAGS += $(asan_test_cflags) 183LOCAL_SRC_FILES := $(asan_test_files) 184LOCAL_CPP_EXTENSION := .cc 185LOCAL_STATIC_LIBRARIES := libgtest libasan_noinst_test 186LOCAL_SHARED_LIBRARIES := libc libstlport 187LOCAL_ADDRESS_SANITIZER := true 188LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 189 190include $(BUILD_EXECUTABLE) 191 192endif # ifeq($(TARGET_ARCH),arm) 193