From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8DC5C433DF for ; Tue, 9 Jun 2020 21:16:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 90B582078D for ; Tue, 9 Jun 2020 21:16:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591737416; bh=Nvv8tC18TUn2Q9L9nrl6b3syykFOx699ZvIEzmFTvkM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=0HW4f5fB6IZKWwE6YlrA4qxVYwBUJQr5ayXfjL9OiO5plZZGe8qheruOme+1KmIW7 ZKPtMslYMn1vCqpez51sdNsdlTl4AOWn7Ylaz9Gj7d87bXNCntmdY/+Hi4fm9kTahL 3gMG9b4YT+c2MHkgHysj6Dasu2DmuftUjT8Cp8mM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727012AbgFIVQ4 (ORCPT ); Tue, 9 Jun 2020 17:16:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:39754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727002AbgFIVQ4 (ORCPT ); Tue, 9 Jun 2020 17:16:56 -0400 Received: from quaco.ghostprotocols.net (unknown [179.97.37.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 499FB20734; Tue, 9 Jun 2020 21:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591737415; bh=Nvv8tC18TUn2Q9L9nrl6b3syykFOx699ZvIEzmFTvkM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rAey2MCrH+shtwqDVjPk5GWl+5+piGcpOqGmSRjQng3Zjr9jbGXxihky8QWIcbWWJ GLkfSGvgJavOsSm7mQQVRHc3dXM0wgLALsD6WvkiOQXH402rcbj3K++akJ6wQSJIAX d+k4NWoKJ9tLJJ8bUwNdjaCddNi6YGDFL7kD74Ys= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 5B4ED40AFD; Tue, 9 Jun 2020 18:16:53 -0300 (-03) Date: Tue, 9 Jun 2020 18:16:53 -0300 From: Arnaldo Carvalho de Melo To: Daniel Borkmann Cc: Alexei Starovoitov , Andrii Nakryiko , Peter Zijlstra , Ian Rogers , Namhyung Kim , Pekka Enberg , Jiri Olsa , Irina Tirdea , bpf , Linux Kernel Mailing List Subject: Re: [PATCH] libbpf: Define __WORDSIZE if not available Message-ID: <20200609211653.GI24868@kernel.org> References: <20200608161150.GA3073@kernel.org> <20200609153445.GF24868@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org 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 > > Signed-off-by: Arnaldo Carvalho de Melo > > Diff missing? Oh well, sorry about that, EBADCOFFEE or something: From: Arnaldo Carvalho de Melo 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 Signed-off-by: Arnaldo Carvalho de Melo --- 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 #include -#ifdef __GLIBC__ -#include -#else -#include +#include +#ifndef __WORDSIZE +#define __WORDSIZE (__SIZEOF_LONG__ * 8) #endif static inline size_t hash_bits(size_t h, int bits)