Android.mk revision dc3865b01cd56b703b77f58d5acff6529491eaf3
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
26
27asan_rtl_files := \
28	asan_rtl.cc \
29	asan_allocator.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_poisoning.cc	\
37	asan_posix.cc \
38	asan_printf.cc	\
39	asan_stack.cc	\
40	asan_stats.cc	\
41	asan_thread.cc	\
42	asan_thread_registry.cc	\
43	interception/interception_linux.cc
44
45asan_rtl_cflags := \
46	-fvisibility=hidden \
47	-fno-exceptions \
48	-DASAN_LOW_MEMORY=1 \
49	-DASAN_NEEDS_SEGV=$(ASAN_NEEDS_SEGV) \
50	-DASAN_HAS_EXCEPTIONS=$(ASAN_HAS_EXCEPTIONS) \
51	-DASAN_FLEXIBLE_MAPPING_AND_OFFSET=$(ASAN_FLEXIBLE_MAPPING_AND_OFFSET) \
52	-Wno-covered-switch-default \
53	-Wno-sign-compare
54
55asan_test_files := \
56	tests/asan_test.cc \
57	tests/asan_globals_test.cc \
58	tests/asan_break_optimization.cc \
59	tests/asan_interface_test.cc
60
61asan_test_cflags := \
62	-DADDRESS_SANITIZER=1 \
63	-faddress-sanitizer \
64	-mllvm -asan-blacklist=external/asan/tests/asan_test.ignore \
65	-mllvm -asan-stack=1 \
66	-mllvm -asan-globals=1 \
67	-mllvm -asan-mapping-scale=0 \
68	-mllvm -asan-mapping-offset-log=-1 \
69	-mllvm -asan-use-after-return=0 \
70	-DASAN_LOW_MEMORY=1 \
71	-DASAN_UAR=0 \
72	-DASAN_NEEDS_SEGV=$(ASAN_NEEDS_SEGV) \
73	-DASAN_HAS_EXCEPTIONS=$(ASAN_HAS_EXCEPTIONS) \
74	-DASAN_HAS_BLACKLIST=1 \
75	-Wno-covered-switch-default
76
77
78include $(CLEAR_VARS)
79
80LOCAL_C_INCLUDES := \
81	        bionic
82
83LOCAL_MODULE := libasan
84LOCAL_MODULE_TAGS := optional
85LOCAL_CFLAGS += \
86	$(asan_rtl_cflags) \
87	-Wno-unused-parameter \
88	-D__WORDSIZE=32
89LOCAL_SRC_FILES := asan_android_stub.cc
90LOCAL_CPP_EXTENSION := .cc
91LOCAL_CLANG := true
92include $(BUILD_STATIC_LIBRARY)
93
94
95
96include $(CLEAR_VARS)
97
98LOCAL_C_INCLUDES := \
99	        bionic
100
101LOCAL_MODULE := libasan_preload
102LOCAL_MODULE_TAGS := optional
103LOCAL_CFLAGS += \
104	$(asan_rtl_cflags) \
105	-Wno-unused-parameter \
106	-D__WORDSIZE=32
107LOCAL_SRC_FILES := $(asan_rtl_files)
108LOCAL_CPP_EXTENSION := .cc
109LOCAL_SHARED_LIBRARIES := libc libstlport libdl
110LOCAL_CLANG := true
111include $(BUILD_SHARED_LIBRARY)
112
113
114include $(CLEAR_VARS)
115
116LOCAL_MODULE := asanwrapper
117LOCAL_MODULE_TAGS := optional
118
119LOCAL_C_INCLUDES := \
120        bionic \
121        external/stlport/stlport
122
123LOCAL_SRC_FILES := asanwrapper.cc
124LOCAL_CPP_EXTENSION := .cc
125LOCAL_SHARED_LIBRARIES := libstlport libc
126
127include $(BUILD_EXECUTABLE)
128
129
130include $(CLEAR_VARS)
131
132LOCAL_SRC_FILES:= \
133	../../../../frameworks/base/cmds/app_process/app_main.cpp
134
135LOCAL_SHARED_LIBRARIES := \
136	libcutils \
137	libutils \
138	libbinder \
139	libandroid_runtime
140
141LOCAL_MODULE:= asan/app_process
142LOCAL_MODULE_TAGS := optional
143
144LOCAL_CFLAGS += \
145       -faddress-sanitizer
146LOCAL_LDFLAGS += -Wl,-u,__asan_preinit
147
148LOCAL_STATIC_LIBRARIES += libasan
149LOCAL_SHARED_LIBRARIES += libdl libasan_preload
150LOCAL_CLANG:=true
151
152include $(BUILD_EXECUTABLE)
153
154endif # ifeq($(TARGET_ARCH),arm)
155