commit | 75db50f4a09d9dbac49b1ace9e4b6a722bdf0519 | [log] [tgz] |
---|---|---|
author | Andrii Nakryiko <andriin@fb.com> | Wed May 29 10:01:08 2019 -0700 |
committer | Andrii Nakryiko <andrii.nakryiko@gmail.com> | Wed May 29 10:27:27 2019 -0700 |
tree | 2dd7bf4b43989c1008b1ab65df42b6febad7f245 | |
parent | d714245dd9ec66e2100cceb0af0cef5e44f13335 [diff] |
sync: latest libbpf changes from kernel Syncing latest libbpf commits from kernel repository. Baseline commit: f49aa1de98363b6c5fba4637678d6b0ba3d18065 Checkpoint commit: e672db03ab0e43e41ab6f8b2156a10d6e40f243d Andrii Nakryiko (5): libbpf: ensure libbpf.h is included along libbpf_internal.h libbpf: add btf__parse_elf API to load .BTF and .BTF.ext libbpf: add resizable non-thread safe internal hashmap libbpf: switch btf_dedup() to hashmap for dedup table libbpf: add btf_dump API for BTF-to-C conversion Hariprasad Kelam (1): libbpf: fix warning that PTR_ERR_OR_ZERO can be used Jiong Wang (2): tools: bpf: sync uapi header bpf.h libbpf: add "prog_flags" to bpf_program/bpf_prog_load_attr/bpf_load_program_attr Quentin Monnet (1): libbpf: add bpf_object__load_xattr() API function to pass log_level Yonghong Song (1): tools/bpf: sync bpf uapi header bpf.h to tools directory include/uapi/linux/bpf.h | 35 +- src/bpf.c | 1 + src/bpf.h | 1 + src/btf.c | 329 ++++++---- src/btf.h | 19 + src/btf_dump.c | 1336 ++++++++++++++++++++++++++++++++++++++ src/hashmap.c | 229 +++++++ src/hashmap.h | 173 +++++ src/libbpf.c | 27 +- src/libbpf.h | 7 + src/libbpf.map | 9 + src/libbpf_internal.h | 2 + 12 files changed, 2045 insertions(+), 123 deletions(-) create mode 100644 src/btf_dump.c create mode 100644 src/hashmap.c create mode 100644 src/hashmap.h -- 2.17.1
This is a mirror of bpf-next linux tree's tools/lib/bpf
directory plus its supporting header files.
The following files will by sync'ed with bpf-next repo:
src/
<-> bpf-next/tools/lib/bpf/
include/uapi/linux/bpf_common.h
<-> bpf-next/tools/include/uapi/linux/bpf_common.h
include/uapi/linux/bpf.h
<-> bpf-next/tools/include/uapi/linux/bpf.h
include/uapi/linux/btf.h
<-> bpf-next/tools/include/uapi/linux/btf.h
include/uapi/linux/if_link.h
<-> bpf-next/tools/include/uapi/linux/if_link.h
include/uapi/linux/if_xdp.h
<-> bpf-next/tools/include/uapi/linux/if_xdp.h
include/uapi/linux/netlink.h
<-> bpf-next/tools/include/uapi/linux/netlink.h
include/tools/libc_compat.h
<-> bpf-next/tools/include/tools/libc_compat.h
Other header files at this repo (include/linux/*.h
) are reduced versions of their counterpart files at bpf-next's tools/include/linux/*.h
to make compilation successful.
libelf is an internal dependency of libbpf and thus it is required to link against and must be installed on the system for applications to work. pkg-config is used by default to find libelf, and the program called can be overridden with PKG_CONFIG
. If using pkg-config
at build time is not desired, it can be disabled by setting NO_PKG_CONFIG=1
when calling make.
To build both static libbpf.a and shared libbpf.so:
$ cd src
$ make
To build only static libbpf.a library in directory build/ and install them together with libbpf headers in a staging directory root/:
$ cd src $ mkdir build root $ BUILD_STATIC_ONLY=y OBJDIR=build DESTDIR=root make install
To build both static libbpf.a and shared libbpf.so against a custom libelf dependency installed in /build/root/ and install them together with libbpf headers in a build directory /build/root/:
$ cd src $ PKG_CONFIG_PATH=/build/root/lib64/pkgconfig DESTDIR=/build/root make install
To integrate libbpf into a project which uses Meson building system define [wrap-git]
file in subprojects
folder. To add libbpf dependency to the parent parent project, e.g. for libbpf_static_dep:
libbpf_obj = subproject('libbpf', required : true) libbpf_static_dep = libbpf_proj.get_variable('libbpf_static_dep')
To validate changes to meson.build
$ python3 meson.py build $ ninja -C build/
To install headers, libs and pkgconfig
$ cd build
$ ninja install