blob: ac97ad5392f89230e5eab7c7fe66beb28ef22dc5 [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 },
138 },
Martin Stjernholm62c0de72020-04-09 00:14:02 +0100139
140 header_libs: ["libc_headers"],
Christopher Ferriscbfcc162019-09-24 12:28:10 -0700141}
Peter Collingbourne1c182602019-11-19 16:07:42 -0800142
143cc_library_static {
144 name: "libscudo",
145 defaults: ["libscudo_defaults"],
Peter Collingbournefcef1282020-09-09 14:37:03 -0700146 cflags: [
147 "-D_BIONIC=1",
148 "-DSCUDO_HAS_PLATFORM_TLS_SLOT",
149 ],
Elliott Hughes260aa992020-09-18 14:54:47 -0700150 visibility: [
151 "//bionic:__subpackages__",
Victor Khimenko01471992020-11-05 17:18:02 +0100152 "//frameworks/libs/native_bridge_support/libc:__subpackages__",
Elliott Hughes260aa992020-09-18 14:54:47 -0700153 "//system/core/debuggerd:__subpackages__",
154 ],
Peter Collingbourne1c182602019-11-19 16:07:42 -0800155}
156
157cc_library_static {
158 name: "libscudo_for_testing",
159 defaults: ["libscudo_defaults"],
160}
161
162cc_test {
163 name: "scudo_unit_tests",
Peter Collingbourne4b57c902021-02-23 14:48:10 -0800164 // Temporarily disabled on host due to a 15-20s per-test timeout,
165 // which is currently exceeded by ScudoCombinedTest.BasicCombined.
166 host_supported: false,
Peter Collingbourne1c182602019-11-19 16:07:42 -0800167 srcs: [
168 "standalone/tests/atomic_test.cpp",
169 "standalone/tests/bytemap_test.cpp",
170 "standalone/tests/checksum_test.cpp",
171 "standalone/tests/chunk_test.cpp",
172 "standalone/tests/combined_test.cpp",
173 "standalone/tests/flags_test.cpp",
174 "standalone/tests/list_test.cpp",
175 "standalone/tests/map_test.cpp",
176 "standalone/tests/mutex_test.cpp",
177 "standalone/tests/primary_test.cpp",
178 "standalone/tests/quarantine_test.cpp",
179 "standalone/tests/release_test.cpp",
180 "standalone/tests/report_test.cpp",
181 "standalone/tests/scudo_unit_test_main.cpp",
182 "standalone/tests/secondary_test.cpp",
183 "standalone/tests/size_class_map_test.cpp",
184 "standalone/tests/stats_test.cpp",
185 "standalone/tests/strings_test.cpp",
186 "standalone/tests/tsd_test.cpp",
187 "standalone/tests/vector_test.cpp",
188 ],
189 static_libs: ["libscudo_for_testing"],
190 include_dirs: [
Peter Collingbourne1c182602019-11-19 16:07:42 -0800191 "external/scudo/standalone",
Dynamic Tools Team26615592020-03-23 16:08:18 -0700192 "external/scudo/standalone/include",
Peter Collingbourne1c182602019-11-19 16:07:42 -0800193 ],
194 cflags: [
195 "-Wno-unused-parameter",
196 "-fno-emulated-tls",
197 ],
Martin Stjernholm2ad96b12020-04-23 16:48:50 +0100198 target: {
199 android: {
200 header_libs: ["bionic_libc_platform_headers"],
Martin Stjernholm2ad96b12020-04-23 16:48:50 +0100201 },
202 linux_bionic: {
203 header_libs: ["bionic_libc_platform_headers"],
Peter Collingbourne65006932019-11-26 20:02:40 -0800204 },
205 },
Christopher Ferrisdadba4c2019-11-21 14:34:40 -0800206 test_suites: ["general-tests"],
Peter Collingbourneaf40e252020-04-23 13:26:14 -0700207 bootstrap: true,
Peter Collingbourne1c182602019-11-19 16:07:42 -0800208}
Branden Archer6cc4d1c2020-10-16 12:47:29 -0700209
210cc_fuzz {
211 name: "scudo_get_error_info_fuzzer",
212 host_supported: true,
213 compile_multilib: "64",
214 static_libs: ["libscudo"],
215 include_dirs: [
216 "external/scudo/standalone",
217 "external/scudo/standalone/include",
218 ],
219 cflags: [
220 "-Wno-unneeded-internal-declaration",
221 ],
222 srcs: ["standalone/fuzz/get_error_info_fuzzer.cpp"],
223 fuzz_config: {
224 componentid: 87896
225 },
226}