| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 1 | // | 
|  | 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 |  | 
|  | 17 | cc_defaults { | 
|  | 18 | name: "libbacktrace_common", | 
|  | 19 |  | 
|  | 20 | cflags: [ | 
|  | 21 | "-Wall", | 
|  | 22 | "-Werror", | 
|  | 23 | ], | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 24 |  | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 25 | target: { | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 26 | darwin: { | 
|  | 27 | enabled: false, | 
|  | 28 | }, | 
|  | 29 | }, | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 30 | } | 
|  | 31 |  | 
|  | 32 | libbacktrace_sources = [ | 
|  | 33 | "Backtrace.cpp", | 
|  | 34 | "BacktraceCurrent.cpp", | 
|  | 35 | "BacktracePtrace.cpp", | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 36 | "ThreadEntry.cpp", | 
| Christopher Ferris | 6f3981c | 2017-07-27 09:29:18 -0700 | [diff] [blame] | 37 | "UnwindStack.cpp", | 
|  | 38 | "UnwindStackMap.cpp", | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 39 | ] | 
|  | 40 |  | 
| Vijay Venkatraman | 8f2c28d | 2017-04-11 11:22:43 -0700 | [diff] [blame] | 41 | cc_library_headers { | 
|  | 42 | name: "libbacktrace_headers", | 
| Steven Moreland | 4ad9d51 | 2017-04-13 21:01:40 -0700 | [diff] [blame] | 43 | vendor_available: true, | 
| Jiyong Park | 612210c | 2018-04-27 21:48:43 +0900 | [diff] [blame] | 44 | recovery_available: true, | 
| dimitry | 49ab87b | 2019-05-16 14:07:43 +0200 | [diff] [blame] | 45 | native_bridge_supported: true, | 
| Vijay Venkatraman | 8f2c28d | 2017-04-11 11:22:43 -0700 | [diff] [blame] | 46 | export_include_dirs: ["include"], | 
| Jiyong Park | 8bf9b16 | 2020-03-07 16:36:09 +0900 | [diff] [blame] | 47 | apex_available: [ | 
|  | 48 | "//apex_available:platform", | 
|  | 49 | "//apex_available:anyapex", | 
|  | 50 | ], | 
| Jooyung Han | bc62a19 | 2020-04-16 18:48:33 +0900 | [diff] [blame] | 51 | min_sdk_version: "apex_inherit", | 
| Vijay Venkatraman | 8f2c28d | 2017-04-11 11:22:43 -0700 | [diff] [blame] | 52 | } | 
|  | 53 |  | 
| Martin Stjernholm | a2cc893 | 2019-10-23 21:32:43 +0100 | [diff] [blame] | 54 | cc_defaults { | 
|  | 55 | name: "libbacktrace_defaults", | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 56 | defaults: ["libbacktrace_common"], | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 57 |  | 
| Josh Gao | e22701e | 2017-10-23 14:25:08 -0700 | [diff] [blame] | 58 | cflags: [ | 
|  | 59 | "-Wexit-time-destructors", | 
|  | 60 | ], | 
|  | 61 |  | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 62 | srcs: [ | 
|  | 63 | "BacktraceMap.cpp", | 
|  | 64 | ], | 
|  | 65 |  | 
| Vijay Venkatraman | 8f2c28d | 2017-04-11 11:22:43 -0700 | [diff] [blame] | 66 | export_include_dirs: ["include"], | 
|  | 67 |  | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 68 | target: { | 
|  | 69 | darwin: { | 
|  | 70 | enabled: true, | 
| Christopher Tate | 6983112 | 2018-02-16 14:52:26 -0800 | [diff] [blame] | 71 | shared_libs: [ | 
| Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 72 | "libbase", | 
|  | 73 | ], | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 74 | }, | 
| Dan Willemsen | bdddcab | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 75 | linux: { | 
| Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 76 | srcs: libbacktrace_sources, | 
|  | 77 |  | 
|  | 78 | shared_libs: [ | 
|  | 79 | "libbase", | 
|  | 80 | "liblog", | 
| Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 81 | ], | 
|  | 82 |  | 
| Yabin Cui | 3841acc | 2018-05-10 17:19:12 -0700 | [diff] [blame] | 83 | static_libs: [ | 
| Yabin Cui | 3841acc | 2018-05-10 17:19:12 -0700 | [diff] [blame] | 84 | "libprocinfo", | 
|  | 85 | ], | 
| Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 86 | }, | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 87 | android: { | 
| Dan Willemsen | bdddcab | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 88 | static_libs: ["libasync_safe"], | 
| Jiyong Park | cc26bbd | 2020-03-06 20:47:30 +0900 | [diff] [blame] | 89 | static: { | 
|  | 90 | whole_static_libs: ["libasync_safe"], | 
|  | 91 | }, | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 92 | }, | 
| Martin Stjernholm | a2cc893 | 2019-10-23 21:32:43 +0100 | [diff] [blame] | 93 | }, | 
|  | 94 | } | 
|  | 95 |  | 
|  | 96 | cc_library { | 
|  | 97 | name: "libbacktrace", | 
|  | 98 | vendor_available: false, | 
|  | 99 | recovery_available: true, | 
|  | 100 | apex_available: [ | 
|  | 101 | "//apex_available:platform", | 
|  | 102 | "//apex_available:anyapex", | 
|  | 103 | ], | 
|  | 104 | vndk: { | 
|  | 105 | enabled: true, | 
|  | 106 | support_system_process: true, | 
|  | 107 | }, | 
|  | 108 | host_supported: true, | 
|  | 109 | defaults: ["libbacktrace_defaults"], | 
|  | 110 |  | 
|  | 111 | target: { | 
|  | 112 | linux: { | 
|  | 113 | shared_libs: [ | 
|  | 114 | "libunwindstack", | 
|  | 115 | ], | 
|  | 116 | }, | 
| Christopher Ferris | 0b06a59 | 2018-01-19 10:26:36 -0800 | [diff] [blame] | 117 | vendor: { | 
| Christopher Ferris | d70ea5e | 2018-01-30 19:47:24 -0800 | [diff] [blame] | 118 | cflags: ["-DNO_LIBDEXFILE_SUPPORT"], | 
| Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 119 | }, | 
| Jiyong Park | a0e7504 | 2018-05-24 14:11:00 +0900 | [diff] [blame] | 120 | recovery: { | 
|  | 121 | cflags: ["-DNO_LIBDEXFILE_SUPPORT"], | 
| Jiyong Park | a0e7504 | 2018-05-24 14:11:00 +0900 | [diff] [blame] | 122 | }, | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 123 | }, | 
|  | 124 | } | 
|  | 125 |  | 
| Martin Stjernholm | a2cc893 | 2019-10-23 21:32:43 +0100 | [diff] [blame] | 126 | // Static library without DEX support to avoid dependencies on the ART APEX. | 
|  | 127 | cc_library_static { | 
|  | 128 | name: "libbacktrace_no_dex", | 
|  | 129 | visibility: ["//system/core/debuggerd"], | 
|  | 130 | defaults: ["libbacktrace_defaults"], | 
|  | 131 | cflags: ["-DNO_LIBDEXFILE_SUPPORT"], | 
|  | 132 | target: { | 
|  | 133 | linux: { | 
|  | 134 | static_libs: [ | 
|  | 135 | "libunwindstack_no_dex", | 
|  | 136 | ], | 
|  | 137 | }, | 
|  | 138 | }, | 
|  | 139 | } | 
|  | 140 |  | 
| Christopher Ferris | 50d81ac | 2018-06-29 16:05:35 -0700 | [diff] [blame] | 141 | cc_test_library { | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 142 | name: "libbacktrace_test", | 
|  | 143 | defaults: ["libbacktrace_common"], | 
|  | 144 | host_supported: true, | 
|  | 145 | strip: { | 
|  | 146 | none: true, | 
|  | 147 | }, | 
|  | 148 | cflags: ["-O0"], | 
| Christopher Ferris | 5ea2c1f | 2017-03-23 14:55:01 -0700 | [diff] [blame] | 149 | srcs: ["backtrace_testlib.cpp"], | 
| Yabin Cui | 5d991bc | 2016-11-15 17:47:09 -0800 | [diff] [blame] | 150 |  | 
| Christopher Ferris | c8bec5a | 2017-12-11 17:44:33 -0800 | [diff] [blame] | 151 | shared_libs: [ | 
| Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 152 | "libunwindstack", | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 153 | ], | 
| Christopher Ferris | 50d81ac | 2018-06-29 16:05:35 -0700 | [diff] [blame] | 154 | relative_install_path: "backtrace_test_libs", | 
|  | 155 |  | 
|  | 156 | target: { | 
|  | 157 | linux_glibc: { | 
| Christopher Ferris | 50d81ac | 2018-06-29 16:05:35 -0700 | [diff] [blame] | 158 | // This forces the creation of eh_frame with unwind information | 
|  | 159 | // for host. | 
|  | 160 | cflags: [ | 
|  | 161 | "-fcxx-exceptions" | 
|  | 162 | ], | 
|  | 163 | }, | 
|  | 164 | }, | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 165 | } | 
|  | 166 |  | 
|  | 167 | //------------------------------------------------------------------------- | 
|  | 168 | // The backtrace_test executable. | 
|  | 169 | //------------------------------------------------------------------------- | 
|  | 170 | cc_test { | 
|  | 171 | name: "backtrace_test", | 
| Christopher Ferris | 50d81ac | 2018-06-29 16:05:35 -0700 | [diff] [blame] | 172 | isolated: true, | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 173 | defaults: ["libbacktrace_common"], | 
|  | 174 | host_supported: true, | 
|  | 175 | srcs: [ | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 176 | "backtrace_test.cpp", | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 177 | ], | 
|  | 178 |  | 
|  | 179 | cflags: [ | 
|  | 180 | "-fno-builtin", | 
|  | 181 | "-O0", | 
|  | 182 | "-g", | 
|  | 183 | ], | 
|  | 184 |  | 
|  | 185 | shared_libs: [ | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 186 | "libbacktrace", | 
|  | 187 | "libbase", | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 188 | "liblog", | 
| Christopher Ferris | 6f3981c | 2017-07-27 09:29:18 -0700 | [diff] [blame] | 189 | "libunwindstack", | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 190 | ], | 
|  | 191 |  | 
|  | 192 | group_static_libs: true, | 
|  | 193 |  | 
| Christopher Ferris | 50d81ac | 2018-06-29 16:05:35 -0700 | [diff] [blame] | 194 | // So that the dlopen can find the libbacktrace_test.so. | 
|  | 195 | ldflags: [ | 
|  | 196 | "-Wl,--rpath,${ORIGIN}/../backtrace_test_libs", | 
|  | 197 | ], | 
| Christopher Ferris | 458cc66 | 2017-08-28 16:31:18 -0700 | [diff] [blame] | 198 |  | 
| Elliott Hughes | 40fdf3f | 2018-04-27 16:12:06 -0700 | [diff] [blame] | 199 | test_suites: ["device-tests"], | 
| Christopher Ferris | 458cc66 | 2017-08-28 16:31:18 -0700 | [diff] [blame] | 200 | data: [ | 
|  | 201 | "testdata/arm/*", | 
|  | 202 | "testdata/arm64/*", | 
|  | 203 | "testdata/x86/*", | 
|  | 204 | "testdata/x86_64/*", | 
|  | 205 | ], | 
| Elliott Hughes | 03d183a | 2018-05-03 10:06:45 -0700 | [diff] [blame] | 206 | required: [ | 
|  | 207 | "libbacktrace_test", | 
|  | 208 | ], | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 209 | } | 
| Christopher Ferris | 60521c7 | 2017-08-18 15:10:53 -0700 | [diff] [blame] | 210 |  | 
|  | 211 | cc_benchmark { | 
|  | 212 | name: "backtrace_benchmarks", | 
|  | 213 | defaults: ["libbacktrace_common"], | 
|  | 214 |  | 
|  | 215 | srcs: [ | 
|  | 216 | "backtrace_benchmarks.cpp", | 
| Christopher Ferris | e328673 | 2017-12-07 17:41:18 -0800 | [diff] [blame] | 217 | "backtrace_read_benchmarks.cpp", | 
| Christopher Ferris | 60521c7 | 2017-08-18 15:10:53 -0700 | [diff] [blame] | 218 | ], | 
|  | 219 |  | 
|  | 220 | shared_libs: [ | 
|  | 221 | "libbacktrace", | 
|  | 222 | "libbase", | 
| Josh Gao | b9670bb | 2017-10-25 15:12:24 -0700 | [diff] [blame] | 223 | "libunwindstack", | 
| Christopher Ferris | 60521c7 | 2017-08-18 15:10:53 -0700 | [diff] [blame] | 224 | ], | 
|  | 225 | } |