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