blob: 200b6d637ce40a5337e0af5f8f6194b8c0828ee2 [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
25 clang_cflags: ["-Wno-inline-asm"],
26
27 // The latest clang (r230699) does not allow SP/PC to be declared in inline asm lists.
28 include_dirs: ["external/libunwind/include/tdep"],
29
30 // TODO: LLVM_DEVICE_BUILD_MK
31 // TODO: LLVM_HOST_BUILD_MK
32
33 target: {
34 host: {
35 // -fno-omit-frame-pointer should be set for host build. Because currently
36 // libunwind can't recognize .debug_frame using dwarf version 4, and it relies
37 // on stack frame pointer to do unwinding on x86.
38 // $(LLVM_HOST_BUILD_MK) overwrites -fno-omit-frame-pointer. so the below line
39 // must be after the include.
40 cflags: [
41 "-Wno-extern-c-compat",
42 "-fno-omit-frame-pointer",
43 ],
44 },
45
46 darwin: {
47 enabled: false,
48 },
49 },
50
51 multilib: {
52 lib32: {
53 suffix: "32",
54 },
55 lib64: {
56 suffix: "64",
57 },
58 }
59}
60
61libbacktrace_sources = [
62 "Backtrace.cpp",
63 "BacktraceCurrent.cpp",
64 "BacktracePtrace.cpp",
65 "thread_utils.c",
66 "ThreadEntry.cpp",
67 "UnwindCurrent.cpp",
68 "UnwindMap.cpp",
69 "UnwindPtrace.cpp",
70]
71
72cc_library {
73 name: "libbacktrace",
74 defaults: ["libbacktrace_common"],
75 host_supported: true,
76
77 srcs: [
78 "BacktraceMap.cpp",
79 ],
80
81 target: {
82 darwin: {
83 enabled: true,
84 },
85 linux: {
86 srcs: libbacktrace_sources,
87
88 shared_libs: [
89 "libbase",
90 "liblog",
91 "libunwind",
92 ],
93
94 static_libs: ["libcutils"],
Colin Cross53783b12016-10-20 10:39:51 -070095 host_ldlibs: ["-lrt"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070096 },
97 android: {
98 srcs: libbacktrace_sources,
99
100 shared_libs: [
101 "libbase",
102 "liblog",
103 "libunwind",
104 ],
105
106 static_libs: ["libcutils"],
107 },
108 },
109}
110
111cc_library_shared {
112 name: "libbacktrace_test",
113 defaults: ["libbacktrace_common"],
114 host_supported: true,
115 strip: {
116 none: true,
117 },
118 cflags: ["-O0"],
119 srcs: ["backtrace_testlib.c"],
Yabin Cui5d991bc2016-11-15 17:47:09 -0800120
121 target: {
122 linux: {
123 shared_libs: [
124 "libunwind",
125 ],
126 },
127 android: {
128 shared_libs: [
129 "libunwind",
130 ],
131 },
132 }
133}