RE: [PATCH bpf-next 2/6] libbpf: Add BTF_KIND_FLOAT support
From: John Fastabend <john.fastabend@gmail.com>
Date: 2021-02-17 20:59:01
From: John Fastabend <john.fastabend@gmail.com>
Date: 2021-02-17 20:59:01
Ilya Leoshkevich wrote:
The logic follows that of BTF_KIND_INT most of the time. Sanitization replaces BTF_KIND_FLOATs with equally-sized BTF_KIND_INTs on older
^^^^^^^^^^^^^^^^^^^^^^^^^^^ Does this match the code though?
kernels. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> ---
[...]
@@ -2445,6 +2450,9 @@ static void bpf_object__sanitize_btf(struct bpf_object *obj, struct btf *btf) } else if (!has_func_global && btf_is_func(t)) { /* replace BTF_FUNC_GLOBAL with BTF_FUNC_STATIC */ t->info = BTF_INFO_ENC(BTF_KIND_FUNC, 0, 0); + } else if (!has_float && btf_is_float(t)) { + /* replace FLOAT with INT */ + t->info = BTF_INFO_ENC(BTF_KIND_FLOAT, 0, 0);
Do we also need to encode the vlen here? #define BTF_INFO_ENC(kind, kind_flag, vlen) \ ((!!(kind_flag) << 31) | ((kind) << 24) | ((vlen) & BTF_MAX_VLEN))
} } }@@ -3882,6 +3890,18 @@ static int probe_kern_btf_datasec(void) strs, sizeof(strs))); }