mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-22 16:37:41 +07:00
tools: libbpf: don't return '.text' as a program for multi-function programs
Make bpf_program__next() skip over '.text' section if object file has pseudo calls. The '.text' section is hardly a program in that case, it's more of a storage for code of functions other than main. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
9a94f277c4
commit
eac7d84519
@ -1865,8 +1865,8 @@ void *bpf_object__priv(struct bpf_object *obj)
|
|||||||
return obj ? obj->priv : ERR_PTR(-EINVAL);
|
return obj ? obj->priv : ERR_PTR(-EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bpf_program *
|
static struct bpf_program *
|
||||||
bpf_program__next(struct bpf_program *prev, struct bpf_object *obj)
|
__bpf_program__next(struct bpf_program *prev, struct bpf_object *obj)
|
||||||
{
|
{
|
||||||
size_t idx;
|
size_t idx;
|
||||||
|
|
||||||
@ -1887,6 +1887,18 @@ bpf_program__next(struct bpf_program *prev, struct bpf_object *obj)
|
|||||||
return &obj->programs[idx];
|
return &obj->programs[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct bpf_program *
|
||||||
|
bpf_program__next(struct bpf_program *prev, struct bpf_object *obj)
|
||||||
|
{
|
||||||
|
struct bpf_program *prog = prev;
|
||||||
|
|
||||||
|
do {
|
||||||
|
prog = __bpf_program__next(prog, obj);
|
||||||
|
} while (prog && bpf_program__is_function_storage(prog, obj));
|
||||||
|
|
||||||
|
return prog;
|
||||||
|
}
|
||||||
|
|
||||||
int bpf_program__set_priv(struct bpf_program *prog, void *priv,
|
int bpf_program__set_priv(struct bpf_program *prog, void *priv,
|
||||||
bpf_program_clear_priv_t clear_priv)
|
bpf_program_clear_priv_t clear_priv)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user