Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2017 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: "libunwindstack_flags", |
| 19 | |
| 20 | host_supported: true, |
| 21 | |
| 22 | cflags: [ |
| 23 | "-Wall", |
| 24 | "-Werror", |
| 25 | "-Wextra", |
| 26 | ], |
Christopher Ferris | 01d5037 | 2017-01-30 13:45:16 -0800 | [diff] [blame] | 27 | |
| 28 | target: { |
| 29 | darwin: { |
| 30 | enabled: false, |
| 31 | }, |
| 32 | }, |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 33 | |
| 34 | multilib: { |
| 35 | lib32: { |
| 36 | suffix: "32", |
| 37 | }, |
| 38 | lib64: { |
| 39 | suffix: "64", |
| 40 | }, |
| 41 | }, |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | cc_defaults { |
| 45 | name: "libunwindstack_common", |
| 46 | defaults: ["libunwindstack_flags"], |
| 47 | |
| 48 | srcs: [ |
| 49 | "ArmExidx.cpp", |
Christopher Ferris | 8642fcb | 2017-04-24 11:14:39 -0700 | [diff] [blame] | 50 | "DwarfCfa.cpp", |
Christopher Ferris | 61d4097 | 2017-06-12 19:14:20 -0700 | [diff] [blame] | 51 | "DwarfDebugFrame.cpp", |
| 52 | "DwarfEhFrame.cpp", |
Christopher Ferris | 72a6fa6 | 2017-03-21 12:41:17 -0700 | [diff] [blame] | 53 | "DwarfMemory.cpp", |
Christopher Ferris | 55d22ef | 2017-04-04 10:41:31 -0700 | [diff] [blame] | 54 | "DwarfOp.cpp", |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 55 | "DwarfSection.cpp", |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 56 | "Elf.cpp", |
| 57 | "ElfInterface.cpp", |
| 58 | "ElfInterfaceArm.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 59 | "Log.cpp", |
Christopher Ferris | 0d7cf3e | 2017-04-19 15:42:19 -0700 | [diff] [blame] | 60 | "MapInfo.cpp", |
Christopher Ferris | 09385e7 | 2017-04-05 13:25:04 -0700 | [diff] [blame] | 61 | "Maps.cpp", |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 62 | "Memory.cpp", |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 63 | "Regs.cpp", |
Christopher Ferris | e7ba4cc | 2017-04-04 14:06:58 -0700 | [diff] [blame] | 64 | "Symbols.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 65 | ], |
| 66 | |
Christopher Ferris | 2a25c4a | 2017-07-07 16:35:48 -0700 | [diff] [blame^] | 67 | arch: { |
| 68 | x86: { |
| 69 | srcs: ["AsmGetRegsX86.S"], |
| 70 | }, |
| 71 | x86_64: { |
| 72 | srcs: ["AsmGetRegsX86_64.S"], |
| 73 | }, |
| 74 | }, |
| 75 | |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 76 | shared_libs: [ |
| 77 | "libbase", |
| 78 | "liblog", |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 79 | "liblzma", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 80 | ], |
| 81 | } |
| 82 | |
| 83 | cc_library { |
| 84 | name: "libunwindstack", |
| 85 | defaults: ["libunwindstack_common"], |
| 86 | } |
| 87 | |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 88 | //------------------------------------------------------------------------- |
| 89 | // Unit Tests |
| 90 | //------------------------------------------------------------------------- |
| 91 | cc_defaults { |
| 92 | name: "libunwindstack_test_common", |
| 93 | defaults: ["libunwindstack_flags"], |
| 94 | |
| 95 | srcs: [ |
| 96 | "tests/ArmExidxDecodeTest.cpp", |
| 97 | "tests/ArmExidxExtractTest.cpp", |
Christopher Ferris | 8642fcb | 2017-04-24 11:14:39 -0700 | [diff] [blame] | 98 | "tests/DwarfCfaLogTest.cpp", |
| 99 | "tests/DwarfCfaTest.cpp", |
Christopher Ferris | 61d4097 | 2017-06-12 19:14:20 -0700 | [diff] [blame] | 100 | "tests/DwarfDebugFrameTest.cpp", |
| 101 | "tests/DwarfEhFrameTest.cpp", |
Christopher Ferris | 72a6fa6 | 2017-03-21 12:41:17 -0700 | [diff] [blame] | 102 | "tests/DwarfMemoryTest.cpp", |
Christopher Ferris | 55d22ef | 2017-04-04 10:41:31 -0700 | [diff] [blame] | 103 | "tests/DwarfOpLogTest.cpp", |
| 104 | "tests/DwarfOpTest.cpp", |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 105 | "tests/DwarfSectionTest.cpp", |
| 106 | "tests/DwarfSectionImplTest.cpp", |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 107 | "tests/ElfInterfaceArmTest.cpp", |
| 108 | "tests/ElfInterfaceTest.cpp", |
| 109 | "tests/ElfTest.cpp", |
Christopher Ferris | 570b76f | 2017-06-30 17:18:16 -0700 | [diff] [blame] | 110 | "tests/ElfTestUtils.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 111 | "tests/LogFake.cpp", |
Christopher Ferris | 570b76f | 2017-06-30 17:18:16 -0700 | [diff] [blame] | 112 | "tests/MapInfoCreateMemoryTest.cpp", |
| 113 | "tests/MapInfoGetElfTest.cpp", |
Christopher Ferris | 09385e7 | 2017-04-05 13:25:04 -0700 | [diff] [blame] | 114 | "tests/MapsTest.cpp", |
Christopher Ferris | 9744fb2 | 2017-07-07 12:18:16 -0700 | [diff] [blame] | 115 | "tests/MemoryBuffer.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 116 | "tests/MemoryFake.cpp", |
| 117 | "tests/MemoryFileTest.cpp", |
| 118 | "tests/MemoryLocalTest.cpp", |
| 119 | "tests/MemoryRangeTest.cpp", |
| 120 | "tests/MemoryRemoteTest.cpp", |
Christopher Ferris | 9744fb2 | 2017-07-07 12:18:16 -0700 | [diff] [blame] | 121 | "tests/MemoryTest.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 122 | "tests/RegsTest.cpp", |
Christopher Ferris | e7ba4cc | 2017-04-04 14:06:58 -0700 | [diff] [blame] | 123 | "tests/SymbolsTest.cpp", |
Christopher Ferris | 2a25c4a | 2017-07-07 16:35:48 -0700 | [diff] [blame^] | 124 | "tests/UnwindTest.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 125 | ], |
| 126 | |
| 127 | cflags: [ |
| 128 | "-O0", |
| 129 | "-g", |
| 130 | ], |
| 131 | |
| 132 | shared_libs: [ |
| 133 | "libbase", |
| 134 | "liblog", |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 135 | "liblzma", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 136 | ], |
| 137 | |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 138 | static_libs: [ |
| 139 | "libgmock", |
| 140 | ], |
| 141 | |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 142 | target: { |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 143 | linux: { |
| 144 | host_ldlibs: [ |
| 145 | "-lrt", |
| 146 | ], |
| 147 | }, |
| 148 | }, |
| 149 | } |
| 150 | |
| 151 | // These unit tests run against the shared library. |
| 152 | cc_test { |
| 153 | name: "libunwindstack_test", |
| 154 | defaults: ["libunwindstack_test_common"], |
| 155 | |
| 156 | shared_libs: [ |
| 157 | "libunwindstack", |
| 158 | ], |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 159 | |
| 160 | data: [ |
Christopher Ferris | 570b76f | 2017-06-30 17:18:16 -0700 | [diff] [blame] | 161 | "tests/files/elf32.xz", |
| 162 | "tests/files/elf64.xz", |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 163 | ], |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 164 | } |
| 165 | |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 166 | //------------------------------------------------------------------------- |
| 167 | // Utility Executables |
| 168 | //------------------------------------------------------------------------- |
| 169 | cc_defaults { |
| 170 | name: "libunwindstack_executables", |
| 171 | defaults: ["libunwindstack_flags"], |
| 172 | |
| 173 | shared_libs: [ |
| 174 | "libunwindstack", |
| 175 | "libbase", |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 176 | "liblzma", |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 177 | ], |
| 178 | |
| 179 | static_libs: [ |
| 180 | "liblog", |
| 181 | ], |
| 182 | |
| 183 | compile_multilib: "both", |
| 184 | } |
| 185 | |
| 186 | cc_binary { |
| 187 | name: "unwind_info", |
| 188 | defaults: ["libunwindstack_executables"], |
| 189 | |
| 190 | srcs: [ |
| 191 | "unwind_info.cpp", |
| 192 | ], |
| 193 | } |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 194 | |
| 195 | // Generates the elf data for use in the tests for .gnu_debugdata frames. |
| 196 | // Once these files are generated, use the xz command to compress the data. |
| 197 | cc_binary_host { |
| 198 | name: "gen_gnudebugdata", |
| 199 | |
| 200 | cflags: [ |
| 201 | "-Wall", |
| 202 | "-Werror", |
| 203 | "-Wextra", |
| 204 | ], |
| 205 | |
| 206 | srcs: [ |
| 207 | "tests/GenGnuDebugdata.cpp", |
| 208 | ], |
Christopher Ferris | bfd6292 | 2017-06-28 20:44:48 -0700 | [diff] [blame] | 209 | |
| 210 | target: { |
| 211 | darwin: { |
| 212 | enabled: false, |
| 213 | }, |
| 214 | }, |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 215 | } |