diff options
author | Yonghong Song <yhs@fb.com> | 2022-06-07 09:26:47 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-06-07 20:20:43 +0300 |
commit | 23b2a3a8f63a9dc14ad0c7a63098e0b3575b1173 (patch) | |
tree | 2691859e6ba32633eb0db214065a8180e73a6333 /tools/lib/bpf/btf.h | |
parent | 6ec7d79be202db14bd0ceeb9ed32908bcaae27fa (diff) | |
download | linux-23b2a3a8f63a9dc14ad0c7a63098e0b3575b1173.tar.xz |
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>
Diffstat (limited to 'tools/lib/bpf/btf.h')
-rw-r--r-- | tools/lib/bpf/btf.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h index 83312c34007a..9fb416eb5644 100644 --- a/tools/lib/bpf/btf.h +++ b/tools/lib/bpf/btf.h @@ -537,6 +537,13 @@ static inline bool btf_is_any_enum(const struct btf_type *t) return btf_is_enum(t) || btf_is_enum64(t); } +static inline bool btf_kind_core_compat(const struct btf_type *t1, + const struct btf_type *t2) +{ + return btf_kind(t1) == btf_kind(t2) || + (btf_is_any_enum(t1) && btf_is_any_enum(t2)); +} + static inline __u8 btf_int_encoding(const struct btf_type *t) { return BTF_INT_ENCODING(*(__u32 *)(t + 1)); |