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 18ubsan_rtl_files = [ 19 "ubsan_diag.cc", 20 "ubsan_init.cc", 21 "ubsan_flags.cc", 22 "ubsan_handlers.cc", 23 "ubsan_value.cc", 24] 25 26ubsan_cxx_rtl_files = [ 27 "ubsan_handlers_cxx.cc", 28 "ubsan_type_hash.cc", 29 "ubsan_type_hash_itanium.cc", 30 "ubsan_type_hash_win.cc", 31] 32 33ubsan_rtl_cflags = [ 34 "-Wall", 35 "-Werror", 36] 37 38ubsan_rtl_cppflags = [ 39 "-fvisibility=hidden", 40 "-fno-exceptions", 41 "-std=c++11", 42 "-Wno-unused-parameter", 43 "-Wno-non-virtual-dtor", 44 "-DUBSAN_CAN_USE_CXXABI", 45] 46 47ubsan_rtl_c_includes = ["external/compiler-rt/lib"] 48 49cc_library_static { 50 name: "libubsan", 51 host_supported: true, 52 53 include_dirs: ubsan_rtl_c_includes, 54 cflags: ubsan_rtl_cflags, 55 cppflags: ubsan_rtl_cppflags, 56 srcs: ubsan_rtl_files, 57 sdk_version: "19", 58 stl: "none", 59 sanitize: { 60 never: true, 61 }, 62 compile_multilib: "both", 63 target: { 64 host: { 65 cflags: ["-fno-rtti"], 66 }, 67 }, 68} 69 70cc_library_static { 71 name: "libubsan_cxx", 72 host_supported: true, 73 74 include_dirs: ubsan_rtl_c_includes, 75 cflags: ubsan_rtl_cflags, 76 cppflags: ubsan_rtl_cppflags, 77 rtti: true, 78 srcs: ubsan_cxx_rtl_files, 79 sdk_version: "19", 80 sanitize: { 81 never: true, 82 }, 83 compile_multilib: "both", 84} 85 86cc_defaults { 87 name: "libclang_rt_ubsan_defaults", 88 89 include_dirs: [ 90 "external/compiler-rt/lib", 91 "external/compiler-rt/include", 92 ], 93 static_libs: [ 94 "libsan", 95 ], 96 whole_static_libs: [ 97 "libubsan", 98 "libubsan_cxx", 99 ], 100 shared_libs: [ 101 "liblog", 102 "libdl", 103 ], 104 sanitize: { 105 never: true, 106 }, 107 // _cxx bits (vptr-sanitizer and cfi) need dynamic_cast<> 108 stl: "c++_static", 109 sdk_version: "19", 110 enabled: false, 111} 112 113// Disable libubsan_standalone prebuilts in aosp/master until soong has a build 114// option to pick a prebuilt or compile/build a module. 115// 116// cc_library_shared { 117// name: "libclang_rt.ubsan_standalone-arm-android", 118// defaults: ["libclang_rt_ubsan_defaults"], 119// arch: { 120// arm: { 121// enabled: true, 122// }, 123// }, 124// } 125// 126// cc_library_shared { 127// name: "libclang_rt.ubsan_standalone-aarch64-android", 128// defaults: ["libclang_rt_ubsan_defaults"], 129// arch: { 130// arm64: { 131// enabled: true, 132// }, 133// }, 134// } 135// 136// cc_library_shared { 137// name: "libclang_rt.ubsan_standalone-i686-android", 138// defaults: ["libclang_rt_ubsan_defaults"], 139// arch: { 140// x86: { 141// enabled: true, 142// }, 143// }, 144// } 145// 146// cc_library_shared { 147// name: "libclang_rt.ubsan_standalone-x86_64-android", 148// defaults: ["libclang_rt_ubsan_defaults"], 149// arch: { 150// x86_64: { 151// enabled: true, 152// }, 153// }, 154// } 155// 156// cc_library_shared { 157// name: "libclang_rt.ubsan_standalone-mips-android", 158// defaults: ["libclang_rt_ubsan_defaults"], 159// arch: { 160// mips: { 161// enabled: true, 162// }, 163// }, 164// } 165// 166// cc_library_shared { 167// name: "libclang_rt.ubsan_standalone-mips64-android", 168// defaults: ["libclang_rt_ubsan_defaults"], 169// arch: { 170// mips64: { 171// enabled: true, 172// }, 173// }, 174// } 175 176//############################################################################### 177// Host modules 178 179cc_library_host_static { 180 name: "libubsan_standalone", 181 182 include_dirs: ubsan_rtl_c_includes, 183 cflags: ubsan_rtl_cflags, 184 cppflags: ubsan_rtl_cppflags + ["-fno-rtti"], 185 srcs: ubsan_rtl_files, 186 whole_static_libs: ["libsan"], 187 stl: "none", 188 sanitize: { 189 never: true, 190 }, 191 compile_multilib: "both", 192 target: { 193 darwin: { 194 enabled: false, 195 }, 196 }, 197} 198 199cc_library_host_static { 200 name: "libubsan_standalone_cxx", 201 202 include_dirs: ubsan_rtl_c_includes, 203 cflags: ubsan_rtl_cflags, 204 cppflags: ubsan_rtl_cppflags, 205 srcs: ubsan_cxx_rtl_files, 206 sanitize: { 207 never: true, 208 }, 209 compile_multilib: "both", 210 target: { 211 darwin: { 212 enabled: false, 213 }, 214 }, 215} 216