Thread (19 messages) 19 messages, 3 authors, 2021-02-18

Re: [PATCH bpf-next 2/6] libbpf: Add BTF_KIND_FLOAT support

From: Ilya Leoshkevich <iii@linux.ibm.com>
Date: 2021-02-17 21:29:36

On Wed, 2021-02-17 at 13:12 -0800, John Fastabend wrote:
John Fastabend wrote:
quoted
Ilya Leoshkevich wrote:
quoted
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?
quoted
kernels.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
[...]

quoted
@@ -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?
Sorry typo on my side, 't->size = ?' is what I was trying to point
out.
Looks like its set in the other case where we replace VAR with INT.
The idea is to have the size of the INT equal to the size of the FLOAT
that it replaces. I guess we can't do the same for VARs, because they
don't have the size field, and if we don't have DATASECs, then we can't
find the size of a VAR at all.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help