• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// 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
15// *** 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
42// Properties to apply to all static libraries that use elfutils.
43// Soong doesn't have propagation for static library dependencies,
44// and this have to be included explicitly by elfutils users.
45cc_defaults {
46    name: "elfutils_transitive_defaults",
47    static_libs: [
48        "libz",
49        "libzstd",
50    ],
51}
52
53cc_defaults {
54    name: "elfutils_defaults",
55    defaults: ["elfutils_transitive_defaults"],
56    cflags: [
57        "-DHAVE_CONFIG_H",
58        "-D_GNU_SOURCE",
59        // upper bound for the number of lines of the resulting mnemonic files
60        "-DNMNES=1000",
61        "-std=gnu99",
62        "-Werror",
63        // to suppress the "pointer of type ‘void *’ used in arithmetic" warning
64        "-Wno-pointer-arith",
65        "-Wno-typedef-redefinition",
66    ],
67    header_libs: [
68         "elfutils_headers",
69    ],
70    export_header_lib_headers: ["elfutils_headers"],
71
72    visibility: [
73        "//external/dwarves:__subpackages__",
74        "//external/elfutils:__subpackages__",
75        "//external/libabigail:__subpackages__",
76        "//external/libbpf:__subpackages__",
77        "//external/stg:__subpackages__",
78    ],
79}
80
81cc_library {
82    name: "libelf",
83    host_supported: true,
84    native_bridge_supported: true,
85    vendor_available: true,
86    defaults: ["elfutils_defaults"],
87
88    srcs:  ["libelf/*.c",],
89
90    export_include_dirs: ["libelf"],
91
92    target: {
93        darwin: {
94            enabled: false,
95        },
96        android: {
97            cflags: [
98                "-D_FILE_OFFSET_BITS=64",
99                "-include AndroidFixup.h",
100            ],
101            shared: {
102                enabled: false,
103            },
104        },
105        musl: {
106            cflags: [
107                "-include AndroidFixup.h",
108            ],
109        },
110    },
111
112    visibility: [
113        "//art:__subpackages__", // For use in tests only.
114        "//device/google/contexthub/util/nanoapp_postprocess",
115        "//external/bcc/libbpf-tools",
116        "//external/bpftool",
117        "//external/igt-gpu-tools",
118        "//external/mesa3d",
119    ],
120}
121
122cc_library_headers {
123    name: "elfutils_headers",
124    host_supported: true,
125    native_bridge_supported: true,
126    vendor_available: true,
127    export_include_dirs: [
128        ".",
129        "include",
130        "lib",
131    ],
132    target: {
133        android: {
134            export_include_dirs: ["bionic-fixup"],
135        },
136        musl: {
137            export_include_dirs: ["bionic-fixup"],
138        },
139    },
140    visibility: [":__subpackages__"],
141}
142
143cc_library_host_static {
144    name: "libdw",
145    defaults: ["elfutils_defaults"],
146    target: {
147        darwin: {
148            enabled: false,
149        },
150        musl: {
151            static_libs: [
152                "libfts",
153            ],
154        },
155    },
156    srcs: [
157        "backends/*.c",
158        "libcpu/*_disasm.c",
159        "libdw/*.c",
160        "libdwelf/*.c",
161        "libdwfl/*.c",
162        "libebl/*.c",
163    ],
164    generated_headers: [
165        "i386_dis",
166        "i386_mnemonics",
167        "x86_64_dis",
168        "x86_64_mnemonics",
169    ],
170    exclude_srcs: [
171        // Do not enabled compression support
172        "libdwfl/bzip2.c",
173        "libdwfl/lzma.c",
174        // Those headers are incompatible with clang due to nested function
175        // definitions.
176        "libdwfl/dwfl_segment_report_module.c",
177        "libdwfl/debuginfod-client.c",
178        "libdwfl/elf-from-memory.c",
179        "libdwfl/link_map.c",
180        // These depend on argp which doesn't exist in musl
181        "libdwfl/argp-std.c",
182        // Those are common source files actually used as headers and not
183        // compiled standalone.
184        "backends/common-reloc.c",
185        "backends/linux-core-note.c",
186        "backends/x86_corenote.c",
187    ],
188    local_include_dirs: [
189        "libcpu",
190        "libasm",
191        "libdwelf",
192        "libdwfl",
193        "libebl",
194    ],
195    export_include_dirs: [
196        "libdw",
197    ],
198    static_libs: [
199        "libelf"
200    ],
201    whole_static_libs: [
202        "libeu",
203    ],
204    compile_multilib: "64",
205}
206