blob: c7969f24d9dda01fab9b18e88c2cb02ef32aa5ce [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 ],
Jooyung Hanbc62a192020-04-16 18:48:33 +090051 min_sdk_version: "apex_inherit",
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070052}
53
Martin Stjernholma2cc8932019-10-23 21:32:43 +010054cc_defaults {
55 name: "libbacktrace_defaults",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070056 defaults: ["libbacktrace_common"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070057
Josh Gaoe22701e2017-10-23 14:25:08 -070058 cflags: [
59 "-Wexit-time-destructors",
60 ],
61
Dan Willemsen2e1591b2016-07-12 17:20:18 -070062 srcs: [
63 "BacktraceMap.cpp",
64 ],
65
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070066 export_include_dirs: ["include"],
67
Dan Willemsen2e1591b2016-07-12 17:20:18 -070068 target: {
69 darwin: {
70 enabled: true,
Christopher Tate69831122018-02-16 14:52:26 -080071 shared_libs: [
Elliott Hughesdc699a22018-02-16 17:58:14 -080072 "libbase",
73 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070074 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -070075 linux: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070076 srcs: libbacktrace_sources,
77
78 shared_libs: [
79 "libbase",
80 "liblog",
Dan Willemsene0cd1e02017-03-15 15:23:36 -070081 ],
82
Yabin Cui3841acc2018-05-10 17:19:12 -070083 static_libs: [
Yabin Cui3841acc2018-05-10 17:19:12 -070084 "libprocinfo",
85 ],
Dan Willemsene0cd1e02017-03-15 15:23:36 -070086 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070087 android: {
Dan Willemsenbdddcab2017-10-03 14:17:31 -070088 static_libs: ["libasync_safe"],
Jiyong Parkcc26bbd2020-03-06 20:47:30 +090089 static: {
90 whole_static_libs: ["libasync_safe"],
91 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070092 },
Martin Stjernholma2cc8932019-10-23 21:32:43 +010093 },
94}
95
96cc_library {
97 name: "libbacktrace",
98 vendor_available: false,
Victor Khimenko7428c522020-06-18 22:01:13 +020099 // TODO(b/153609531): remove when no longer needed.
100 native_bridge_supported: true,
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100101 recovery_available: true,
102 apex_available: [
103 "//apex_available:platform",
104 "//apex_available:anyapex",
105 ],
106 vndk: {
107 enabled: true,
108 support_system_process: true,
109 },
110 host_supported: true,
111 defaults: ["libbacktrace_defaults"],
112
113 target: {
114 linux: {
115 shared_libs: [
116 "libunwindstack",
117 ],
118 },
Christopher Ferris0b06a592018-01-19 10:26:36 -0800119 vendor: {
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800120 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800121 },
Jiyong Parka0e75042018-05-24 14:11:00 +0900122 recovery: {
123 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900124 },
Victor Khimenko7428c522020-06-18 22:01:13 +0200125 native_bridge: {
126 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
127 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700128 },
129}
130
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100131// Static library without DEX support to avoid dependencies on the ART APEX.
132cc_library_static {
133 name: "libbacktrace_no_dex",
Dan Willemsened96fe12020-06-04 16:49:06 -0700134 visibility: [
135 "//system/core/debuggerd",
136 "//system/core/init",
137 ],
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100138 defaults: ["libbacktrace_defaults"],
139 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
140 target: {
141 linux: {
142 static_libs: [
143 "libunwindstack_no_dex",
144 ],
145 },
146 },
147}
148
Christopher Ferris50d81ac2018-06-29 16:05:35 -0700149cc_test_library {
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700150 name: "libbacktrace_test",
151 defaults: ["libbacktrace_common"],
152 host_supported: true,
153 strip: {
154 none: true,
155 },
156 cflags: ["-O0"],
Christopher Ferris5ea2c1f2017-03-23 14:55:01 -0700157 srcs: ["backtrace_testlib.cpp"],
Yabin Cui5d991bc2016-11-15 17:47:09 -0800158
Christopher Ferrisc8bec5a2017-12-11 17:44:33 -0800159 shared_libs: [
Elliott Hughesdc699a22018-02-16 17:58:14 -0800160 "libunwindstack",
Colin Crossda9bd592016-12-14 17:24:46 -0800161 ],
Christopher Ferris50d81ac2018-06-29 16:05:35 -0700162 relative_install_path: "backtrace_test_libs",
163
164 target: {
165 linux_glibc: {
Christopher Ferris50d81ac2018-06-29 16:05:35 -0700166 // This forces the creation of eh_frame with unwind information
167 // for host.
168 cflags: [
169 "-fcxx-exceptions"
170 ],
171 },
172 },
Colin Crossda9bd592016-12-14 17:24:46 -0800173}
174
175//-------------------------------------------------------------------------
176// The backtrace_test executable.
177//-------------------------------------------------------------------------
178cc_test {
179 name: "backtrace_test",
Christopher Ferris50d81ac2018-06-29 16:05:35 -0700180 isolated: true,
Colin Crossda9bd592016-12-14 17:24:46 -0800181 defaults: ["libbacktrace_common"],
182 host_supported: true,
183 srcs: [
Colin Crossda9bd592016-12-14 17:24:46 -0800184 "backtrace_test.cpp",
Colin Crossda9bd592016-12-14 17:24:46 -0800185 ],
186
187 cflags: [
188 "-fno-builtin",
189 "-O0",
190 "-g",
191 ],
192
193 shared_libs: [
Colin Crossda9bd592016-12-14 17:24:46 -0800194 "libbacktrace",
195 "libbase",
Colin Crossda9bd592016-12-14 17:24:46 -0800196 "liblog",
Christopher Ferris6f3981c2017-07-27 09:29:18 -0700197 "libunwindstack",
Colin Crossda9bd592016-12-14 17:24:46 -0800198 ],
199
200 group_static_libs: true,
201
Christopher Ferris50d81ac2018-06-29 16:05:35 -0700202 // So that the dlopen can find the libbacktrace_test.so.
203 ldflags: [
204 "-Wl,--rpath,${ORIGIN}/../backtrace_test_libs",
205 ],
Christopher Ferris458cc662017-08-28 16:31:18 -0700206
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700207 test_suites: ["device-tests"],
Christopher Ferris458cc662017-08-28 16:31:18 -0700208 data: [
209 "testdata/arm/*",
210 "testdata/arm64/*",
211 "testdata/x86/*",
212 "testdata/x86_64/*",
213 ],
Elliott Hughes03d183a2018-05-03 10:06:45 -0700214 required: [
215 "libbacktrace_test",
216 ],
Colin Crossda9bd592016-12-14 17:24:46 -0800217}
Christopher Ferris60521c72017-08-18 15:10:53 -0700218
219cc_benchmark {
220 name: "backtrace_benchmarks",
221 defaults: ["libbacktrace_common"],
222
223 srcs: [
224 "backtrace_benchmarks.cpp",
Christopher Ferrise3286732017-12-07 17:41:18 -0800225 "backtrace_read_benchmarks.cpp",
Christopher Ferris60521c72017-08-18 15:10:53 -0700226 ],
227
228 shared_libs: [
229 "libbacktrace",
230 "libbase",
Josh Gaob9670bb2017-10-25 15:12:24 -0700231 "libunwindstack",
Christopher Ferris60521c72017-08-18 15:10:53 -0700232 ],
233}