1 # 2 # Copyright (C) 2015 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 ubsan_rtl_files := \ 21 ubsan_diag.cc \ 22 ubsan_init.cc \ 23 ubsan_flags.cc \ 24 ubsan_handlers.cc \ 25 ubsan_value.cc \ 26 27 ubsan_cxx_rtl_files := \ 28 ubsan_handlers_cxx.cc \ 29 ubsan_type_hash.cc \ 30 ubsan_type_hash_itanium.cc \ 31 ubsan_type_hash_win.cc \ 32 33 ubsan_rtl_cppflags := \ 34 -fvisibility=hidden \ 35 -fno-exceptions \ 36 -std=c++11 \ 37 -Wall \ 38 -Werror \ 39 -Wno-unused-parameter \ 40 -Wno-non-virtual-dtor \ 41 42 ubsan_rtl_c_includes := \ 43 external/compiler-rt/lib \ 44 45 ################################################################################ 46 # Target modules 47 48 include $(CLEAR_VARS) 49 LOCAL_MODULE := libubsan 50 LOCAL_CPP_EXTENSION := .cc 51 LOCAL_C_INCLUDES := $(ubsan_rtl_c_includes) 52 LOCAL_CPPFLAGS := $(ubsan_rtl_cppflags) 53 LOCAL_SRC_FILES := $(ubsan_rtl_files) 54 LOCAL_NDK_STL_VARIANT := none 55 LOCAL_SDK_VERSION := 19 56 LOCAL_SANITIZE := never 57 LOCAL_MODULE_TARGET_ARCH := arm arm64 x86 58 LOCAL_MULTILIB := both 59 include $(BUILD_STATIC_LIBRARY) 60 61 ################################################################################ 62 # Host modules 63 64 ifneq ($(HOST_OS),darwin) 65 66 include $(CLEAR_VARS) 67 LOCAL_MODULE := libubsan 68 LOCAL_CPP_EXTENSION := .cc 69 LOCAL_C_INCLUDES := $(ubsan_rtl_c_includes) 70 LOCAL_CPPFLAGS := $(ubsan_rtl_cppflags) -fno-rtti 71 LOCAL_SRC_FILES := $(ubsan_rtl_files) 72 LOCAL_CXX_STL := none 73 LOCAL_SANITIZE := never 74 LOCAL_MULTILIB := both 75 include $(BUILD_HOST_STATIC_LIBRARY) 76 77 include $(CLEAR_VARS) 78 LOCAL_MODULE := libubsan_standalone 79 LOCAL_CPP_EXTENSION := .cc 80 LOCAL_C_INCLUDES := $(ubsan_rtl_c_includes) 81 LOCAL_CPPFLAGS := $(ubsan_rtl_cppflags) -fno-rtti 82 LOCAL_SRC_FILES := $(ubsan_rtl_files) 83 LOCAL_WHOLE_STATIC_LIBRARIES := libsan 84 LOCAL_CXX_STL := none 85 LOCAL_SANITIZE := never 86 LOCAL_MULTILIB := both 87 include $(BUILD_HOST_STATIC_LIBRARY) 88 89 include $(CLEAR_VARS) 90 LOCAL_MODULE := libubsan_cxx 91 LOCAL_CPP_EXTENSION := .cc 92 LOCAL_C_INCLUDES := $(ubsan_rtl_c_includes) 93 LOCAL_CPPFLAGS := $(ubsan_rtl_cppflags) 94 LOCAL_SRC_FILES := $(ubsan_cxx_rtl_files) 95 LOCAL_SANITIZE := never 96 LOCAL_MULTILIB := both 97 include $(BUILD_HOST_STATIC_LIBRARY) 98 99 include $(CLEAR_VARS) 100 LOCAL_MODULE := libubsan_standalone_cxx 101 LOCAL_CPP_EXTENSION := .cc 102 LOCAL_C_INCLUDES := $(ubsan_rtl_c_includes) 103 LOCAL_CPPFLAGS := $(ubsan_rtl_cppflags) 104 LOCAL_SRC_FILES := $(ubsan_cxx_rtl_files) 105 LOCAL_SANITIZE := never 106 LOCAL_MULTILIB := both 107 include $(BUILD_HOST_STATIC_LIBRARY) 108 109 endif 110