blob: 9583768df1557b97629085910a427827bc597c38 [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,
20 recovery_available: true,
21 host_supported: true,
22 native_bridge_supported: true,
23
24 rtti: false,
25 stl: "none",
26
27 cflags: [
28 "-O3",
29 "-fno-rtti",
Christopher Ferris7435ef72019-09-25 17:43:02 -070030 // This option speeds up alloc/free code paths by about 5% to 7%.
31 "-fno-stack-protector",
Peter Collingbourne1c182602019-11-19 16:07:42 -080032 "-fno-emulated-tls",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070033
34 "-Wall",
35 "-Wextra",
36 "-Wunused",
37 "-Wno-unused-result",
38
39 "-Werror=pointer-to-int-cast",
40 "-Werror=int-to-pointer-cast",
41 "-Werror=type-limits",
42 "-Werror",
Christopher Ferrisdf4af6d2020-01-14 13:48:30 -080043
44 // Always force alignment to 16 bytes even on 32 bit.
45 // Android assumes that allocations of multiples of 16 bytes
46 // will be aligned to at least 16 bytes.
47 "-DSCUDO_MIN_ALIGNMENT_LOG=4",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070048 ],
49 cppflags: [
50 "-nostdinc++",
51 "-fno-exceptions",
52 ],
53
54 system_shared_libs: [],
55
56 srcs: [
57 "standalone/checksum.cpp",
58 "standalone/common.cpp",
59 "standalone/flags.cpp",
60 "standalone/flags_parser.cpp",
61 "standalone/linux.cpp",
62 "standalone/report.cpp",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070063 "standalone/string_utils.cpp",
64 "standalone/wrappers_c_bionic.cpp"
65 ],
66 arch: {
67 arm: {
68 cflags: ["-mcrc"],
69 srcs: ["standalone/crc32_hw.cpp"],
70 },
71 arm64: {
72 cflags: ["-mcrc"],
73 srcs: ["standalone/crc32_hw.cpp"],
74 },
75 x86_64: {
76 cflags: ["-msse4.2"],
77 srcs: ["standalone/crc32_hw.cpp"],
78 },
79 x86: {
80 cflags: ["-msse4.2"],
81 srcs: ["standalone/crc32_hw.cpp"],
82 },
83 },
84
85 target: {
86 linux_glibc: {
87 enabled: true,
88 },
89 },
90
Christopher Ferris3e5aef02019-09-25 20:15:25 -070091 header_libs: [
92 "bionic_libc_platform_headers",
Christopher Ferriscbfcc162019-09-24 12:28:10 -070093 ],
94}
Peter Collingbourne1c182602019-11-19 16:07:42 -080095
96cc_library_static {
97 name: "libscudo",
98 defaults: ["libscudo_defaults"],
99 cflags: ["-D_BIONIC=1"],
100}
101
102cc_library_static {
103 name: "libscudo_for_testing",
104 defaults: ["libscudo_defaults"],
105}
106
107cc_test {
108 name: "scudo_unit_tests",
Christopher Ferrisdadba4c2019-11-21 14:34:40 -0800109 host_supported: true,
Peter Collingbourne1c182602019-11-19 16:07:42 -0800110 srcs: [
111 "standalone/tests/atomic_test.cpp",
112 "standalone/tests/bytemap_test.cpp",
113 "standalone/tests/checksum_test.cpp",
114 "standalone/tests/chunk_test.cpp",
115 "standalone/tests/combined_test.cpp",
116 "standalone/tests/flags_test.cpp",
117 "standalone/tests/list_test.cpp",
118 "standalone/tests/map_test.cpp",
119 "standalone/tests/mutex_test.cpp",
120 "standalone/tests/primary_test.cpp",
121 "standalone/tests/quarantine_test.cpp",
122 "standalone/tests/release_test.cpp",
123 "standalone/tests/report_test.cpp",
124 "standalone/tests/scudo_unit_test_main.cpp",
125 "standalone/tests/secondary_test.cpp",
126 "standalone/tests/size_class_map_test.cpp",
127 "standalone/tests/stats_test.cpp",
128 "standalone/tests/strings_test.cpp",
129 "standalone/tests/tsd_test.cpp",
130 "standalone/tests/vector_test.cpp",
131 ],
132 static_libs: ["libscudo_for_testing"],
133 include_dirs: [
134 "external",
135 "external/scudo/standalone",
136 ],
137 cflags: [
138 "-Wno-unused-parameter",
139 "-fno-emulated-tls",
140 ],
Christopher Ferrisdadba4c2019-11-21 14:34:40 -0800141 test_suites: ["general-tests"],
Peter Collingbourne1c182602019-11-19 16:07:42 -0800142}