blob: 60cadc912633eb3d97e8fd28c3bc9aa50b6e207b [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
Peter Collingbourne1c182602019-11-19 16:07:42 -080049cc_defaults {
50 name: "libscudo_defaults",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070051 native_coverage: false,
Yifan Hongdc883f12020-01-21 17:12:16 -080052 ramdisk_available: true,
Yifan Hongad0cccd2020-10-21 18:43:34 -070053 vendor_ramdisk_available: true,
Christopher Ferriscbfcc162019-09-24 12:28:10 -070054 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 Ferris7435ef72019-09-25 17:43:02 -070064 // This option speeds up alloc/free code paths by about 5% to 7%.
65 "-fno-stack-protector",
Peter Collingbourne1c182602019-11-19 16:07:42 -080066 "-fno-emulated-tls",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070067
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 Ferrisdf4af6d2020-01-14 13:48:30 -080077
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 Collingbournedf9219e2020-04-23 13:29:34 -070082
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 Ferriscbfcc162019-09-24 12:28:10 -070086 ],
87 cppflags: [
88 "-nostdinc++",
89 "-fno-exceptions",
90 ],
91
Dynamic Tools Team26615592020-03-23 16:08:18 -070092 include_dirs: [
93 "external/scudo/standalone/include",
94 ],
95
Christopher Ferriscbfcc162019-09-24 12:28:10 -070096 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 Ferris4998f8c2020-02-18 10:51:54 -0800104 "standalone/release.cpp",
Christopher Ferriscbfcc162019-09-24 12:28:10 -0700105 "standalone/report.cpp",
Christopher Ferriscbfcc162019-09-24 12:28:10 -0700106 "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 Stjernholm2ad96b12020-04-23 16:48:50 +0100132 android: {
133 header_libs: ["bionic_libc_platform_headers"],
Martin Stjernholm2ad96b12020-04-23 16:48:50 +0100134 },
135 linux_bionic: {
136 header_libs: ["bionic_libc_platform_headers"],
Peter Collingbourne65006932019-11-26 20:02:40 -0800137 },
Peter Collingbourned9c91642021-03-16 12:05:04 -0700138 native_bridge: {
139 cflags: ["-DSCUDO_DISABLE_TBI"],
140 },
Peter Collingbourne65006932019-11-26 20:02:40 -0800141 },
Martin Stjernholm62c0de72020-04-09 00:14:02 +0100142
143 header_libs: ["libc_headers"],
Christopher Ferriscbfcc162019-09-24 12:28:10 -0700144}
Peter Collingbourne1c182602019-11-19 16:07:42 -0800145
146cc_library_static {
147 name: "libscudo",
148 defaults: ["libscudo_defaults"],
Peter Collingbournefcef1282020-09-09 14:37:03 -0700149 cflags: [
150 "-D_BIONIC=1",
151 "-DSCUDO_HAS_PLATFORM_TLS_SLOT",
152 ],
Elliott Hughes260aa992020-09-18 14:54:47 -0700153 visibility: [
154 "//bionic:__subpackages__",
Victor Khimenko01471992020-11-05 17:18:02 +0100155 "//frameworks/libs/native_bridge_support/libc:__subpackages__",
Elliott Hughes260aa992020-09-18 14:54:47 -0700156 "//system/core/debuggerd:__subpackages__",
157 ],
Peter Collingbourne1c182602019-11-19 16:07:42 -0800158}
159
160cc_library_static {
161 name: "libscudo_for_testing",
162 defaults: ["libscudo_defaults"],
163}
164
165cc_test {
166 name: "scudo_unit_tests",
Peter Collingbourne4b57c902021-02-23 14:48:10 -0800167 // 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 Collingbourne1c182602019-11-19 16:07:42 -0800170 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 Collingbourne1c182602019-11-19 16:07:42 -0800194 "external/scudo/standalone",
Dynamic Tools Team26615592020-03-23 16:08:18 -0700195 "external/scudo/standalone/include",
Peter Collingbourne1c182602019-11-19 16:07:42 -0800196 ],
197 cflags: [
198 "-Wno-unused-parameter",
199 "-fno-emulated-tls",
200 ],
Martin Stjernholm2ad96b12020-04-23 16:48:50 +0100201 target: {
202 android: {
203 header_libs: ["bionic_libc_platform_headers"],
Martin Stjernholm2ad96b12020-04-23 16:48:50 +0100204 },
205 linux_bionic: {
206 header_libs: ["bionic_libc_platform_headers"],
Peter Collingbourne65006932019-11-26 20:02:40 -0800207 },
208 },
Christopher Ferrisdadba4c2019-11-21 14:34:40 -0800209 test_suites: ["general-tests"],
Peter Collingbourneaf40e252020-04-23 13:26:14 -0700210 bootstrap: true,
Peter Collingbourne1c182602019-11-19 16:07:42 -0800211}
Branden Archer6cc4d1c2020-10-16 12:47:29 -0700212
213cc_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}