bpftool: Provide a helper method for accessing skeleton's embedded ELF data
authorMatt Smith <alastorze@fb.com>
Wed, 1 Sep 2021 19:44:38 +0000 (12:44 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Wed, 8 Sep 2021 00:41:23 +0000 (17:41 -0700)
commita6cc6b34b93e3660149a7cb947be98a9b239ffce
tree4bfc19f41b9e95c4273493d25318e714f9cbe2c9
parent08a6f22ef6f843d0ea7252087787b5ab04610bec
bpftool: Provide a helper method for accessing skeleton's embedded ELF data

This adds a skeleton method X__elf_bytes() which returns the binary data of
the compiled and embedded BPF object file. It additionally sets the size of
the return data to the provided size_t pointer argument.

The assignment to s->data is cast to void * to ensure no warning is issued if
compiled with a previous version of libbpf where the bpf_object_skeleton field
is void * instead of const void *

Signed-off-by: Matt Smith <alastorze@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210901194439.3853238-3-alastorze@fb.com
tools/bpf/bpftool/gen.c