mirror of
https://github.com/netdata/libbpf.git
synced 2026-04-05 16:19:06 +08:00
libbpf: Add enum64 relocation support
The enum64 relocation support is added. The bpf local type could be either enum or enum64 and the remote type could be either enum or enum64 too. The all combinations of local enum/enum64 and remote enum/enum64 are supported. Acked-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/r/20220607062647.3721719-1-yhs@fb.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
committed by
Andrii Nakryiko
parent
3f9d041e19
commit
416351822c
@@ -5524,7 +5524,7 @@ int bpf_core_add_cands(struct bpf_core_cand *local_cand,
|
||||
n = btf__type_cnt(targ_btf);
|
||||
for (i = targ_start_id; i < n; i++) {
|
||||
t = btf__type_by_id(targ_btf, i);
|
||||
if (btf_kind(t) != btf_kind(local_t))
|
||||
if (!btf_kind_core_compat(t, local_t))
|
||||
continue;
|
||||
|
||||
targ_name = btf__name_by_offset(targ_btf, t->name_off);
|
||||
@@ -5738,7 +5738,7 @@ int bpf_core_types_are_compat(const struct btf *local_btf, __u32 local_id,
|
||||
/* caller made sure that names match (ignoring flavor suffix) */
|
||||
local_type = btf__type_by_id(local_btf, local_id);
|
||||
targ_type = btf__type_by_id(targ_btf, targ_id);
|
||||
if (btf_kind(local_type) != btf_kind(targ_type))
|
||||
if (!btf_kind_core_compat(local_type, targ_type))
|
||||
return 0;
|
||||
|
||||
recur:
|
||||
@@ -5751,7 +5751,7 @@ recur:
|
||||
if (!local_type || !targ_type)
|
||||
return -EINVAL;
|
||||
|
||||
if (btf_kind(local_type) != btf_kind(targ_type))
|
||||
if (!btf_kind_core_compat(local_type, targ_type))
|
||||
return 0;
|
||||
|
||||
switch (btf_kind(local_type)) {
|
||||
@@ -5759,6 +5759,7 @@ recur:
|
||||
case BTF_KIND_STRUCT:
|
||||
case BTF_KIND_UNION:
|
||||
case BTF_KIND_ENUM:
|
||||
case BTF_KIND_ENUM64:
|
||||
case BTF_KIND_FWD:
|
||||
return 1;
|
||||
case BTF_KIND_INT:
|
||||
|
||||
Reference in New Issue
Block a user