OSDN Git Service

libbpf: Introduce elf_find_func_offset_from_file() function
authorDaniel Müller <deso@posteo.net>
Wed, 1 Mar 2023 21:23:07 +0000 (21:23 +0000)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 2 Mar 2023 00:05:35 +0000 (16:05 -0800)
commit434fdcead73515a76885418ffe2d96b4f3ed0f49
treeaf53258ad9c39d10d6f0aa9d416bf1863f7e0198
parent1eebcb60633fd469ee27b0fbd7ee4f271feedeca
libbpf: Introduce elf_find_func_offset_from_file() function

This change splits the elf_find_func_offset() function in two:
elf_find_func_offset(), which now accepts an already opened Elf object
instead of a path to a file that is to be opened, as well as
elf_find_func_offset_from_file(), which opens a binary based on a
path and then invokes elf_find_func_offset() on the Elf object. Having
this split in responsibilities will allow us to call
elf_find_func_offset() from other code paths on Elf objects that did not
necessarily come from a file on disk.

Signed-off-by: Daniel Müller <deso@posteo.net>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20230301212308.1839139-3-deso@posteo.net
tools/lib/bpf/libbpf.c