blob: dc989a0a8b114f4acf43d9cc5a8fc48f3cf63d27 [file] [log] [blame]
Dan Willemsen2e1591b2016-07-12 17:20:18 -07001//
2// Copyright (C) 2014 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
17cc_defaults {
18 name: "libbacktrace_common",
19
20 cflags: [
21 "-Wall",
22 "-Werror",
23 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070024
Dan Willemsen2e1591b2016-07-12 17:20:18 -070025 target: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070026 darwin: {
27 enabled: false,
28 },
29 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070030}
31
32libbacktrace_sources = [
33 "Backtrace.cpp",
34 "BacktraceCurrent.cpp",
35 "BacktracePtrace.cpp",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070036 "ThreadEntry.cpp",
Christopher Ferris6f3981c2017-07-27 09:29:18 -070037 "UnwindStack.cpp",
38 "UnwindStackMap.cpp",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070039]
40
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070041cc_library_headers {
42 name: "libbacktrace_headers",
Steven Moreland4ad9d512017-04-13 21:01:40 -070043 vendor_available: true,
Jiyong Park612210c2018-04-27 21:48:43 +090044 recovery_available: true,
dimitry49ab87b2019-05-16 14:07:43 +020045 native_bridge_supported: true,
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070046 export_include_dirs: ["include"],
Jiyong Park8bf9b162020-03-07 16:36:09 +090047 apex_available: [
48 "//apex_available:platform",
49 "//apex_available:anyapex",
50 ],
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070051}
52
Martin Stjernholma2cc8932019-10-23 21:32:43 +010053cc_defaults {
54 name: "libbacktrace_defaults",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070055 defaults: ["libbacktrace_common"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070056
Josh Gaoe22701e2017-10-23 14:25:08 -070057 cflags: [
58 "-Wexit-time-destructors",
59 ],
60
Dan Willemsen2e1591b2016-07-12 17:20:18 -070061 srcs: [
62 "BacktraceMap.cpp",
63 ],
64
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070065 export_include_dirs: ["include"],
66
Dan Willemsen2e1591b2016-07-12 17:20:18 -070067 target: {
68 darwin: {
69 enabled: true,
Christopher Tate69831122018-02-16 14:52:26 -080070 shared_libs: [
Elliott Hughesdc699a22018-02-16 17:58:14 -080071 "libbase",
72 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070073 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -070074 linux: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070075 srcs: libbacktrace_sources,
76
77 shared_libs: [
78 "libbase",
79 "liblog",
Dan Willemsene0cd1e02017-03-15 15:23:36 -070080 ],
81
Yabin Cui3841acc2018-05-10 17:19:12 -070082 static_libs: [
Yabin Cui3841acc2018-05-10 17:19:12 -070083 "libprocinfo",
84 ],
Dan Willemsene0cd1e02017-03-15 15:23:36 -070085 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070086 android: {
Dan Willemsenbdddcab2017-10-03 14:17:31 -070087 static_libs: ["libasync_safe"],
Jiyong Parkcc26bbd2020-03-06 20:47:30 +090088 static: {
89 whole_static_libs: ["libasync_safe"],
90 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070091 },
Martin Stjernholma2cc8932019-10-23 21:32:43 +010092 },
93}
94
95cc_library {
96 name: "libbacktrace",
97 vendor_available: false,
98 recovery_available: true,
99 apex_available: [
100 "//apex_available:platform",
101 "//apex_available:anyapex",
102 ],
103 vndk: {
104 enabled: true,
105 support_system_process: true,
106 },
107 host_supported: true,
108 defaults: ["libbacktrace_defaults"],
109
110 target: {
111 linux: {
112 shared_libs: [
113 "libunwindstack",
114 ],
115 },
Christopher Ferris0b06a592018-01-19 10:26:36 -0800116 vendor: {
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800117 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800118 },
Jiyong Parka0e75042018-05-24 14:11:00 +0900119 recovery: {
120 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900121 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700122 },
123}
124
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100125// Static library without DEX support to avoid dependencies on the ART APEX.
126cc_library_static {
127 name: "libbacktrace_no_dex",
128 visibility: ["//system/core/debuggerd"],
129 defaults: ["libbacktrace_defaults"],
130 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
131 target: {
132 linux: {
133 static_libs: [
134 "libunwindstack_no_dex",
135 ],
136 },
137 },
138}
139
Christopher Ferris50d81ac2018-06-29 16:05:35 -0700140cc_test_library {
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700141 name: "libbacktrace_test",
142 defaults: ["libbacktrace_common"],
143 host_supported: true,
144 strip: {
145 none: true,
146 },
147 cflags: ["-O0"],
Christopher Ferris5ea2c1f2017-03-23 14:55:01 -0700148 srcs: ["backtrace_testlib.cpp"],
Yabin Cui5d991bc2016-11-15 17:47:09 -0800149
Christopher Ferrisc8bec5a2017-12-11 17:44:33 -0800150 shared_libs: [
Elliott Hughesdc699a22018-02-16 17:58:14 -0800151 "libunwindstack",
Colin Crossda9bd592016-12-14 17:24:46 -0800152 ],
Christopher Ferris50d81ac2018-06-29 16:05:35 -0700153 relative_install_path: "backtrace_test_libs",
154
155 target: {
156 linux_glibc: {
Christopher Ferris50d81ac2018-06-29 16:05:35 -0700157 // This forces the creation of eh_frame with unwind information
158 // for host.
159 cflags: [
160 "-fcxx-exceptions"
161 ],
162 },
163 },
Colin Crossda9bd592016-12-14 17:24:46 -0800164}
165
166//-------------------------------------------------------------------------
167// The backtrace_test executable.
168//-------------------------------------------------------------------------
169cc_test {
170 name: "backtrace_test",
Christopher Ferris50d81ac2018-06-29 16:05:35 -0700171 isolated: true,
Colin Crossda9bd592016-12-14 17:24:46 -0800172 defaults: ["libbacktrace_common"],
173 host_supported: true,
174 srcs: [
Colin Crossda9bd592016-12-14 17:24:46 -0800175 "backtrace_test.cpp",
Colin Crossda9bd592016-12-14 17:24:46 -0800176 ],
177
178 cflags: [
179 "-fno-builtin",
180 "-O0",
181 "-g",
182 ],
183
184 shared_libs: [
Colin Crossda9bd592016-12-14 17:24:46 -0800185 "libbacktrace",
186 "libbase",
Colin Crossda9bd592016-12-14 17:24:46 -0800187 "liblog",
Christopher Ferris6f3981c2017-07-27 09:29:18 -0700188 "libunwindstack",
Colin Crossda9bd592016-12-14 17:24:46 -0800189 ],
190
191 group_static_libs: true,
192
Christopher Ferris50d81ac2018-06-29 16:05:35 -0700193 // So that the dlopen can find the libbacktrace_test.so.
194 ldflags: [
195 "-Wl,--rpath,${ORIGIN}/../backtrace_test_libs",
196 ],
Christopher Ferris458cc662017-08-28 16:31:18 -0700197
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700198 test_suites: ["device-tests"],
Christopher Ferris458cc662017-08-28 16:31:18 -0700199 data: [
200 "testdata/arm/*",
201 "testdata/arm64/*",
202 "testdata/x86/*",
203 "testdata/x86_64/*",
204 ],
Elliott Hughes03d183a2018-05-03 10:06:45 -0700205 required: [
206 "libbacktrace_test",
207 ],
Colin Crossda9bd592016-12-14 17:24:46 -0800208}
Christopher Ferris60521c72017-08-18 15:10:53 -0700209
210cc_benchmark {
211 name: "backtrace_benchmarks",
212 defaults: ["libbacktrace_common"],
213
214 srcs: [
215 "backtrace_benchmarks.cpp",
Christopher Ferrise3286732017-12-07 17:41:18 -0800216 "backtrace_read_benchmarks.cpp",
Christopher Ferris60521c72017-08-18 15:10:53 -0700217 ],
218
219 shared_libs: [
220 "libbacktrace",
221 "libbase",
Josh Gaob9670bb2017-10-25 15:12:24 -0700222 "libunwindstack",
Christopher Ferris60521c72017-08-18 15:10:53 -0700223 ],
224}