blob: b9e94aa2dc7733e6f96e64830d1555d25add3028 [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
55 system_shared_libs: [],
56
57 srcs: [
58 "standalone/checksum.cpp",
59 "standalone/common.cpp",
60 "standalone/flags.cpp",
61 "standalone/flags_parser.cpp",
62 "standalone/linux.cpp",
Christopher Ferris4998f8c2020-02-18 10:51:54 -080063 "standalone/release.cpp",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070064 "standalone/report.cpp",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070065 "standalone/string_utils.cpp",
66 "standalone/wrappers_c_bionic.cpp"
67 ],
68 arch: {
69 arm: {
70 cflags: ["-mcrc"],
71 srcs: ["standalone/crc32_hw.cpp"],
72 },
73 arm64: {
74 cflags: ["-mcrc"],
75 srcs: ["standalone/crc32_hw.cpp"],
76 },
77 x86_64: {
78 cflags: ["-msse4.2"],
79 srcs: ["standalone/crc32_hw.cpp"],
80 },
81 x86: {
82 cflags: ["-msse4.2"],
83 srcs: ["standalone/crc32_hw.cpp"],
84 },
85 },
86
87 target: {
88 linux_glibc: {
89 enabled: true,
90 },
91 },
92
Christopher Ferris3e5aef02019-09-25 20:15:25 -070093 header_libs: [
94 "bionic_libc_platform_headers",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070095 ],
Peter Collingbourne65006932019-11-26 20:02:40 -080096 product_variables: {
97 experimental_mte: {
98 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
99 },
100 },
Christopher Ferriscbfcc162019-09-24 12:28:10 -0700101}
Peter Collingbourne1c182602019-11-19 16:07:42 -0800102
103cc_library_static {
104 name: "libscudo",
105 defaults: ["libscudo_defaults"],
106 cflags: ["-D_BIONIC=1"],
107}
108
109cc_library_static {
110 name: "libscudo_for_testing",
111 defaults: ["libscudo_defaults"],
112}
113
114cc_test {
115 name: "scudo_unit_tests",
Christopher Ferrisdadba4c2019-11-21 14:34:40 -0800116 host_supported: true,
Peter Collingbourne1c182602019-11-19 16:07:42 -0800117 srcs: [
118 "standalone/tests/atomic_test.cpp",
119 "standalone/tests/bytemap_test.cpp",
120 "standalone/tests/checksum_test.cpp",
121 "standalone/tests/chunk_test.cpp",
122 "standalone/tests/combined_test.cpp",
123 "standalone/tests/flags_test.cpp",
124 "standalone/tests/list_test.cpp",
125 "standalone/tests/map_test.cpp",
126 "standalone/tests/mutex_test.cpp",
127 "standalone/tests/primary_test.cpp",
128 "standalone/tests/quarantine_test.cpp",
129 "standalone/tests/release_test.cpp",
130 "standalone/tests/report_test.cpp",
131 "standalone/tests/scudo_unit_test_main.cpp",
132 "standalone/tests/secondary_test.cpp",
133 "standalone/tests/size_class_map_test.cpp",
134 "standalone/tests/stats_test.cpp",
135 "standalone/tests/strings_test.cpp",
136 "standalone/tests/tsd_test.cpp",
137 "standalone/tests/vector_test.cpp",
138 ],
139 static_libs: ["libscudo_for_testing"],
140 include_dirs: [
141 "external",
142 "external/scudo/standalone",
143 ],
144 cflags: [
145 "-Wno-unused-parameter",
146 "-fno-emulated-tls",
147 ],
Peter Collingbourne65006932019-11-26 20:02:40 -0800148 header_libs: [
149 "bionic_libc_platform_headers",
150 ],
151 product_variables: {
152 experimental_mte: {
153 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
154 },
155 },
Christopher Ferrisdadba4c2019-11-21 14:34:40 -0800156 test_suites: ["general-tests"],
Peter Collingbourne1c182602019-11-19 16:07:42 -0800157}