Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2019 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 | |
Bob Badour | 5972a70 | 2021-02-03 17:15:26 -0800 | [diff] [blame] | 17 | package { |
| 18 | default_applicable_licenses: ["external_scudo_license"], |
| 19 | } |
| 20 | |
| 21 | // Added automatically by a large-scale-change that took the approach of |
| 22 | // 'apply every license found to every target'. While this makes sure we respect |
| 23 | // every license restriction, it may not be entirely correct. |
| 24 | // |
| 25 | // e.g. GPL in an MIT project might only apply to the contrib/ directory. |
| 26 | // |
| 27 | // Please consider splitting the single license below into multiple licenses, |
| 28 | // taking care not to lose any license_kind information, and overriding the |
| 29 | // default license using the 'licenses: [...]' property on targets as needed. |
| 30 | // |
| 31 | // For unused files, consider creating a 'filegroup' with "//visibility:private" |
| 32 | // to attach the license to, and including a comment whether the files may be |
| 33 | // used in the current project. |
| 34 | // http://go/android-license-faq |
| 35 | license { |
| 36 | name: "external_scudo_license", |
| 37 | visibility: [":__subpackages__"], |
| 38 | license_kinds: [ |
| 39 | "SPDX-license-identifier-Apache-2.0", |
| 40 | "SPDX-license-identifier-BSD", |
| 41 | "SPDX-license-identifier-MIT", |
| 42 | "SPDX-license-identifier-NCSA", |
| 43 | ], |
| 44 | license_text: [ |
| 45 | "LICENSE.TXT", |
| 46 | ], |
| 47 | } |
| 48 | |
Christopher Ferris | 90c9dbf | 2021-09-24 11:54:31 -0700 | [diff] [blame] | 49 | cc_library_headers { |
| 50 | name: "scudo_headers", |
| 51 | recovery_available: true, |
| 52 | vendor_ramdisk_available: true, |
| 53 | |
| 54 | export_include_dirs: [ |
| 55 | "standalone/include", |
| 56 | ], |
| 57 | |
| 58 | apex_available: [ |
| 59 | "com.android.runtime", |
| 60 | ], |
| 61 | |
| 62 | visibility: [ |
| 63 | "//system/core/debuggerd", |
| 64 | ], |
| 65 | } |
| 66 | |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 67 | cc_defaults { |
| 68 | name: "libscudo_defaults", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 69 | native_coverage: false, |
Yifan Hong | dc883f1 | 2020-01-21 17:12:16 -0800 | [diff] [blame] | 70 | ramdisk_available: true, |
Yifan Hong | ad0cccd | 2020-10-21 18:43:34 -0700 | [diff] [blame] | 71 | vendor_ramdisk_available: true, |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 72 | recovery_available: true, |
| 73 | host_supported: true, |
| 74 | native_bridge_supported: true, |
| 75 | |
| 76 | rtti: false, |
| 77 | stl: "none", |
| 78 | |
| 79 | cflags: [ |
| 80 | "-O3", |
| 81 | "-fno-rtti", |
Christopher Ferris | 7435ef7 | 2019-09-25 17:43:02 -0700 | [diff] [blame] | 82 | // This option speeds up alloc/free code paths by about 5% to 7%. |
| 83 | "-fno-stack-protector", |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 84 | "-fno-emulated-tls", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 85 | |
| 86 | "-Wall", |
| 87 | "-Wextra", |
| 88 | "-Wunused", |
| 89 | "-Wno-unused-result", |
| 90 | |
| 91 | "-Werror=pointer-to-int-cast", |
| 92 | "-Werror=int-to-pointer-cast", |
| 93 | "-Werror=type-limits", |
| 94 | "-Werror", |
Christopher Ferris | df4af6d | 2020-01-14 13:48:30 -0800 | [diff] [blame] | 95 | |
| 96 | // Always force alignment to 16 bytes even on 32 bit. |
| 97 | // Android assumes that allocations of multiples of 16 bytes |
| 98 | // will be aligned to at least 16 bytes. |
| 99 | "-DSCUDO_MIN_ALIGNMENT_LOG=4", |
Peter Collingbourne | df9219e | 2020-04-23 13:29:34 -0700 | [diff] [blame] | 100 | |
| 101 | // Allow scudo to use android_unsafe_frame_pointer_chase(), which is |
| 102 | // normally a private function. |
| 103 | "-DHAVE_ANDROID_UNSAFE_FRAME_POINTER_CHASE", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 104 | ], |
| 105 | cppflags: [ |
| 106 | "-nostdinc++", |
| 107 | "-fno-exceptions", |
| 108 | ], |
| 109 | |
Dynamic Tools Team | 2661559 | 2020-03-23 16:08:18 -0700 | [diff] [blame] | 110 | include_dirs: [ |
| 111 | "external/scudo/standalone/include", |
| 112 | ], |
| 113 | |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 114 | srcs: [ |
| 115 | "standalone/checksum.cpp", |
| 116 | "standalone/common.cpp", |
| 117 | "standalone/flags.cpp", |
| 118 | "standalone/flags_parser.cpp", |
| 119 | "standalone/linux.cpp", |
Christopher Ferris | 4998f8c | 2020-02-18 10:51:54 -0800 | [diff] [blame] | 120 | "standalone/release.cpp", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 121 | "standalone/report.cpp", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 122 | "standalone/string_utils.cpp", |
| 123 | "standalone/wrappers_c_bionic.cpp" |
| 124 | ], |
| 125 | arch: { |
| 126 | arm: { |
| 127 | cflags: ["-mcrc"], |
| 128 | srcs: ["standalone/crc32_hw.cpp"], |
| 129 | }, |
| 130 | arm64: { |
| 131 | cflags: ["-mcrc"], |
| 132 | srcs: ["standalone/crc32_hw.cpp"], |
| 133 | }, |
| 134 | x86_64: { |
| 135 | cflags: ["-msse4.2"], |
| 136 | srcs: ["standalone/crc32_hw.cpp"], |
| 137 | }, |
| 138 | x86: { |
| 139 | cflags: ["-msse4.2"], |
| 140 | srcs: ["standalone/crc32_hw.cpp"], |
| 141 | }, |
| 142 | }, |
| 143 | |
| 144 | target: { |
Colin Cross | d178a19 | 2021-12-15 14:49:42 -0800 | [diff] [blame] | 145 | bionic: { |
| 146 | system_shared_libs: [], |
| 147 | header_libs: [ |
| 148 | "libc_headers", |
| 149 | "bionic_libc_platform_headers", |
| 150 | ], |
| 151 | }, |
Peter Collingbourne | d9c9164 | 2021-03-16 12:05:04 -0700 | [diff] [blame] | 152 | native_bridge: { |
| 153 | cflags: ["-DSCUDO_DISABLE_TBI"], |
| 154 | }, |
Peter Collingbourne | 6500693 | 2019-11-26 20:02:40 -0800 | [diff] [blame] | 155 | }, |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 156 | } |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 157 | |
| 158 | cc_library_static { |
| 159 | name: "libscudo", |
| 160 | defaults: ["libscudo_defaults"], |
Peter Collingbourne | fcef128 | 2020-09-09 14:37:03 -0700 | [diff] [blame] | 161 | cflags: [ |
| 162 | "-D_BIONIC=1", |
| 163 | "-DSCUDO_HAS_PLATFORM_TLS_SLOT", |
| 164 | ], |
Elliott Hughes | 260aa99 | 2020-09-18 14:54:47 -0700 | [diff] [blame] | 165 | visibility: [ |
| 166 | "//bionic:__subpackages__", |
Victor Khimenko | 0147199 | 2020-11-05 17:18:02 +0100 | [diff] [blame] | 167 | "//frameworks/libs/native_bridge_support/libc:__subpackages__", |
Elliott Hughes | 260aa99 | 2020-09-18 14:54:47 -0700 | [diff] [blame] | 168 | "//system/core/debuggerd:__subpackages__", |
| 169 | ], |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 170 | } |
| 171 | |
| 172 | cc_library_static { |
| 173 | name: "libscudo_for_testing", |
| 174 | defaults: ["libscudo_defaults"], |
| 175 | } |
| 176 | |
| 177 | cc_test { |
| 178 | name: "scudo_unit_tests", |
Peter Collingbourne | 4b57c90 | 2021-02-23 14:48:10 -0800 | [diff] [blame] | 179 | // Temporarily disabled on host due to a 15-20s per-test timeout, |
| 180 | // which is currently exceeded by ScudoCombinedTest.BasicCombined. |
| 181 | host_supported: false, |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 182 | srcs: [ |
| 183 | "standalone/tests/atomic_test.cpp", |
| 184 | "standalone/tests/bytemap_test.cpp", |
| 185 | "standalone/tests/checksum_test.cpp", |
| 186 | "standalone/tests/chunk_test.cpp", |
| 187 | "standalone/tests/combined_test.cpp", |
| 188 | "standalone/tests/flags_test.cpp", |
| 189 | "standalone/tests/list_test.cpp", |
| 190 | "standalone/tests/map_test.cpp", |
| 191 | "standalone/tests/mutex_test.cpp", |
| 192 | "standalone/tests/primary_test.cpp", |
| 193 | "standalone/tests/quarantine_test.cpp", |
| 194 | "standalone/tests/release_test.cpp", |
| 195 | "standalone/tests/report_test.cpp", |
| 196 | "standalone/tests/scudo_unit_test_main.cpp", |
| 197 | "standalone/tests/secondary_test.cpp", |
| 198 | "standalone/tests/size_class_map_test.cpp", |
| 199 | "standalone/tests/stats_test.cpp", |
| 200 | "standalone/tests/strings_test.cpp", |
| 201 | "standalone/tests/tsd_test.cpp", |
| 202 | "standalone/tests/vector_test.cpp", |
| 203 | ], |
| 204 | static_libs: ["libscudo_for_testing"], |
| 205 | include_dirs: [ |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 206 | "external/scudo/standalone", |
Dynamic Tools Team | 2661559 | 2020-03-23 16:08:18 -0700 | [diff] [blame] | 207 | "external/scudo/standalone/include", |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 208 | ], |
| 209 | cflags: [ |
| 210 | "-Wno-unused-parameter", |
| 211 | "-fno-emulated-tls", |
| 212 | ], |
Martin Stjernholm | 2ad96b1 | 2020-04-23 16:48:50 +0100 | [diff] [blame] | 213 | target: { |
Colin Cross | 2671c94 | 2022-03-08 15:12:49 -0800 | [diff] [blame] | 214 | bionic: { |
Martin Stjernholm | 2ad96b1 | 2020-04-23 16:48:50 +0100 | [diff] [blame] | 215 | header_libs: ["bionic_libc_platform_headers"], |
Peter Collingbourne | 6500693 | 2019-11-26 20:02:40 -0800 | [diff] [blame] | 216 | }, |
| 217 | }, |
Christopher Ferris | dadba4c | 2019-11-21 14:34:40 -0800 | [diff] [blame] | 218 | test_suites: ["general-tests"], |
Peter Collingbourne | af40e25 | 2020-04-23 13:26:14 -0700 | [diff] [blame] | 219 | bootstrap: true, |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 220 | } |
Branden Archer | 6cc4d1c | 2020-10-16 12:47:29 -0700 | [diff] [blame] | 221 | |
| 222 | cc_fuzz { |
| 223 | name: "scudo_get_error_info_fuzzer", |
| 224 | host_supported: true, |
| 225 | compile_multilib: "64", |
| 226 | static_libs: ["libscudo"], |
| 227 | include_dirs: [ |
| 228 | "external/scudo/standalone", |
| 229 | "external/scudo/standalone/include", |
| 230 | ], |
| 231 | cflags: [ |
| 232 | "-Wno-unneeded-internal-declaration", |
| 233 | ], |
| 234 | srcs: ["standalone/fuzz/get_error_info_fuzzer.cpp"], |
| 235 | fuzz_config: { |
| 236 | componentid: 87896 |
| 237 | }, |
| 238 | } |