[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzYK0XAXPLaqTzy6S3wDgrrvAJHyEjk2OoZfbYTRJbkVVQ@mail.gmail.com>
Date: Thu, 18 Jul 2019 10:26:48 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Andrii Nakryiko <andriin@...com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>,
bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Alexei Starovoitov <ast@...com>,
Kernel Team <kernel-team@...com>
Subject: Re: [PATCH bpf] libbpf: fix missing __WORDSIZE definition
On Thu, Jul 18, 2019 at 10:25 AM Andrii Nakryiko <andriin@...com> wrote:
>
> hashmap.h depends on __WORDSIZE being defined. It is defined by
> glibc/musl in different headers. It's an explicit goal for musl to be
> "non-detectable" at compilation time, so instead include glibc header if
> glibc is explicitly detected and fall back to musl header otherwise.
>
> Fixes: e3b924224028 ("libbpf: add resizable non-thread safe internal hashmap")
> Reported-by: Arnaldo Carvalho de Melo <acme@...hat.com>
> Signed-off-by: Andrii Nakryiko <andriin@...com>
> ---
> tools/lib/bpf/hashmap.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/tools/lib/bpf/hashmap.h b/tools/lib/bpf/hashmap.h
> index 03748a742146..46a8cb667994 100644
> --- a/tools/lib/bpf/hashmap.h
> +++ b/tools/lib/bpf/hashmap.h
> @@ -10,7 +10,12 @@
>
> #include <stdbool.h>
> #include <stddef.h>
> +#ifdef __GLIBC__
> +#include <bits/wordsize.h>
> +#else
> +#include <bits/reg.h>
> #include "libbpf_internal.h"
> +#endif
Disregard this version, #endif on the wrong line. Fixing in v2.
>
> static inline size_t hash_bits(size_t h, int bits)
> {
> --
> 2.17.1
>
Powered by blists - more mailing lists