BTF: build failure on 32bit on linux-next
Subsystems (4)
Hello,
looks like the TODO prints added in 67234743736a6 are not 32bit clean.
Do you plan to implement this functionality or should they be fixed?
Thanks
Michal
tools/lib/bpf/libbpf.c +2 -2
@@ -4565,7 +4565,7 @@ static int init_map_slots(struct bpf_object *obj, struct bpf_map *map) targ_map = map->init_slots[i]; fd =bpf_map__fd (targ_map);if (obj->gen_loader) { -pr_warn ("// TODO map_update_elem: idx %ld key %d value==map_idx %ld\n" , +pr_warn ("// TODO map_update_elem: idx %td key %d value==map_idx %td\n" , map - obj->maps, i, targ_map - obj->maps);return -ENOTSUP ; }else {
@@ -6189,7 +6189,7 @@ static int bpf_core_apply_relo(struct bpf_program *prog,return -EINVAL ;if (prog->obj->gen_loader) { -pr_warn ("// TODO core_relo: prog %ld insn[%d] %s %s kind %d\n" , +pr_warn ("// TODO core_relo: prog %td insn[%d] %s %s kind %d\n" , prog - prog->obj->programs, relo->insn_off /8 , local_name, spec_str, relo->kind);return -ENOTSUP ;
Quoted 6 lines · Michal Suchánek
Hello,
looks like the TODO prints added in
67234743736a6are not 32bit clean.Do you plan to implement this functionality or should they be fixed?
They should be fixed regardless. Can you please re-submit as a proper patch to [email protected] with [PATCH bpf-next] subj prefix?
Quoted 27 lines
Thanks
Michal
tools/lib/bpf/libbpf.c +2
-2@@ -4565,7 +4565,7 @@ static int init_map_slots(struct bpf_object *obj, struct bpf_map *map) targ_map = map->init_slots[i]; fd =bpf_map__fd (targ_map);if (obj->gen_loader) { -pr_warn ("// TODO map_update_elem: idx %ld key %d value==map_idx %ld\n" , +pr_warn ("// TODO map_update_elem: idx %td key %d value==map_idx %td\n" , map - obj->maps, i, targ_map - obj->maps);return -ENOTSUP ; }else {@@ -6189,7 +6189,7 @@ static int bpf_core_apply_relo(struct bpf_program *prog,return -EINVAL ;if (prog->obj->gen_loader) { -pr_warn ("// TODO core_relo: prog %ld insn[%d] %s %s kind %d\n" , +pr_warn ("// TODO core_relo: prog %td insn[%d] %s %s kind %d\n" , prog - prog->obj->programs, relo->insn_off /8 , local_name, spec_str, relo->kind);return -ENOTSUP ;
PATCH 1/1 libbpf: fix pr_warn type warnings on 32bit
The printed value is ptrdiff_t and is formatted wiht %ld. This works on 64bit but produces a warning on 32bit. Fix the format specifier to %td.
--- tools/lib/bpf/libbpf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/lib/bpf/libbpf.c +2 -2
@@ -4584,7 +4584,7 @@ static int init_map_slots(struct bpf_object *obj, struct bpf_map *map) targ_map = map->init_slots[i]; fd =bpf_map__fd (targ_map);if (obj->gen_loader) { -pr_warn ("// TODO map_update_elem: idx %ld key %d value==map_idx %ld\n" , +pr_warn ("// TODO map_update_elem: idx %td key %d value==map_idx %td\n" , map - obj->maps, i, targ_map - obj->maps);return -ENOTSUP ; }else {
@@ -6208,7 +6208,7 @@ static int bpf_core_apply_relo(struct bpf_program *prog,return -EINVAL ;if (prog->obj->gen_loader) { -pr_warn ("// TODO core_relo: prog %ld insn[%d] %s %s kind %d\n" , +pr_warn ("// TODO core_relo: prog %td insn[%d] %s %s kind %d\n" , prog - prog->obj->programs, relo->insn_off /8 , local_name, spec_str, relo->kind);return -ENOTSUP ;
Signature · 1 line
2.26.2
Re: [PATCH bpf-next] libbpf: fix pr_warn type warnings on 32bit
Quoted 5 lines · Michal Suchanek
The printed value is
ptrdiff_tand is formatted wiht %ld. This works on 64bit but produces a warning on 32bit. Fix the format specifier to %td.Fixes 67234743736a ("libbpf: Generate loader program out of BPF ELF file.")Signed-off-by Michal Suchanek <[email protected]>