Connor O'Brien | d8c2e9a | 2022-02-14 17:49:38 -0800 | [diff] [blame] | 1 | |
Bob Badour | 2db6b95 | 2022-04-07 21:04:51 -0700 | [diff] [blame] | 2 | package { |
| 3 | default_applicable_licenses: ["external_bpftool_license"], |
| 4 | } |
| 5 | |
| 6 | // See: http://go/android-license-faq |
| 7 | license { |
| 8 | name: "external_bpftool_license", |
| 9 | visibility: [":__subpackages__"], |
| 10 | license_kinds: [ |
| 11 | "SPDX-license-identifier-BSD-2-Clause", |
| 12 | "SPDX-license-identifier-GPL-2.0-only", |
| 13 | ], |
| 14 | license_text: [ |
| 15 | "LICENSE.BSD-2-Clause", |
| 16 | "LICENSE.GPL-2.0", |
| 17 | ], |
| 18 | } |
| 19 | |
Connor O'Brien | d8c2e9a | 2022-02-14 17:49:38 -0800 | [diff] [blame] | 20 | cc_binary_host { |
| 21 | name: "bpftool", |
| 22 | srcs: [ |
| 23 | "src/*.c", |
| 24 | "src/kernel/bpf/disasm.c", |
| 25 | ], |
| 26 | exclude_srcs: [ |
| 27 | "src/jit_disasm.c", |
| 28 | ], |
| 29 | local_include_dirs: [ |
| 30 | "include", |
| 31 | "include/uapi", |
| 32 | "src/kernel/bpf" |
| 33 | ], |
Colin Cross | 61b9d9c | 2022-04-22 13:10:31 -0700 | [diff] [blame] | 34 | target: { |
| 35 | musl: { |
| 36 | // There is an unfortunate interaction between the bionic uapi headers |
| 37 | // used by musl and the kernel headers distributed with bpftool. The |
| 38 | // bionic uapi headers include <linux/compiler_types.h>, which they |
| 39 | // expect to be resolved to their own copy of compiler_types.h that |
| 40 | // includes compiler.h. It instead resolves to the bpftool copy, |
| 41 | // which includes compiler-gcc.h directly, triggering an error if |
| 42 | // the _LINUX_COMPILER_H_ header guard is not already defined. Hack |
| 43 | // around it by always including linux/compiler.h from the command line. |
| 44 | cflags: ["-include linux/compiler.h"], |
| 45 | }, |
| 46 | }, |
Connor O'Brien | d8c2e9a | 2022-02-14 17:49:38 -0800 | [diff] [blame] | 47 | static_libs: [ |
| 48 | "libbpf", |
| 49 | "libcap", |
| 50 | "libelf", |
| 51 | "libz", |
| 52 | ], |
| 53 | cflags: [ |
| 54 | "-DBPFTOOL_WITHOUT_SKELETONS", |
| 55 | "-DBPFTOOL_VERSION=\"5.16.0-c446fdacb10d\"", |
| 56 | "-DUSE_LIBCAP", |
| 57 | "-Wno-missing-field-initializers", |
| 58 | "-Wno-pointer-arith", |
| 59 | "-Wno-unused-parameter", |
| 60 | ] |
| 61 | } |