This patch series changes the type of bpf_object_skeleton->data to const void * and provides a helper method X__elf_bytes(size_t *sz) for accessing the raw binary data of the compiled embedded BPF object. The type change enforces the previously implied behavior of immutability for this field while casting it to (void *) before assignment allows for compiling with previous versions of the libbpf headers without compiler warnings. The helper method allows easier access to the BPF binary object data and is leveraged to populate the skeleton field. The inclusion of this helper method will allow users to get access to the data without needing to populate an entire skeleton first. Checks are added in the third patch to validate the behavior of the added method Matt Smith (3): libbpf: Change bpf_object_skelecton data field to const void* bpftool: Provide a helper method for accessing bpf binary data selftests/bpf: Add checks for X__elf_bytes skeleton helper tools/bpf/bpftool/gen.c | 39 ++++++++++++------- tools/lib/bpf/libbpf.h | 2 +- .../selftests/bpf/prog_tests/skeleton.c | 7 ++++ 3 files changed, 32 insertions(+), 16 deletions(-) -- 2.30.2