Skip to content

Commit 4b885e5

Browse files
anakryikokernel-patches-bot
authored andcommitted
libbpf: support BTF_KIND_FLOAT during type compatibility checks in CO-RE
Add BTF_KIND_FLOAT support when doing CO-RE field type compatibility check. Without this, relocations against float/double fields will fail. Also adjust one error message to emit instruction index instead of less convenient instruction byte offset. Fixes: 22541a9 ("libbpf: Add BTF_KIND_FLOAT support") Signed-off-by: Andrii Nakryiko <[email protected]>
1 parent fb05dd7 commit 4b885e5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/lib/bpf/libbpf.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5141,6 +5141,7 @@ static int bpf_core_fields_are_compat(const struct btf *local_btf,
51415141

51425142
switch (btf_kind(local_type)) {
51435143
case BTF_KIND_PTR:
5144+
case BTF_KIND_FLOAT:
51445145
return 1;
51455146
case BTF_KIND_FWD:
51465147
case BTF_KIND_ENUM: {
@@ -6245,8 +6246,8 @@ static int bpf_core_apply_relo(struct bpf_program *prog,
62456246
/* bpf_core_patch_insn() should know how to handle missing targ_spec */
62466247
err = bpf_core_patch_insn(prog, relo, relo_idx, &targ_res);
62476248
if (err) {
6248-
pr_warn("prog '%s': relo #%d: failed to patch insn at offset %d: %d\n",
6249-
prog->name, relo_idx, relo->insn_off, err);
6249+
pr_warn("prog '%s': relo #%d: failed to patch insn #%zu: %d\n",
6250+
prog->name, relo_idx, relo->insn_off / BPF_INSN_SZ, err);
62506251
return -EINVAL;
62516252
}
62526253

0 commit comments

Comments
 (0)