Android.mk revision b8a0c57f15cab97957901b5c71eaac14972b71ed
1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com# 2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com# Copyright (C) 2012 The Android Open Source Project 3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com# 4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com# Licensed under the Apache License, Version 2.0 (the "License"); 5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com# you may not use this file except in compliance with the License. 6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com# You may obtain a copy of the License at 7ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com# 88a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com# http://www.apache.org/licenses/LICENSE-2.0 98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com# 108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com# Unless required by applicable law or agreed to in writing, software 118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com# distributed under the License is distributed on an "AS IS" BASIS, 128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com# See the License for the specific language governing permissions and 148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com# limitations under the License. 158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com# 168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com# 178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_PATH:= $(call my-dir) 198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comifeq ($(TARGET_ARCH),arm) 218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comASAN_NEEDS_SEGV=0 238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comASAN_HAS_EXCEPTIONS=1 248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comASAN_FLEXIBLE_MAPPING_AND_OFFSET=0 258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comasan_rtl_files := \ 27ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com asan_rtl.cc \ 288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com asan_allocator.cc \ 298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com asan_globals.cc \ 308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com asan_interceptors.cc \ 318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com asan_linux.cc \ 328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com asan_malloc_linux.cc \ 338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com asan_malloc_mac.cc \ 34ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com asan_new_delete.cc \ 358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com asan_poisoning.cc \ 368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com asan_posix.cc \ 378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com asan_printf.cc \ 388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com asan_stack.cc \ 398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com asan_stats.cc \ 40ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com asan_thread.cc \ 418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com asan_thread_registry.cc \ 428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com interception/interception_linux.cc 438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comasan_rtl_cflags := \ 458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -fvisibility=hidden \ 468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -fno-exceptions \ 478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -DASAN_LOW_MEMORY=1 \ 488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -DASAN_NEEDS_SEGV=$(ASAN_NEEDS_SEGV) \ 498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -DASAN_HAS_EXCEPTIONS=$(ASAN_HAS_EXCEPTIONS) \ 508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=$(ASAN_FLEXIBLE_MAPPING_AND_OFFSET) \ 518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -Wno-covered-switch-default \ 528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -Wno-sign-compare \ 538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -Wno-unused-parameter \ 548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -D__WORDSIZE=32 558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comasan_test_files := \ 578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com tests/asan_test.cc \ 584b413c8bb123e42ca4b9c7bfa6bc2167283cb84ccommit-bot@chromium.org tests/asan_globals_test.cc \ 598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com tests/asan_break_optimization.cc \ 60ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com tests/asan_interface_test.cc 618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comasan_test_cflags := \ 638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -mllvm -asan-blacklist=external/compiler-rt/lib/asan/tests/asan_test.ignore \ 648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -DASAN_LOW_MEMORY=1 \ 658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -DASAN_UAR=0 \ 668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -DASAN_NEEDS_SEGV=$(ASAN_NEEDS_SEGV) \ 678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -DASAN_HAS_EXCEPTIONS=$(ASAN_HAS_EXCEPTIONS) \ 688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -DASAN_HAS_BLACKLIST=1 \ 698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -Wno-covered-switch-default \ 708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -Wno-sign-compare \ 718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -Wno-unused-parameter \ 72961ddb04a0a7aba843032d829ab867518e52559ereed@google.com -D__WORDSIZE=32 73a8c183125f2861067daf432cada06d431a795cd0commit-bot@chromium.org 74dbfac8a72393eaf01670aeb3244de0e18d8faf98junov@google.com 75ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.cominclude $(CLEAR_VARS) 76ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com 778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_MODULE := libasan 788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_MODULE_TAGS := optional 798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_C_INCLUDES := bionic 80261b8e2ca1cf22303ad95267f0bdc6e87e1bbe70reed@google.comLOCAL_CFLAGS += $(asan_rtl_cflags) 818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_SRC_FILES := asan_android_stub.cc 82ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.comLOCAL_CPP_EXTENSION := .cc 83261b8e2ca1cf22303ad95267f0bdc6e87e1bbe70reed@google.comLOCAL_CLANG := true 848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.cominclude $(BUILD_STATIC_LIBRARY) 85ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com 868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 87261b8e2ca1cf22303ad95267f0bdc6e87e1bbe70reed@google.cominclude $(CLEAR_VARS) 888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 89ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.comLOCAL_MODULE := libasan_preload 908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_MODULE_TAGS := eng 918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_C_INCLUDES := \ 928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com bionic \ 938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com external/stlport/stlport 94ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.comLOCAL_CFLAGS += $(asan_rtl_cflags) 958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_SRC_FILES := $(asan_rtl_files) 968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_CPP_EXTENSION := .cc 978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_SHARED_LIBRARIES := libc libstlport libdl 988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_CLANG := true 998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.cominclude $(BUILD_SHARED_LIBRARY) 1008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 101ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com 1028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.cominclude $(CLEAR_VARS) 1038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_MODULE := asanwrapper 1058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_MODULE_TAGS := eng 106ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.comLOCAL_C_INCLUDES := \ 1078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com bionic \ 1088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com external/stlport/stlport 1098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_SRC_FILES := asanwrapper.cc 1108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_CPP_EXTENSION := .cc 1118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_SHARED_LIBRARIES := libstlport libc 112961ddb04a0a7aba843032d829ab867518e52559ereed@google.com 1138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.cominclude $(BUILD_EXECUTABLE) 1148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.cominclude $(CLEAR_VARS) 117ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com 1188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_MODULE := libasan_noinst_test 1198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_MODULE_TAGS := tests 1208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_C_INCLUDES := \ 1218a2ad3cae710f05cca57e48dd1732d575dba2dc7commit-bot@chromium.org bionic \ 122ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com external/stlport/stlport \ 1238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com external/gtest/include 124ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.comLOCAL_CFLAGS += \ 125961ddb04a0a7aba843032d829ab867518e52559ereed@google.com -Wno-unused-parameter \ 1268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -Wno-sign-compare \ 1278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com -D__WORDSIZE=32 1288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_SRC_FILES := tests/asan_noinst_test.cc 1298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_CPP_EXTENSION := .cc 1308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_CLANG := true 1318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.cominclude $(BUILD_STATIC_LIBRARY) 1328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.cominclude $(CLEAR_VARS) 1358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_MODULE := asan_test 137ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.comLOCAL_MODULE_TAGS := tests 138961ddb04a0a7aba843032d829ab867518e52559ereed@google.comLOCAL_C_INCLUDES := \ 1398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com bionic \ 1408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com external/stlport/stlport \ 1418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com external/gtest/include 1428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_CFLAGS += $(asan_test_cflags) 143ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.comLOCAL_SRC_FILES := $(asan_test_files) 1448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_CPP_EXTENSION := .cc 145ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.comLOCAL_STATIC_LIBRARIES := libgtest libasan_noinst_test 1468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_SHARED_LIBRARIES := libc libstlport 1478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comLOCAL_ADDRESS_SANITIZER := true 1488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.cominclude $(BUILD_EXECUTABLE) 1508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 151ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com# Build output tests for AddressSanitizer. 1528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comdefine asan-output-test 1548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com include $(CLEAR_VARS) 155ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com LOCAL_MODULE := $(1) 1568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES)/asan 1578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com LOCAL_MODULE_TAGS := tests 1588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com LOCAL_SRC_FILES := output_tests/$(1).cc 159ae933ce0ea5fd9d21cb6ef2cee7e729d32690aacrmistry@google.com LOCAL_CPP_EXTENSION := .cc 1608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com LOCAL_ADDRESS_SANITIZER := true 1618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com LOCAL_C_INCLUDES := bionic external/stlport/stlport 1628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com LOCAL_CFLAGS := -Wno-unused-parameter 1638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com LOCAL_SHARED_LIBRARIES := libstlport 1648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com include $(BUILD_EXECUTABLE) 1658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comendef 1668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comdefine asan-output-test-so 1688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com include $(CLEAR_VARS) 1698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com LOCAL_MODULE := $(1) 1708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com LOCAL_MODULE_TAGS := tests 1718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES)/asan 172961ddb04a0a7aba843032d829ab867518e52559ereed@google.com LOCAL_SRC_FILES := output_tests/$(1).cc 1738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com LOCAL_CPP_EXTENSION := .cc 1748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com LOCAL_ADDRESS_SANITIZER := true 1758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com LOCAL_C_INCLUDES := bionic external/stlport/stlport 1768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com LOCAL_CFLAGS := -Wno-unused-parameter 1778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com LOCAL_SHARED_LIBRARIES := libstlport 1788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com include $(BUILD_SHARED_LIBRARY) 179endef 180 181OUTPUT_TESTS := \ 182 clone_test \ 183 deep_tail_call \ 184 dlclose-test \ 185 dlclose-test-so \ 186 global-overflow \ 187 heap-overflow \ 188 large_func_test \ 189 null_deref \ 190 shared-lib-test \ 191 shared-lib-test-so \ 192 stack-overflow \ 193 strncpy-overflow \ 194 use-after-free 195 196$(foreach test,$(filter %-so,$(OUTPUT_TESTS)),$(eval $(call asan-output-test-so,$(test)))) 197$(foreach test,$(filter-out %-so,$(OUTPUT_TESTS)),$(eval $(call asan-output-test,$(test)))) 198 199endif # ifeq($(TARGET_ARCH),arm) 200