]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Refactor ELF section handler definitions
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 28 Sep 2021 16:19:43 +0000 (09:19 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 28 Sep 2021 20:51:19 +0000 (13:51 -0700)
commit6625d9163a7a8abb61a290f418e504fb67799441
tree305cac72388cfccd6197d5b0d4279b5056838492
parentd085deccb02c839ef037a417b1110d47a7da463b
libbpf: Refactor ELF section handler definitions

Refactor ELF section handler definitions table to use a set of flags and
unified SEC_DEF() macro. This allows for more succinct and table-like
set of definitions, and allows to more easily extend the logic without
adding more verbosity (this is utilized in later patches in the series).

This approach is also making libbpf-internal program pre-load callback
not rely on bpf_sec_def definition, which demonstrates that future
pluggable ELF section handlers will be able to achieve similar level of
integration without libbpf having to expose extra types and APIs.

For starters, update SEC_DEF() definitions and make them more succinct.
Also convert BPF_PROG_SEC() and BPF_APROG_COMPAT() definitions to
a common SEC_DEF() use.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Dave Marchevsky <davemarchevsky@fb.com>
Link: https://lore.kernel.org/bpf/20210928161946.2512801-8-andrii@kernel.org
tools/lib/bpf/libbpf.c