All of lore.kernel.org
 help / color / mirror / Atom feed
* BTF: build failure on 32bit on linux-next
@ 2021-05-21 16:20 Michal Suchánek
  2021-05-22  0:46 ` Andrii Nakryiko
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Suchánek @ 2021-05-21 16:20 UTC (permalink / raw)
  To: netdev
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Nathan Chancellor, Nick Desaulniers, linux-kernel,
	netdev, bpf, clang-built-linux

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

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 69cd1a835ebd..70a26af8d01f 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -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;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: BTF: build failure on 32bit on linux-next
  2021-05-21 16:20 BTF: build failure on 32bit on linux-next Michal Suchánek
@ 2021-05-22  0:46 ` Andrii Nakryiko
  2021-06-04 11:24   ` [PATCH bpf-next] libbpf: fix pr_warn type warnings on 32bit Michal Suchanek
  0 siblings, 1 reply; 4+ messages in thread
From: Andrii Nakryiko @ 2021-05-22  0:46 UTC (permalink / raw)
  To: Michal Suchánek
  Cc: Networking, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Nathan Chancellor, Nick Desaulniers, open list, bpf,
	clang-built-linux

On Fri, May 21, 2021 at 9:20 AM Michal Suchánek <msuchanek@suse.de> wrote:
>
> 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?

They should be fixed regardless. Can you please re-submit as a proper
patch to bpf@vger.kernel.org with [PATCH bpf-next] subj prefix?

>
> Thanks
>
> Michal
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 69cd1a835ebd..70a26af8d01f 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -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;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH bpf-next] libbpf: fix pr_warn type warnings on 32bit
  2021-05-22  0:46 ` Andrii Nakryiko
@ 2021-06-04 11:24   ` Michal Suchanek
  2021-06-04 15:29     ` Yonghong Song
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Suchanek @ 2021-06-04 11:24 UTC (permalink / raw)
  To: bpf
  Cc: Michal Suchanek, Networking, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Nathan Chancellor, Nick Desaulniers,
	open list, clang-built-linux

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.

Fixes: 67234743736a ("libbpf: Generate loader program out of BPF ELF file.")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 tools/lib/bpf/libbpf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index ef6600688f10..5e13c9d8d3f5 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -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;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next] libbpf: fix pr_warn type warnings on 32bit
  2021-06-04 11:24   ` [PATCH bpf-next] libbpf: fix pr_warn type warnings on 32bit Michal Suchanek
@ 2021-06-04 15:29     ` Yonghong Song
  0 siblings, 0 replies; 4+ messages in thread
From: Yonghong Song @ 2021-06-04 15:29 UTC (permalink / raw)
  To: Michal Suchanek, bpf
  Cc: Networking, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, John Fastabend, KP Singh,
	Nathan Chancellor, Nick Desaulniers, open list,
	clang-built-linux



On 6/4/21 4:24 AM, Michal Suchanek wrote:
> 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.
> 
> Fixes: 67234743736a ("libbpf: Generate loader program out of BPF ELF file.")
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>

Acked-by: Yonghong Song <yhs@fb.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-04 15:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21 16:20 BTF: build failure on 32bit on linux-next Michal Suchánek
2021-05-22  0:46 ` Andrii Nakryiko
2021-06-04 11:24   ` [PATCH bpf-next] libbpf: fix pr_warn type warnings on 32bit Michal Suchanek
2021-06-04 15:29     ` Yonghong Song

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.