Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH bpf] libbpf: fix build on ppc64le architecture
@ 2020-08-18 16:44 Andrii Nakryiko
  2020-08-18 17:04 ` Alexei Starovoitov
  0 siblings, 1 reply; 2+ messages in thread
From: Andrii Nakryiko @ 2020-08-18 16:44 UTC (permalink / raw)
  To: bpf, netdev, ast, daniel; +Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko

On ppc64le we get the following warning:

  In file included from btf_dump.c:16:0:
  btf_dump.c: In function ‘btf_dump_emit_struct_def’:
  ../include/linux/kernel.h:20:17: error: comparison of distinct pointer types lacks a cast [-Werror]
    (void) (&_max1 == &_max2);  \
                   ^
  btf_dump.c:882:11: note: in expansion of macro ‘max’
      m_sz = max(0LL, btf__resolve_size(d->btf, m->type));
             ^~~

Fix by explicitly casting to __s64, which is a return type from
btf__resolve_size().

Fixes: 702eddc77a90 ("libbpf: Handle GCC built-in types for Arm NEON")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 tools/lib/bpf/btf_dump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c
index fe39bd774697..57c00fa63932 100644
--- a/tools/lib/bpf/btf_dump.c
+++ b/tools/lib/bpf/btf_dump.c
@@ -879,7 +879,7 @@ static void btf_dump_emit_struct_def(struct btf_dump *d,
 			btf_dump_printf(d, ": %d", m_sz);
 			off = m_off + m_sz;
 		} else {
-			m_sz = max(0LL, btf__resolve_size(d->btf, m->type));
+			m_sz = max((__s64)0, btf__resolve_size(d->btf, m->type));
 			off = m_off + m_sz * 8;
 		}
 		btf_dump_printf(d, ";");
-- 
2.24.1


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

* Re: [PATCH bpf] libbpf: fix build on ppc64le architecture
  2020-08-18 16:44 [PATCH bpf] libbpf: fix build on ppc64le architecture Andrii Nakryiko
@ 2020-08-18 17:04 ` Alexei Starovoitov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2020-08-18 17:04 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: bpf, Network Development, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Kernel Team

On Tue, Aug 18, 2020 at 9:47 AM Andrii Nakryiko <andriin@fb.com> wrote:
>
> On ppc64le we get the following warning:
>
>   In file included from btf_dump.c:16:0:
>   btf_dump.c: In function ‘btf_dump_emit_struct_def’:
>   ../include/linux/kernel.h:20:17: error: comparison of distinct pointer types lacks a cast [-Werror]
>     (void) (&_max1 == &_max2);  \
>                    ^
>   btf_dump.c:882:11: note: in expansion of macro ‘max’
>       m_sz = max(0LL, btf__resolve_size(d->btf, m->type));
>              ^~~
>
> Fix by explicitly casting to __s64, which is a return type from
> btf__resolve_size().
>
> Fixes: 702eddc77a90 ("libbpf: Handle GCC built-in types for Arm NEON")
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>

Applied. Thanks

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

end of thread, other threads:[~2020-08-18 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 16:44 [PATCH bpf] libbpf: fix build on ppc64le architecture Andrii Nakryiko
2020-08-18 17:04 ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).