blob: ab3fb0d0a3479335d0425082b1f304a45f445070 [file] [log] [blame]
Christopher Ferriscbfcc162019-09-24 12:28:10 -07001//
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 Badour5972a702021-02-03 17:15:26 -080017package {
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
35license {
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 Ferris90c9dbf2021-09-24 11:54:31 -070049cc_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 Collingbourne1c182602019-11-19 16:07:42 -080067cc_defaults {
68 name: "libscudo_defaults",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070069 native_coverage: false,
Yifan Hongdc883f12020-01-21 17:12:16 -080070 ramdisk_available: true,
Yifan Hongad0cccd2020-10-21 18:43:34 -070071 vendor_ramdisk_available: true,
Christopher Ferriscbfcc162019-09-24 12:28:10 -070072 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 Ferris7435ef72019-09-25 17:43:02 -070082 // This option speeds up alloc/free code paths by about 5% to 7%.
83 "-fno-stack-protector",
Peter Collingbourne1c182602019-11-19 16:07:42 -080084 "-fno-emulated-tls",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070085
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 Ferrisdf4af6d2020-01-14 13:48:30 -080095
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 Collingbournedf9219e2020-04-23 13:29:34 -0700100
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 Ferriscbfcc162019-09-24 12:28:10 -0700104 ],
105 cppflags: [
106 "-nostdinc++",
107 "-fno-exceptions",
108 ],
109
Dynamic Tools Team26615592020-03-23 16:08:18 -0700110 include_dirs: [
111 "external/scudo/standalone/include",
112 ],
113
Christopher Ferriscbfcc162019-09-24 12:28:10 -0700114 srcs: [
115 "standalone/checksum.cpp",
116 "standalone/common.cpp",
117 "standalone/flags.cpp",
118 "standalone/flags_parser.cpp",
119 "standalone/linux.cpp",
Christopher Ferris4998f8c2020-02-18 10:51:54 -0800120 "standalone/release.cpp",
Christopher Ferriscbfcc162019-09-24 12:28:10 -0700121 "standalone/report.cpp",
Christopher Ferriscbfcc162019-09-24 12:28:10 -0700122 "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 Crossd178a192021-12-15 14:49:42 -0800145 bionic: {
146 system_shared_libs: [],
147 header_libs: [
148 "libc_headers",
149 "bionic_libc_platform_headers",
150 ],
151 },
Peter Collingbourned9c91642021-03-16 12:05:04 -0700152 native_bridge: {
153 cflags: ["-DSCUDO_DISABLE_TBI"],
154 },
Peter Collingbourne65006932019-11-26 20:02:40 -0800155 },
Christopher Ferriscbfcc162019-09-24 12:28:10 -0700156}
Peter Collingbourne1c182602019-11-19 16:07:42 -0800157
158cc_library_static {
159 name: "libscudo",
160 defaults: ["libscudo_defaults"],
Peter Collingbournefcef1282020-09-09 14:37:03 -0700161 cflags: [
162 "-D_BIONIC=1",
163 "-DSCUDO_HAS_PLATFORM_TLS_SLOT",
164 ],
Elliott Hughes260aa992020-09-18 14:54:47 -0700165 visibility: [
166 "//bionic:__subpackages__",
Victor Khimenko01471992020-11-05 17:18:02 +0100167 "//frameworks/libs/native_bridge_support/libc:__subpackages__",
Elliott Hughes260aa992020-09-18 14:54:47 -0700168 "//system/core/debuggerd:__subpackages__",
169 ],
Peter Collingbourne1c182602019-11-19 16:07:42 -0800170}
171
172cc_library_static {
173 name: "libscudo_for_testing",
174 defaults: ["libscudo_defaults"],
175}
176
177cc_test {
178 name: "scudo_unit_tests",
Peter Collingbourne4b57c902021-02-23 14:48:10 -0800179 // 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 Collingbourne1c182602019-11-19 16:07:42 -0800182 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 Collingbourne1c182602019-11-19 16:07:42 -0800206 "external/scudo/standalone",
Dynamic Tools Team26615592020-03-23 16:08:18 -0700207 "external/scudo/standalone/include",
Peter Collingbourne1c182602019-11-19 16:07:42 -0800208 ],
209 cflags: [
210 "-Wno-unused-parameter",
211 "-fno-emulated-tls",
212 ],
Martin Stjernholm2ad96b12020-04-23 16:48:50 +0100213 target: {
Colin Cross2671c942022-03-08 15:12:49 -0800214 bionic: {
Martin Stjernholm2ad96b12020-04-23 16:48:50 +0100215 header_libs: ["bionic_libc_platform_headers"],
Peter Collingbourne65006932019-11-26 20:02:40 -0800216 },
217 },
Christopher Ferrisdadba4c2019-11-21 14:34:40 -0800218 test_suites: ["general-tests"],
Peter Collingbourneaf40e252020-04-23 13:26:14 -0700219 bootstrap: true,
Peter Collingbourne1c182602019-11-19 16:07:42 -0800220}
Branden Archer6cc4d1c2020-10-16 12:47:29 -0700221
222cc_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}