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 42cc_defaults { 43 name: "elfutils_defaults", 44 cflags: [ 45 "-DHAVE_CONFIG_H", 46 "-D_GNU_SOURCE", 47 // upper bound for the number of lines of the resulting mnemonic files 48 "-DNMNES=1000", 49 "-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"], 59 60 visibility: [ 61 "//external/dwarves:__subpackages__", 62 "//external/elfutils:__subpackages__", 63 "//external/libabigail:__subpackages__", 64 "//external/libbpf:__subpackages__", 65 "//external/stg:__subpackages__", 66 ], 67} 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 }, 94 musl: { 95 cflags: [ 96 "-include AndroidFixup.h", 97 ], 98 }, 99 }, 100 101 visibility: [ 102 "//device/google/contexthub/util/nanoapp_postprocess", 103 "//external/bcc/libbpf-tools", 104 "//external/bpftool", 105 "//external/igt-gpu-tools", 106 "//external/mesa3d", 107 ], 108} 109 110cc_library_headers { 111 name: "elfutils_headers", 112 host_supported: true, 113 vendor_available: true, 114 export_include_dirs: [ 115 ".", 116 "include", 117 "lib", 118 ], 119 target: { 120 android: { 121 export_include_dirs: ["bionic-fixup"], 122 }, 123 musl: { 124 export_include_dirs: ["bionic-fixup"], 125 }, 126 }, 127 visibility: [":__subpackages__"], 128} 129 130cc_library_host_static { 131 name: "libdw", 132 defaults: ["elfutils_defaults"], 133 target: { 134 darwin: { 135 enabled: false, 136 }, 137 musl: { 138 static_libs: [ 139 "libfts", 140 "libz", 141 ], 142 }, 143 }, 144 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", 162 "libdwfl/zstd.c", 163 // Those headers are incompatible with clang due to nested function 164 // definitions. 165 "libdwfl/dwfl_segment_report_module.c", 166 "libdwfl/debuginfod-client.c", 167 "libdwfl/elf-from-memory.c", 168 "libdwfl/link_map.c", 169 // These depend on argp which doesn't exist in musl 170 "libdwfl/argp-std.c", 171 // 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 ], 190 whole_static_libs: [ 191 "libeu", 192 ], 193 compile_multilib: "64", 194} 195