aboutsummaryrefslogtreecommitdiff
path: root/Android.bp
blob: 573255aa8914ed1659f138a9704d83af41e27460 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
// Copyright (C) 2013 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS.  PLEASE
//     CONSULT THE OWNERS AND opensource-licensing@google.com BEFORE
//     DEPENDING ON IT IN YOUR PROJECT. ***
package {
    default_applicable_licenses: ["external_elfutils_license"],
}

// http://go/android-license-faq
license {
    name: "external_elfutils_license",
    visibility: [":__subpackages__"],
    license_kinds: [
        "SPDX-license-identifier-Apache-2.0",
        "SPDX-license-identifier-BSD",
        "SPDX-license-identifier-GFDL", // by exception only
        "SPDX-license-identifier-GPL-2.0-or-later",
        "SPDX-license-identifier-GPL-3.0-or-later",
        "SPDX-license-identifier-LGPL-3.0-or-later",
    ],
    license_text: [
        "COPYING",
        "COPYING-GPLV2",
        "COPYING-LGPLV3",
        "NOTICE",
    ],
}

// Properties to apply to all static libraries that use elfutils.
// Soong doesn't have propagation for static library dependencies,
// and this have to be included explicitly by elfutils users.
cc_defaults {
    name: "elfutils_transitive_defaults",
    static_libs: [
        "libz",
        "libzstd",
    ],
}

cc_defaults {
    name: "elfutils_defaults",
    defaults: ["elfutils_transitive_defaults"],
    cflags: [
        "-DHAVE_CONFIG_H",
        "-D_GNU_SOURCE",
        // upper bound for the number of lines of the resulting mnemonic files
        "-DNMNES=1000",
        "-std=gnu99",
        "-Werror",
        // to suppress the "pointer of type ‘void *’ used in arithmetic" warning
        "-Wno-pointer-arith",
        "-Wno-typedef-redefinition",
    ],
    header_libs: [
         "elfutils_headers",
    ],
    export_header_lib_headers: ["elfutils_headers"],

    visibility: [
        "//external/dwarves:__subpackages__",
        "//external/elfutils:__subpackages__",
        "//external/libabigail:__subpackages__",
        "//external/libbpf:__subpackages__",
        "//external/stg:__subpackages__",
    ],
}

cc_library {
    name: "libelf",
    host_supported: true,
    native_bridge_supported: true,
    vendor_available: true,
    defaults: ["elfutils_defaults"],

    srcs:  ["libelf/*.c",],

    export_include_dirs: ["libelf"],

    target: {
        darwin: {
            enabled: false,
        },
        android: {
            cflags: [
                "-D_FILE_OFFSET_BITS=64",
                "-include AndroidFixup.h",
            ],
            shared: {
                enabled: false,
            },
        },
        musl: {
            cflags: [
                "-include AndroidFixup.h",
            ],
        },
    },

    visibility: [
        "//art:__subpackages__", // For use in tests only.
        "//device/google/contexthub/util/nanoapp_postprocess",
        "//external/bcc/libbpf-tools",
        "//external/bpftool",
        "//external/igt-gpu-tools",
        "//external/mesa3d",
    ],
}

cc_library_headers {
    name: "elfutils_headers",
    host_supported: true,
    native_bridge_supported: true,
    vendor_available: true,
    export_include_dirs: [
        ".",
        "include",
        "lib",
    ],
    target: {
        android: {
            export_include_dirs: ["bionic-fixup"],
        },
        musl: {
            export_include_dirs: ["bionic-fixup"],
        },
    },
    visibility: [":__subpackages__"],
}

cc_library_host_static {
    name: "libdw",
    defaults: ["elfutils_defaults"],
    target: {
        darwin: {
            enabled: false,
        },
        musl: {
            static_libs: [
                "libfts",
            ],
        },
    },
    srcs: [
        "backends/*.c",
        "libcpu/*_disasm.c",
        "libdw/*.c",
        "libdwelf/*.c",
        "libdwfl/*.c",
        "libebl/*.c",
    ],
    generated_headers: [
        "i386_dis",
        "i386_mnemonics",
        "x86_64_dis",
        "x86_64_mnemonics",
    ],
    exclude_srcs: [
        // Do not enabled compression support
        "libdwfl/bzip2.c",
        "libdwfl/lzma.c",
        // Those headers are incompatible with clang due to nested function
        // definitions.
        "libdwfl/dwfl_segment_report_module.c",
        "libdwfl/debuginfod-client.c",
        "libdwfl/elf-from-memory.c",
        "libdwfl/link_map.c",
        // These depend on argp which doesn't exist in musl
        "libdwfl/argp-std.c",
        // Those are common source files actually used as headers and not
        // compiled standalone.
        "backends/common-reloc.c",
        "backends/linux-core-note.c",
        "backends/x86_corenote.c",
    ],
    local_include_dirs: [
        "libcpu",
        "libasm",
        "libdwelf",
        "libdwfl",
        "libebl",
    ],
    export_include_dirs: [
        "libdw",
    ],
    static_libs: [
        "libelf"
    ],
    whole_static_libs: [
        "libeu",
    ],
    compile_multilib: "64",
}