]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: add support for bpf_call
authorAlexei Starovoitov <ast@fb.com>
Fri, 15 Dec 2017 01:55:10 +0000 (17:55 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Sun, 17 Dec 2017 19:34:35 +0000 (20:34 +0100)
commit6d6e54b4ef7491fad5048666cfdf3b2e27b7f230
tree2900d4f0541a70a9b734bcea775e310ceea068ae
parent9e5e3429a1d79164b47ce19e5142b501a1d1c89a
libbpf: add support for bpf_call

- recognize relocation emitted by llvm
- since all regular function will be kept in .text section and llvm
  takes care of pc-relative offsets in bpf_call instruction
  simply copy all of .text to relevant program section while adjusting
  bpf_call instructions in program section to point to newly copied
  body of instructions from .text
- do so for all programs in the elf file
- set all programs types to the one passed to bpf_prog_load()

Note for elf files with multiple programs that use different
functions in .text section we need to do 'linker' style logic.
This work is still TBD

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/include/uapi/linux/bpf.h
tools/lib/bpf/bpf.h
tools/lib/bpf/libbpf.c