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 | |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 49 | cc_defaults { |
| 50 | name: "libscudo_defaults", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 51 | native_coverage: false, |
Yifan Hong | dc883f1 | 2020-01-21 17:12:16 -0800 | [diff] [blame] | 52 | ramdisk_available: true, |
Yifan Hong | ad0cccd | 2020-10-21 18:43:34 -0700 | [diff] [blame] | 53 | vendor_ramdisk_available: true, |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 54 | recovery_available: true, |
| 55 | host_supported: true, |
| 56 | native_bridge_supported: true, |
| 57 | |
| 58 | rtti: false, |
| 59 | stl: "none", |
| 60 | |
| 61 | cflags: [ |
| 62 | "-O3", |
| 63 | "-fno-rtti", |
Christopher Ferris | 7435ef7 | 2019-09-25 17:43:02 -0700 | [diff] [blame] | 64 | // This option speeds up alloc/free code paths by about 5% to 7%. |
| 65 | "-fno-stack-protector", |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 66 | "-fno-emulated-tls", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 67 | |
| 68 | "-Wall", |
| 69 | "-Wextra", |
| 70 | "-Wunused", |
| 71 | "-Wno-unused-result", |
| 72 | |
| 73 | "-Werror=pointer-to-int-cast", |
| 74 | "-Werror=int-to-pointer-cast", |
| 75 | "-Werror=type-limits", |
| 76 | "-Werror", |
Christopher Ferris | df4af6d | 2020-01-14 13:48:30 -0800 | [diff] [blame] | 77 | |
| 78 | // Always force alignment to 16 bytes even on 32 bit. |
| 79 | // Android assumes that allocations of multiples of 16 bytes |
| 80 | // will be aligned to at least 16 bytes. |
| 81 | "-DSCUDO_MIN_ALIGNMENT_LOG=4", |
Peter Collingbourne | df9219e | 2020-04-23 13:29:34 -0700 | [diff] [blame] | 82 | |
| 83 | // Allow scudo to use android_unsafe_frame_pointer_chase(), which is |
| 84 | // normally a private function. |
| 85 | "-DHAVE_ANDROID_UNSAFE_FRAME_POINTER_CHASE", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 86 | ], |
| 87 | cppflags: [ |
| 88 | "-nostdinc++", |
| 89 | "-fno-exceptions", |
| 90 | ], |
| 91 | |
Dynamic Tools Team | 2661559 | 2020-03-23 16:08:18 -0700 | [diff] [blame] | 92 | include_dirs: [ |
| 93 | "external/scudo/standalone/include", |
| 94 | ], |
| 95 | |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 96 | system_shared_libs: [], |
| 97 | |
| 98 | srcs: [ |
| 99 | "standalone/checksum.cpp", |
| 100 | "standalone/common.cpp", |
| 101 | "standalone/flags.cpp", |
| 102 | "standalone/flags_parser.cpp", |
| 103 | "standalone/linux.cpp", |
Christopher Ferris | 4998f8c | 2020-02-18 10:51:54 -0800 | [diff] [blame] | 104 | "standalone/release.cpp", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 105 | "standalone/report.cpp", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 106 | "standalone/string_utils.cpp", |
| 107 | "standalone/wrappers_c_bionic.cpp" |
| 108 | ], |
| 109 | arch: { |
| 110 | arm: { |
| 111 | cflags: ["-mcrc"], |
| 112 | srcs: ["standalone/crc32_hw.cpp"], |
| 113 | }, |
| 114 | arm64: { |
| 115 | cflags: ["-mcrc"], |
| 116 | srcs: ["standalone/crc32_hw.cpp"], |
| 117 | }, |
| 118 | x86_64: { |
| 119 | cflags: ["-msse4.2"], |
| 120 | srcs: ["standalone/crc32_hw.cpp"], |
| 121 | }, |
| 122 | x86: { |
| 123 | cflags: ["-msse4.2"], |
| 124 | srcs: ["standalone/crc32_hw.cpp"], |
| 125 | }, |
| 126 | }, |
| 127 | |
| 128 | target: { |
| 129 | linux_glibc: { |
| 130 | enabled: true, |
| 131 | }, |
Martin Stjernholm | 2ad96b1 | 2020-04-23 16:48:50 +0100 | [diff] [blame] | 132 | android: { |
| 133 | header_libs: ["bionic_libc_platform_headers"], |
Martin Stjernholm | 2ad96b1 | 2020-04-23 16:48:50 +0100 | [diff] [blame] | 134 | }, |
| 135 | linux_bionic: { |
| 136 | header_libs: ["bionic_libc_platform_headers"], |
Peter Collingbourne | 6500693 | 2019-11-26 20:02:40 -0800 | [diff] [blame] | 137 | }, |
Peter Collingbourne | d9c9164 | 2021-03-16 12:05:04 -0700 | [diff] [blame] | 138 | native_bridge: { |
| 139 | cflags: ["-DSCUDO_DISABLE_TBI"], |
| 140 | }, |
Peter Collingbourne | 6500693 | 2019-11-26 20:02:40 -0800 | [diff] [blame] | 141 | }, |
Martin Stjernholm | 62c0de7 | 2020-04-09 00:14:02 +0100 | [diff] [blame] | 142 | |
| 143 | header_libs: ["libc_headers"], |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 144 | } |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 145 | |
| 146 | cc_library_static { |
| 147 | name: "libscudo", |
| 148 | defaults: ["libscudo_defaults"], |
Peter Collingbourne | fcef128 | 2020-09-09 14:37:03 -0700 | [diff] [blame] | 149 | cflags: [ |
| 150 | "-D_BIONIC=1", |
| 151 | "-DSCUDO_HAS_PLATFORM_TLS_SLOT", |
| 152 | ], |
Elliott Hughes | 260aa99 | 2020-09-18 14:54:47 -0700 | [diff] [blame] | 153 | visibility: [ |
| 154 | "//bionic:__subpackages__", |
Victor Khimenko | 0147199 | 2020-11-05 17:18:02 +0100 | [diff] [blame] | 155 | "//frameworks/libs/native_bridge_support/libc:__subpackages__", |
Elliott Hughes | 260aa99 | 2020-09-18 14:54:47 -0700 | [diff] [blame] | 156 | "//system/core/debuggerd:__subpackages__", |
| 157 | ], |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | cc_library_static { |
| 161 | name: "libscudo_for_testing", |
| 162 | defaults: ["libscudo_defaults"], |
| 163 | } |
| 164 | |
| 165 | cc_test { |
| 166 | name: "scudo_unit_tests", |
Peter Collingbourne | 4b57c90 | 2021-02-23 14:48:10 -0800 | [diff] [blame] | 167 | // Temporarily disabled on host due to a 15-20s per-test timeout, |
| 168 | // which is currently exceeded by ScudoCombinedTest.BasicCombined. |
| 169 | host_supported: false, |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 170 | srcs: [ |
| 171 | "standalone/tests/atomic_test.cpp", |
| 172 | "standalone/tests/bytemap_test.cpp", |
| 173 | "standalone/tests/checksum_test.cpp", |
| 174 | "standalone/tests/chunk_test.cpp", |
| 175 | "standalone/tests/combined_test.cpp", |
| 176 | "standalone/tests/flags_test.cpp", |
| 177 | "standalone/tests/list_test.cpp", |
| 178 | "standalone/tests/map_test.cpp", |
| 179 | "standalone/tests/mutex_test.cpp", |
| 180 | "standalone/tests/primary_test.cpp", |
| 181 | "standalone/tests/quarantine_test.cpp", |
| 182 | "standalone/tests/release_test.cpp", |
| 183 | "standalone/tests/report_test.cpp", |
| 184 | "standalone/tests/scudo_unit_test_main.cpp", |
| 185 | "standalone/tests/secondary_test.cpp", |
| 186 | "standalone/tests/size_class_map_test.cpp", |
| 187 | "standalone/tests/stats_test.cpp", |
| 188 | "standalone/tests/strings_test.cpp", |
| 189 | "standalone/tests/tsd_test.cpp", |
| 190 | "standalone/tests/vector_test.cpp", |
| 191 | ], |
| 192 | static_libs: ["libscudo_for_testing"], |
| 193 | include_dirs: [ |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 194 | "external/scudo/standalone", |
Dynamic Tools Team | 2661559 | 2020-03-23 16:08:18 -0700 | [diff] [blame] | 195 | "external/scudo/standalone/include", |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 196 | ], |
| 197 | cflags: [ |
| 198 | "-Wno-unused-parameter", |
| 199 | "-fno-emulated-tls", |
| 200 | ], |
Martin Stjernholm | 2ad96b1 | 2020-04-23 16:48:50 +0100 | [diff] [blame] | 201 | target: { |
| 202 | android: { |
| 203 | header_libs: ["bionic_libc_platform_headers"], |
Martin Stjernholm | 2ad96b1 | 2020-04-23 16:48:50 +0100 | [diff] [blame] | 204 | }, |
| 205 | linux_bionic: { |
| 206 | header_libs: ["bionic_libc_platform_headers"], |
Peter Collingbourne | 6500693 | 2019-11-26 20:02:40 -0800 | [diff] [blame] | 207 | }, |
| 208 | }, |
Christopher Ferris | dadba4c | 2019-11-21 14:34:40 -0800 | [diff] [blame] | 209 | test_suites: ["general-tests"], |
Peter Collingbourne | af40e25 | 2020-04-23 13:26:14 -0700 | [diff] [blame] | 210 | bootstrap: true, |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 211 | } |
Branden Archer | 6cc4d1c | 2020-10-16 12:47:29 -0700 | [diff] [blame] | 212 | |
| 213 | cc_fuzz { |
| 214 | name: "scudo_get_error_info_fuzzer", |
| 215 | host_supported: true, |
| 216 | compile_multilib: "64", |
| 217 | static_libs: ["libscudo"], |
| 218 | include_dirs: [ |
| 219 | "external/scudo/standalone", |
| 220 | "external/scudo/standalone/include", |
| 221 | ], |
| 222 | cflags: [ |
| 223 | "-Wno-unneeded-internal-declaration", |
| 224 | ], |
| 225 | srcs: ["standalone/fuzz/get_error_info_fuzzer.cpp"], |
| 226 | fuzz_config: { |
| 227 | componentid: 87896 |
| 228 | }, |
| 229 | } |