Home | History | Annotate | Download | only in asan
      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 
     18 LOCAL_PATH:= $(call my-dir)
     19 
     20 ifeq ($(TARGET_ARCH),arm)
     21 
     22 ASAN_NEEDS_SEGV=0
     23 ASAN_HAS_EXCEPTIONS=1
     24 ASAN_FLEXIBLE_MAPPING_AND_OFFSET=0
     25 
     26 asan_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 
     66 asan_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 
     78 asan_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 
     85 asan_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 
     98 include $(CLEAR_VARS)
     99 
    100 LOCAL_MODULE := libasan
    101 LOCAL_MODULE_TAGS := optional
    102 LOCAL_C_INCLUDES := bionic external/compiler-rt/lib external/compiler-rt/include
    103 LOCAL_CFLAGS += $(asan_rtl_cflags)
    104 LOCAL_SRC_FILES := asan_preinit.cc
    105 #LOCAL_SRC_FILES := asan_android_stub.cc asan_preinit.cc
    106 LOCAL_CPP_EXTENSION := .cc
    107 LOCAL_CLANG := true
    108 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
    109 include $(BUILD_STATIC_LIBRARY)
    110 
    111 
    112 include $(CLEAR_VARS)
    113 
    114 LOCAL_MODULE := libasan_preload
    115 LOCAL_MODULE_TAGS := eng
    116 LOCAL_C_INCLUDES := \
    117   bionic \
    118   external/compiler-rt/lib \
    119   external/compiler-rt/include
    120 LOCAL_CFLAGS += $(asan_rtl_cflags)
    121 LOCAL_SRC_FILES := $(asan_rtl_files)
    122 LOCAL_CPP_EXTENSION := .cc
    123 LOCAL_SHARED_LIBRARIES := libc libdl
    124 LOCAL_CLANG := true
    125 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
    126 include $(BUILD_SHARED_LIBRARY)
    127 
    128 
    129 include $(CLEAR_VARS)
    130 
    131 LOCAL_MODULE := asanwrapper
    132 LOCAL_MODULE_TAGS := eng
    133 LOCAL_C_INCLUDES := \
    134         bionic \
    135         external/stlport/stlport
    136 LOCAL_SRC_FILES := asanwrapper.cc
    137 LOCAL_CPP_EXTENSION := .cc
    138 LOCAL_SHARED_LIBRARIES := libstlport libc
    139 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
    140 
    141 include $(BUILD_EXECUTABLE)
    142 
    143 
    144 include $(CLEAR_VARS)
    145 
    146 LOCAL_MODULE := libasan_noinst_test
    147 LOCAL_MODULE_TAGS := tests
    148 LOCAL_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
    156 LOCAL_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
    164 LOCAL_SRC_FILES := tests/asan_noinst_test.cc tests/asan_test_main.cc
    165 LOCAL_CPP_EXTENSION := .cc
    166 LOCAL_CLANG := true
    167 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
    168 include $(BUILD_STATIC_LIBRARY)
    169 
    170 
    171 include $(CLEAR_VARS)
    172 
    173 LOCAL_MODULE := asan_test
    174 LOCAL_MODULE_TAGS := tests
    175 LOCAL_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
    182 LOCAL_CFLAGS += $(asan_test_cflags)
    183 LOCAL_SRC_FILES := $(asan_test_files)
    184 LOCAL_CPP_EXTENSION := .cc
    185 LOCAL_STATIC_LIBRARIES := libgtest libasan_noinst_test
    186 LOCAL_SHARED_LIBRARIES := libc libstlport
    187 LOCAL_ADDRESS_SANITIZER := true
    188 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
    189 
    190 include $(BUILD_EXECUTABLE)
    191 
    192 endif # ifeq($(TARGET_ARCH),arm)
    193