[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200609211653.GI24868@kernel.org>
Date: Tue, 9 Jun 2020 18:16:53 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Daniel Borkmann <daniel@...earbox.net>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>,
Andrii Nakryiko <andrii.nakryiko@...il.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ian Rogers <irogers@...gle.com>,
Namhyung Kim <namhyung@...nel.org>,
Pekka Enberg <penberg@...nel.org>,
Jiri Olsa <jolsa@...nel.org>,
Irina Tirdea <irina.tirdea@...el.com>,
bpf <bpf@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] libbpf: Define __WORDSIZE if not available
Em Tue, Jun 09, 2020 at 10:37:48PM +0200, Daniel Borkmann escreveu:
> Hey Arnaldo,
>
> On 6/9/20 5:34 PM, Arnaldo Carvalho de Melo wrote:
> > Some systems, such as Android, don't have a define for __WORDSIZE, do it
> > in terms of __SIZEOF_LONG__, as done in perf since 2012:
> >
> > http://git.kernel.org/torvalds/c/3f34f6c0233ae055b5
> >
> > For reference: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
> >
> > I build tested it here and Andrii did some Travis CI build tests too.
> >
> > Acked-by: Andrii Nakryiko <andriin@...com>
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
>
> Diff missing?
Oh well, sorry about that, EBADCOFFEE or something:
From: Arnaldo Carvalho de Melo <acme@...nel.org>
Some systems, such as Android, don't have a define for __WORDSIZE, do it
in terms of __SIZEOF_LONG__, as done in perf since 2012:
http://git.kernel.org/torvalds/c/3f34f6c0233ae055b5
For reference: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
I build tested it here and Andrii did some Travis CI build tests too.
Acked-by: Andrii Nakryiko <andriin@...com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
diff --git a/tools/lib/bpf/hashmap.h b/tools/lib/bpf/hashmap.h
index e823b35e7371..df59fd4fc95b 100644
--- a/tools/lib/bpf/hashmap.h
+++ b/tools/lib/bpf/hashmap.h
@@ -10,10 +10,9 @@
#include <stdbool.h>
#include <stddef.h>
-#ifdef __GLIBC__
-#include <bits/wordsize.h>
-#else
-#include <bits/reg.h>
+#include <limits.h>
+#ifndef __WORDSIZE
+#define __WORDSIZE (__SIZEOF_LONG__ * 8)
#endif
static inline size_t hash_bits(size_t h, int bits)
Powered by blists - more mailing lists