blob: 55d73b1b49414055a21ba28f07b0acd2e686cc36 [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
Peter Collingbourne1c182602019-11-19 16:07:42 -080017cc_defaults {
18 name: "libscudo_defaults",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070019 native_coverage: false,
Yifan Hongdc883f12020-01-21 17:12:16 -080020 ramdisk_available: true,
Christopher Ferriscbfcc162019-09-24 12:28:10 -070021 recovery_available: true,
22 host_supported: true,
23 native_bridge_supported: true,
24
25 rtti: false,
26 stl: "none",
27
28 cflags: [
29 "-O3",
30 "-fno-rtti",
Christopher Ferris7435ef72019-09-25 17:43:02 -070031 // This option speeds up alloc/free code paths by about 5% to 7%.
32 "-fno-stack-protector",
Peter Collingbourne1c182602019-11-19 16:07:42 -080033 "-fno-emulated-tls",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070034
35 "-Wall",
36 "-Wextra",
37 "-Wunused",
38 "-Wno-unused-result",
39
40 "-Werror=pointer-to-int-cast",
41 "-Werror=int-to-pointer-cast",
42 "-Werror=type-limits",
43 "-Werror",
Christopher Ferrisdf4af6d2020-01-14 13:48:30 -080044
45 // Always force alignment to 16 bytes even on 32 bit.
46 // Android assumes that allocations of multiples of 16 bytes
47 // will be aligned to at least 16 bytes.
48 "-DSCUDO_MIN_ALIGNMENT_LOG=4",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070049 ],
50 cppflags: [
51 "-nostdinc++",
52 "-fno-exceptions",
53 ],
54
Dynamic Tools Team26615592020-03-23 16:08:18 -070055 include_dirs: [
56 "external/scudo/standalone/include",
57 ],
58
Christopher Ferriscbfcc162019-09-24 12:28:10 -070059 system_shared_libs: [],
60
61 srcs: [
62 "standalone/checksum.cpp",
63 "standalone/common.cpp",
64 "standalone/flags.cpp",
65 "standalone/flags_parser.cpp",
66 "standalone/linux.cpp",
Christopher Ferris4998f8c2020-02-18 10:51:54 -080067 "standalone/release.cpp",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070068 "standalone/report.cpp",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070069 "standalone/string_utils.cpp",
70 "standalone/wrappers_c_bionic.cpp"
71 ],
72 arch: {
73 arm: {
74 cflags: ["-mcrc"],
75 srcs: ["standalone/crc32_hw.cpp"],
76 },
77 arm64: {
78 cflags: ["-mcrc"],
79 srcs: ["standalone/crc32_hw.cpp"],
80 },
81 x86_64: {
82 cflags: ["-msse4.2"],
83 srcs: ["standalone/crc32_hw.cpp"],
84 },
85 x86: {
86 cflags: ["-msse4.2"],
87 srcs: ["standalone/crc32_hw.cpp"],
88 },
89 },
90
91 target: {
92 linux_glibc: {
93 enabled: true,
94 },
95 },
96
Christopher Ferris3e5aef02019-09-25 20:15:25 -070097 header_libs: [
98 "bionic_libc_platform_headers",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070099 ],
Peter Collingbourne65006932019-11-26 20:02:40 -0800100 product_variables: {
101 experimental_mte: {
102 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
103 },
104 },
Christopher Ferriscbfcc162019-09-24 12:28:10 -0700105}
Peter Collingbourne1c182602019-11-19 16:07:42 -0800106
107cc_library_static {
108 name: "libscudo",
109 defaults: ["libscudo_defaults"],
110 cflags: ["-D_BIONIC=1"],
111}
112
113cc_library_static {
114 name: "libscudo_for_testing",
115 defaults: ["libscudo_defaults"],
116}
117
118cc_test {
119 name: "scudo_unit_tests",
Christopher Ferrisdadba4c2019-11-21 14:34:40 -0800120 host_supported: true,
Peter Collingbourne1c182602019-11-19 16:07:42 -0800121 srcs: [
122 "standalone/tests/atomic_test.cpp",
123 "standalone/tests/bytemap_test.cpp",
124 "standalone/tests/checksum_test.cpp",
125 "standalone/tests/chunk_test.cpp",
126 "standalone/tests/combined_test.cpp",
127 "standalone/tests/flags_test.cpp",
128 "standalone/tests/list_test.cpp",
129 "standalone/tests/map_test.cpp",
130 "standalone/tests/mutex_test.cpp",
131 "standalone/tests/primary_test.cpp",
132 "standalone/tests/quarantine_test.cpp",
133 "standalone/tests/release_test.cpp",
134 "standalone/tests/report_test.cpp",
135 "standalone/tests/scudo_unit_test_main.cpp",
136 "standalone/tests/secondary_test.cpp",
137 "standalone/tests/size_class_map_test.cpp",
138 "standalone/tests/stats_test.cpp",
139 "standalone/tests/strings_test.cpp",
140 "standalone/tests/tsd_test.cpp",
141 "standalone/tests/vector_test.cpp",
142 ],
143 static_libs: ["libscudo_for_testing"],
144 include_dirs: [
Peter Collingbourne1c182602019-11-19 16:07:42 -0800145 "external/scudo/standalone",
Dynamic Tools Team26615592020-03-23 16:08:18 -0700146 "external/scudo/standalone/include",
Peter Collingbourne1c182602019-11-19 16:07:42 -0800147 ],
148 cflags: [
149 "-Wno-unused-parameter",
150 "-fno-emulated-tls",
151 ],
Peter Collingbourne65006932019-11-26 20:02:40 -0800152 header_libs: [
153 "bionic_libc_platform_headers",
154 ],
155 product_variables: {
156 experimental_mte: {
157 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
158 },
159 },
Christopher Ferrisdadba4c2019-11-21 14:34:40 -0800160 test_suites: ["general-tests"],
Peter Collingbourneaf40e252020-04-23 13:26:14 -0700161 bootstrap: true,
Peter Collingbourne1c182602019-11-19 16:07:42 -0800162}