blob: 9d73c192d563953667aa9abaa27ee06a914336e9 [file] [log] [blame]
Matthias Maennichf2679892020-07-14 09:41:44 +02001// Copyright (C) 2013 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Bob Badourceeee152021-02-03 17:32:49 -080015// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS. PLEASE
16// CONSULT THE OWNERS AND opensource-licensing@google.com BEFORE
17// DEPENDING ON IT IN YOUR PROJECT. ***
18package {
19 default_applicable_licenses: ["external_elfutils_license"],
20}
21
22// http://go/android-license-faq
23license {
24 name: "external_elfutils_license",
25 visibility: [":__subpackages__"],
26 license_kinds: [
27 "SPDX-license-identifier-Apache-2.0",
28 "SPDX-license-identifier-BSD",
29 "SPDX-license-identifier-GFDL", // by exception only
30 "SPDX-license-identifier-GPL-2.0-or-later",
31 "SPDX-license-identifier-GPL-3.0-or-later",
32 "SPDX-license-identifier-LGPL-3.0-or-later",
33 ],
34 license_text: [
35 "COPYING",
36 "COPYING-GPLV2",
37 "COPYING-LGPLV3",
38 "NOTICE",
39 ],
40}
41
Matthias Maennichf2679892020-07-14 09:41:44 +020042cc_defaults {
43 name: "elfutils_defaults",
44 cflags: [
45 "-DHAVE_CONFIG_H",
46 "-D_GNU_SOURCE",
Matthias Maennicha55c49f2020-06-23 11:05:49 +020047 // upper bound for the number of lines of the resulting mnemonic files
48 "-DNMNES=1000",
Matthias Maennichf2679892020-07-14 09:41:44 +020049 "-std=gnu99",
50 "-Werror",
51 // to suppress the "pointer of type ‘void *’ used in arithmetic" warning
52 "-Wno-pointer-arith",
53 "-Wno-typedef-redefinition",
54 ],
55 header_libs: [
56 "elfutils_headers",
57 ],
58 export_header_lib_headers: ["elfutils_headers"],
Matthias Maennicha55c49f2020-06-23 11:05:49 +020059
60 visibility: [
61 "//external/dwarves:__subpackages__",
62 "//external/elfutils:__subpackages__",
Matthias Maennich2b852172020-07-11 23:07:18 +020063 "//external/libabigail:__subpackages__",
Matthias Maennich2ba34122021-01-18 14:43:56 +000064 "//external/libbpf:__subpackages__",
Matthias Maennich4bbc33d2021-11-16 11:23:02 +000065 "//external/stg:__subpackages__",
Matthias Maennicha55c49f2020-06-23 11:05:49 +020066 ],
Matthias Maennichf2679892020-07-14 09:41:44 +020067}
68
69cc_library {
70 name: "libelf",
71 host_supported: true,
72 vendor_available: true,
73 defaults: ["elfutils_defaults"],
74
75 srcs: ["libelf/*.c",],
76
77 static_libs: ["libz"],
78
79 export_include_dirs: ["libelf"],
80
81 target: {
82 darwin: {
83 enabled: false,
84 },
85 android: {
86 cflags: [
87 "-D_FILE_OFFSET_BITS=64",
88 "-include AndroidFixup.h",
89 ],
90 shared: {
91 enabled: false,
92 },
93 },
Colin Cross78268d72021-08-30 16:51:29 -070094 musl: {
95 cflags: [
96 "-include AndroidFixup.h",
97 ],
98 },
Matthias Maennichf2679892020-07-14 09:41:44 +020099 },
100
101 visibility: [
102 "//device/google/contexthub/util/nanoapp_postprocess",
Connor O'Brien6b137d32022-02-01 12:45:13 -0800103 "//external/bcc/libbpf-tools",
Connor O'Briene0bcd742022-02-14 17:44:37 -0800104 "//external/bpftool",
Matthias Maennichf2679892020-07-14 09:41:44 +0200105 "//external/igt-gpu-tools",
106 "//external/mesa3d",
107 ],
108}
109
Alistair Strachan4f03eb52019-05-21 15:40:17 -0700110cc_library_headers {
111 name: "elfutils_headers",
Colin Cross25c1a402016-07-13 14:00:38 -0700112 host_supported: true,
Logan Chienffab4d12018-03-08 15:50:02 +0800113 vendor_available: true,
Colin Cross25c1a402016-07-13 14:00:38 -0700114 export_include_dirs: [
115 ".",
Alistair Strachan4f03eb52019-05-21 15:40:17 -0700116 "include",
Colin Cross25c1a402016-07-13 14:00:38 -0700117 "lib",
118 ],
119 target: {
120 android: {
121 export_include_dirs: ["bionic-fixup"],
122 },
Colin Cross78268d72021-08-30 16:51:29 -0700123 musl: {
124 export_include_dirs: ["bionic-fixup"],
125 },
Colin Cross25c1a402016-07-13 14:00:38 -0700126 },
Elliott Hugheseb552b62019-05-02 14:35:41 -0700127 visibility: [":__subpackages__"],
Colin Cross25c1a402016-07-13 14:00:38 -0700128}
129
Matthias Maennicha55c49f2020-06-23 11:05:49 +0200130cc_library_host_static {
131 name: "libdw",
132 defaults: ["elfutils_defaults"],
Ivan Lozano9ae40052020-09-22 09:04:49 -0400133 target: {
134 darwin: {
135 enabled: false,
136 },
Colin Cross78268d72021-08-30 16:51:29 -0700137 musl: {
138 static_libs: [
139 "libfts",
140 "libz",
141 ],
142 },
Ivan Lozano9ae40052020-09-22 09:04:49 -0400143 },
Matthias Maennicha55c49f2020-06-23 11:05:49 +0200144 srcs: [
145 "backends/*.c",
146 "libcpu/*_disasm.c",
147 "libdw/*.c",
148 "libdwelf/*.c",
149 "libdwfl/*.c",
150 "libebl/*.c",
151 ],
152 generated_headers: [
153 "i386_dis",
154 "i386_mnemonics",
155 "x86_64_dis",
156 "x86_64_mnemonics",
157 ],
158 exclude_srcs: [
159 // Do not enabled compression support
160 "libdwfl/bzip2.c",
161 "libdwfl/lzma.c",
Haibo Huangc233cc12020-11-02 18:44:18 -0800162 "libdwfl/zstd.c",
Matthias Maennicha55c49f2020-06-23 11:05:49 +0200163 // Those headers are incompatible with clang due to nested function
164 // definitions.
165 "libdwfl/dwfl_segment_report_module.c",
Matthias Maennichfde31c02021-02-16 21:02:29 +0000166 "libdwfl/debuginfod-client.c",
Matthias Maennicha55c49f2020-06-23 11:05:49 +0200167 "libdwfl/elf-from-memory.c",
168 "libdwfl/link_map.c",
Colin Cross78268d72021-08-30 16:51:29 -0700169 // These depend on argp which doesn't exist in musl
170 "libdwfl/argp-std.c",
Matthias Maennicha55c49f2020-06-23 11:05:49 +0200171 // Those are common source files actually used as headers and not
172 // compiled standalone.
173 "backends/common-reloc.c",
174 "backends/linux-core-note.c",
175 "backends/x86_corenote.c",
176 ],
177 local_include_dirs: [
178 "libcpu",
179 "libasm",
180 "libdwelf",
181 "libdwfl",
182 "libebl",
183 ],
184 export_include_dirs: [
185 "libdw",
186 ],
187 static_libs: [
188 "libelf"
189 ],
Colin Cross78268d72021-08-30 16:51:29 -0700190 whole_static_libs: [
191 "libeu",
192 ],
Matthias Maennicha55c49f2020-06-23 11:05:49 +0200193 compile_multilib: "64",
194}