]> www.infradead.org Git - users/jedix/linux-maple.git/commit
libbpf: Extend linker API to support in-memory ELF files
authorAlastair Robertson <ajor@meta.com>
Wed, 11 Dec 2024 16:40:30 +0000 (08:40 -0800)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 12 Dec 2024 23:16:53 +0000 (15:16 -0800)
commit6d5e5e5d7ce134a0b334c3bfe44a9326d8c5f32b
tree56030fcfd759b2ac5333fe55f268ad46625674ca
parentb641712925bfe89ff7217cc2d0b7a8e042df556b
libbpf: Extend linker API to support in-memory ELF files

The new_fd and add_fd functions correspond to the original new and
add_file functions, but accept an FD instead of a file name. This
gives API consumers the option of using anonymous files/memfds to
avoid writing ELFs to disk.

This new API will be useful for performing linking as part of
bpftrace's JIT compilation.

The add_buf function is a convenience wrapper that does the work of
creating a memfd for the caller.

Signed-off-by: Alastair Robertson <ajor@meta.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20241211164030.573042-3-ajor@meta.com
tools/lib/bpf/libbpf.h
tools/lib/bpf/libbpf.map
tools/lib/bpf/linker.c