blob: 2ca70cc9a3f1478e4746e30cd56afd11f2187c3b [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 Maennicha55c49f2020-06-23 11:05:49 +020065 ],
Matthias Maennichf2679892020-07-14 09:41:44 +020066}
67
68cc_library {
69 name: "libelf",
70 host_supported: true,
71 vendor_available: true,
72 defaults: ["elfutils_defaults"],
73
74 srcs: ["libelf/*.c",],
75
76 static_libs: ["libz"],
77
78 export_include_dirs: ["libelf"],
79
80 target: {
81 darwin: {
82 enabled: false,
83 },
84 android: {
85 cflags: [
86 "-D_FILE_OFFSET_BITS=64",
87 "-include AndroidFixup.h",
88 ],
89 shared: {
90 enabled: false,
91 },
92 },
93 },
94
95 visibility: [
96 "//device/google/contexthub/util/nanoapp_postprocess",
97 "//external/igt-gpu-tools",
98 "//external/mesa3d",
99 ],
100}
101
Alistair Strachan4f03eb52019-05-21 15:40:17 -0700102cc_library_headers {
103 name: "elfutils_headers",
Colin Cross25c1a402016-07-13 14:00:38 -0700104 host_supported: true,
Logan Chienffab4d12018-03-08 15:50:02 +0800105 vendor_available: true,
Colin Cross25c1a402016-07-13 14:00:38 -0700106 export_include_dirs: [
107 ".",
Alistair Strachan4f03eb52019-05-21 15:40:17 -0700108 "include",
Colin Cross25c1a402016-07-13 14:00:38 -0700109 "lib",
110 ],
111 target: {
112 android: {
113 export_include_dirs: ["bionic-fixup"],
114 },
115 },
Elliott Hugheseb552b62019-05-02 14:35:41 -0700116 visibility: [":__subpackages__"],
Colin Cross25c1a402016-07-13 14:00:38 -0700117}
118
Matthias Maennicha55c49f2020-06-23 11:05:49 +0200119cc_library_host_static {
120 name: "libdw",
121 defaults: ["elfutils_defaults"],
Ivan Lozano9ae40052020-09-22 09:04:49 -0400122 target: {
123 darwin: {
124 enabled: false,
125 },
126 },
Matthias Maennicha55c49f2020-06-23 11:05:49 +0200127 srcs: [
128 "backends/*.c",
129 "libcpu/*_disasm.c",
130 "libdw/*.c",
131 "libdwelf/*.c",
132 "libdwfl/*.c",
133 "libebl/*.c",
134 ],
135 generated_headers: [
136 "i386_dis",
137 "i386_mnemonics",
138 "x86_64_dis",
139 "x86_64_mnemonics",
140 ],
141 exclude_srcs: [
142 // Do not enabled compression support
143 "libdwfl/bzip2.c",
144 "libdwfl/lzma.c",
Haibo Huangc233cc12020-11-02 18:44:18 -0800145 "libdwfl/zstd.c",
Matthias Maennicha55c49f2020-06-23 11:05:49 +0200146 // Those headers are incompatible with clang due to nested function
147 // definitions.
148 "libdwfl/dwfl_segment_report_module.c",
Matthias Maennichfde31c02021-02-16 21:02:29 +0000149 "libdwfl/debuginfod-client.c",
Matthias Maennicha55c49f2020-06-23 11:05:49 +0200150 "libdwfl/elf-from-memory.c",
151 "libdwfl/link_map.c",
152 // Those are common source files actually used as headers and not
153 // compiled standalone.
154 "backends/common-reloc.c",
155 "backends/linux-core-note.c",
156 "backends/x86_corenote.c",
157 ],
158 local_include_dirs: [
159 "libcpu",
160 "libasm",
161 "libdwelf",
162 "libdwfl",
163 "libebl",
164 ],
165 export_include_dirs: [
166 "libdw",
167 ],
168 static_libs: [
169 "libelf"
170 ],
171 compile_multilib: "64",
172}