blob: fa335c0b7ac8b2d276e31a224845ee969e68b60c [file] [log] [blame]
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +04001#
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
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +040026asan_rtl_files := \
27 asan_rtl.cc \
28 asan_allocator.cc \
29 asan_globals.cc \
30 asan_interceptors.cc \
31 asan_linux.cc \
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +040032 asan_malloc_linux.cc \
33 asan_malloc_mac.cc \
Shih-wei Liaoed003382012-04-25 06:48:42 -070034 asan_new_delete.cc \
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +040035 asan_poisoning.cc \
36 asan_posix.cc \
Stephen Hines6490f0d2012-08-23 03:01:53 -070037 asan_report.cc \
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +040038 asan_stack.cc \
39 asan_stats.cc \
40 asan_thread.cc \
Shih-wei Liao51584042012-08-05 17:31:51 -070041 asan_thread_registry.cc \
42 ../interception/interception_linux.cc \
43 ../sanitizer_common/sanitizer_allocator.cc \
44 ../sanitizer_common/sanitizer_common.cc \
Stephen Hines6490f0d2012-08-23 03:01:53 -070045 ../sanitizer_common/sanitizer_flags.cc \
Shih-wei Liao51584042012-08-05 17:31:51 -070046 ../sanitizer_common/sanitizer_libc.cc \
47 ../sanitizer_common/sanitizer_linux.cc \
48 ../sanitizer_common/sanitizer_posix.cc \
49 ../sanitizer_common/sanitizer_printf.cc \
Stephen Hines1f922a52012-09-10 20:14:46 -070050 ../sanitizer_common/sanitizer_stacktrace.cc \
Stephen Hines6490f0d2012-08-23 03:01:53 -070051 ../sanitizer_common/sanitizer_symbolizer.cc \
52 ../sanitizer_common/sanitizer_symbolizer_linux.cc \
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +040053
54asan_rtl_cflags := \
55 -fvisibility=hidden \
56 -fno-exceptions \
57 -DASAN_LOW_MEMORY=1 \
58 -DASAN_NEEDS_SEGV=$(ASAN_NEEDS_SEGV) \
59 -DASAN_HAS_EXCEPTIONS=$(ASAN_HAS_EXCEPTIONS) \
60 -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=$(ASAN_FLEXIBLE_MAPPING_AND_OFFSET) \
61 -Wno-covered-switch-default \
Evgeniy Stepanove48a1972012-03-29 18:09:56 +040062 -Wno-sign-compare \
63 -Wno-unused-parameter \
64 -D__WORDSIZE=32
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +040065
66asan_test_files := \
67 tests/asan_test.cc \
68 tests/asan_globals_test.cc \
Stephen Hines6490f0d2012-08-23 03:01:53 -070069 tests/asan_break_optimization.cc
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +040070
71asan_test_cflags := \
Evgeniy Stepanove48a1972012-03-29 18:09:56 +040072 -mllvm -asan-blacklist=external/compiler-rt/lib/asan/tests/asan_test.ignore \
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +040073 -DASAN_LOW_MEMORY=1 \
74 -DASAN_UAR=0 \
75 -DASAN_NEEDS_SEGV=$(ASAN_NEEDS_SEGV) \
76 -DASAN_HAS_EXCEPTIONS=$(ASAN_HAS_EXCEPTIONS) \
77 -DASAN_HAS_BLACKLIST=1 \
Evgeniy Stepanove48a1972012-03-29 18:09:56 +040078 -Wno-covered-switch-default \
79 -Wno-sign-compare \
80 -Wno-unused-parameter \
81 -D__WORDSIZE=32
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +040082
83
84include $(CLEAR_VARS)
85
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +040086LOCAL_MODULE := libasan
87LOCAL_MODULE_TAGS := optional
Stephen Hines1f922a52012-09-10 20:14:46 -070088LOCAL_C_INCLUDES := bionic external/compiler-rt/lib external/compiler-rt/include
Evgeniy Stepanove48a1972012-03-29 18:09:56 +040089LOCAL_CFLAGS += $(asan_rtl_cflags)
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +040090LOCAL_SRC_FILES := asan_android_stub.cc
91LOCAL_CPP_EXTENSION := .cc
92LOCAL_CLANG := true
Stephen Hines97ac43c2013-01-18 17:46:14 -080093LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +040094include $(BUILD_STATIC_LIBRARY)
95
96
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +040097include $(CLEAR_VARS)
98
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +040099LOCAL_MODULE := libasan_preload
Evgeniy Stepanove48a1972012-03-29 18:09:56 +0400100LOCAL_MODULE_TAGS := eng
Shih-wei Liaoed003382012-04-25 06:48:42 -0700101LOCAL_C_INCLUDES := \
102 bionic \
Stephen Hines1f922a52012-09-10 20:14:46 -0700103 external/compiler-rt/lib \
104 external/compiler-rt/include
Evgeniy Stepanove48a1972012-03-29 18:09:56 +0400105LOCAL_CFLAGS += $(asan_rtl_cflags)
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +0400106LOCAL_SRC_FILES := $(asan_rtl_files)
107LOCAL_CPP_EXTENSION := .cc
Evgeniy Stepanov08f6fe22012-10-18 19:25:42 +0400108LOCAL_SHARED_LIBRARIES := libc libdl
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +0400109LOCAL_CLANG := true
Stephen Hines97ac43c2013-01-18 17:46:14 -0800110LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +0400111include $(BUILD_SHARED_LIBRARY)
112
113
114include $(CLEAR_VARS)
115
116LOCAL_MODULE := asanwrapper
Evgeniy Stepanove48a1972012-03-29 18:09:56 +0400117LOCAL_MODULE_TAGS := eng
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +0400118LOCAL_C_INCLUDES := \
119 bionic \
120 external/stlport/stlport
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +0400121LOCAL_SRC_FILES := asanwrapper.cc
122LOCAL_CPP_EXTENSION := .cc
123LOCAL_SHARED_LIBRARIES := libstlport libc
Stephen Hines97ac43c2013-01-18 17:46:14 -0800124LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +0400125
126include $(BUILD_EXECUTABLE)
127
128
129include $(CLEAR_VARS)
130
Evgeniy Stepanove48a1972012-03-29 18:09:56 +0400131LOCAL_MODULE := libasan_noinst_test
132LOCAL_MODULE_TAGS := tests
133LOCAL_C_INCLUDES := \
134 bionic \
135 external/stlport/stlport \
Shih-wei Liao51584042012-08-05 17:31:51 -0700136 external/gtest/include \
Stephen Hines1f922a52012-09-10 20:14:46 -0700137 external/compiler-rt/include \
Shih-wei Liao51584042012-08-05 17:31:51 -0700138 external/compiler-rt/lib
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +0400139LOCAL_CFLAGS += \
Evgeniy Stepanove48a1972012-03-29 18:09:56 +0400140 -Wno-unused-parameter \
141 -Wno-sign-compare \
Stephen Hines1f922a52012-09-10 20:14:46 -0700142 -DASAN_UAR=0 \
143 -DASAN_HAS_BLACKLIST=1 \
Evgeniy Stepanove48a1972012-03-29 18:09:56 +0400144 -D__WORDSIZE=32
145LOCAL_SRC_FILES := tests/asan_noinst_test.cc
146LOCAL_CPP_EXTENSION := .cc
147LOCAL_CLANG := true
Stephen Hines97ac43c2013-01-18 17:46:14 -0800148LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Evgeniy Stepanove48a1972012-03-29 18:09:56 +0400149include $(BUILD_STATIC_LIBRARY)
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +0400150
Evgeniy Stepanove48a1972012-03-29 18:09:56 +0400151
152include $(CLEAR_VARS)
153
154LOCAL_MODULE := asan_test
155LOCAL_MODULE_TAGS := tests
156LOCAL_C_INCLUDES := \
157 bionic \
158 external/stlport/stlport \
Shih-wei Liao51584042012-08-05 17:31:51 -0700159 external/gtest/include \
160 external/compiler-rt/lib
Evgeniy Stepanove48a1972012-03-29 18:09:56 +0400161LOCAL_CFLAGS += $(asan_test_cflags)
162LOCAL_SRC_FILES := $(asan_test_files)
163LOCAL_CPP_EXTENSION := .cc
164LOCAL_STATIC_LIBRARIES := libgtest libasan_noinst_test
165LOCAL_SHARED_LIBRARIES := libc libstlport
166LOCAL_ADDRESS_SANITIZER := true
Stephen Hines97ac43c2013-01-18 17:46:14 -0800167LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +0400168
169include $(BUILD_EXECUTABLE)
170
Evgeniy Stepanovdc3865b2012-03-13 15:38:23 +0400171endif # ifeq($(TARGET_ARCH),arm)