blob: 7f9a18a3dce0ee3b1a48ad962d53bda15f44bc68 [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,
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070045 export_include_dirs: ["include"],
46}
47
Dan Willemsen2e1591b2016-07-12 17:20:18 -070048cc_library {
49 name: "libbacktrace",
Jiyong Parkb7d92c42017-08-23 13:25:21 +090050 vendor_available: false,
Jiyong Parka0e75042018-05-24 14:11:00 +090051 recovery_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090052 vndk: {
53 enabled: true,
54 support_system_process: true,
55 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070056 defaults: ["libbacktrace_common"],
57 host_supported: true,
58
Josh Gaoe22701e2017-10-23 14:25:08 -070059 cflags: [
60 "-Wexit-time-destructors",
61 ],
62
Dan Willemsen2e1591b2016-07-12 17:20:18 -070063 srcs: [
64 "BacktraceMap.cpp",
65 ],
66
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070067 export_include_dirs: ["include"],
68
Dan Willemsen2e1591b2016-07-12 17:20:18 -070069 target: {
70 darwin: {
71 enabled: true,
Christopher Tate69831122018-02-16 14:52:26 -080072 shared_libs: [
Elliott Hughesdc699a22018-02-16 17:58:14 -080073 "libbase",
74 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070075 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -070076 linux: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070077 srcs: libbacktrace_sources,
78
79 shared_libs: [
80 "libbase",
81 "liblog",
Christopher Ferris6f3981c2017-07-27 09:29:18 -070082 "libunwindstack",
Dan Willemsene0cd1e02017-03-15 15:23:36 -070083 ],
84
Yabin Cui3841acc2018-05-10 17:19:12 -070085 static_libs: [
Yabin Cui3841acc2018-05-10 17:19:12 -070086 "libprocinfo",
87 ],
Dan Willemsene0cd1e02017-03-15 15:23:36 -070088 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070089 android: {
Dan Willemsenbdddcab2017-10-03 14:17:31 -070090 static_libs: ["libasync_safe"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070091 },
Christopher Ferris0b06a592018-01-19 10:26:36 -080092 vendor: {
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -080093 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
Elliott Hughesdc699a22018-02-16 17:58:14 -080094 },
Jiyong Parka0e75042018-05-24 14:11:00 +090095 recovery: {
96 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
Jiyong Parka0e75042018-05-24 14:11:00 +090097 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070098 },
Christopher Ferris7d0aea92017-06-01 14:15:09 -070099 whole_static_libs: ["libdemangle"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700100}
101
Christopher Ferris50d81ac2018-06-29 16:05:35 -0700102cc_test_library {
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700103 name: "libbacktrace_test",
104 defaults: ["libbacktrace_common"],
105 host_supported: true,
106 strip: {
107 none: true,
108 },
109 cflags: ["-O0"],
Christopher Ferris5ea2c1f2017-03-23 14:55:01 -0700110 srcs: ["backtrace_testlib.cpp"],
Yabin Cui5d991bc2016-11-15 17:47:09 -0800111
Christopher Ferrisc8bec5a2017-12-11 17:44:33 -0800112 shared_libs: [
Elliott Hughesdc699a22018-02-16 17:58:14 -0800113 "libunwindstack",
Colin Crossda9bd592016-12-14 17:24:46 -0800114 ],
Christopher Ferris50d81ac2018-06-29 16:05:35 -0700115 relative_install_path: "backtrace_test_libs",
116
117 target: {
118 linux_glibc: {
Christopher Ferris50d81ac2018-06-29 16:05:35 -0700119 // This forces the creation of eh_frame with unwind information
120 // for host.
121 cflags: [
122 "-fcxx-exceptions"
123 ],
124 },
125 },
Colin Crossda9bd592016-12-14 17:24:46 -0800126}
127
128//-------------------------------------------------------------------------
129// The backtrace_test executable.
130//-------------------------------------------------------------------------
131cc_test {
132 name: "backtrace_test",
Christopher Ferris50d81ac2018-06-29 16:05:35 -0700133 isolated: true,
Colin Crossda9bd592016-12-14 17:24:46 -0800134 defaults: ["libbacktrace_common"],
135 host_supported: true,
136 srcs: [
137 "backtrace_offline_test.cpp",
138 "backtrace_test.cpp",
Colin Crossda9bd592016-12-14 17:24:46 -0800139 ],
140
141 cflags: [
142 "-fno-builtin",
143 "-O0",
144 "-g",
145 ],
146
147 shared_libs: [
Colin Crossda9bd592016-12-14 17:24:46 -0800148 "libbacktrace",
149 "libbase",
Colin Crossda9bd592016-12-14 17:24:46 -0800150 "liblog",
Christopher Ferris6f3981c2017-07-27 09:29:18 -0700151 "libunwindstack",
Colin Crossda9bd592016-12-14 17:24:46 -0800152 ],
153
154 group_static_libs: true,
155
Christopher Ferris50d81ac2018-06-29 16:05:35 -0700156 // So that the dlopen can find the libbacktrace_test.so.
157 ldflags: [
158 "-Wl,--rpath,${ORIGIN}/../backtrace_test_libs",
159 ],
Christopher Ferris458cc662017-08-28 16:31:18 -0700160
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700161 test_suites: ["device-tests"],
Christopher Ferris458cc662017-08-28 16:31:18 -0700162 data: [
163 "testdata/arm/*",
164 "testdata/arm64/*",
165 "testdata/x86/*",
166 "testdata/x86_64/*",
167 ],
Elliott Hughes03d183a2018-05-03 10:06:45 -0700168 required: [
169 "libbacktrace_test",
170 ],
Colin Crossda9bd592016-12-14 17:24:46 -0800171}
Christopher Ferris60521c72017-08-18 15:10:53 -0700172
173cc_benchmark {
174 name: "backtrace_benchmarks",
175 defaults: ["libbacktrace_common"],
176
177 srcs: [
178 "backtrace_benchmarks.cpp",
Christopher Ferrise3286732017-12-07 17:41:18 -0800179 "backtrace_read_benchmarks.cpp",
Christopher Ferris60521c72017-08-18 15:10:53 -0700180 ],
181
182 shared_libs: [
183 "libbacktrace",
184 "libbase",
Josh Gaob9670bb2017-10-25 15:12:24 -0700185 "libunwindstack",
Christopher Ferris60521c72017-08-18 15:10:53 -0700186 ],
187}