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