Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4553079ybg; Mon, 8 Jun 2020 10:40:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6yBD1GrQX5n2Nc9uCZiIOtu7HCxZO0jwmYzIojjuKQwtgd9OG4Lm71HhSGjAQcC03tJA4 X-Received: by 2002:a17:906:b88d:: with SMTP id hb13mr22335085ejb.96.1591638048981; Mon, 08 Jun 2020 10:40:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591638048; cv=none; d=google.com; s=arc-20160816; b=UT2mYRPVrqmMWmL62HvvtUlkUhYTIRtaqhV6LwuPjxPjzL+8Cxkez/QPcDxi5gs4Sy X9X0BYr7ecV+GoPVYM8NqaEun5wBl8K+z0SDHE+jqGWYY59XB+gNFo52Lx8FYJzkYCQh 7U6euPNJk9Z7/icMIyO6MsfSoevLBqlQ0tBv0MyCtm5HhnEbZ72xKL9moZpqMQdpgmoe QYpzNWIsSzGt29v9qjHGguEGyHi3KHhgDkS8Uu4JP429/1UeTIiVdpF+aEeBMkKPx0vI ++ZrpW2uUpoUUaehq7UFPQhW1pUW3ZjHP4xOzF18uOwRID4tWqVIE6HfUD3jHa/TYJ7n gFsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=WR0K/32jD5KwOlvfh4o4O0L/aQDwFn1c4N1kYEPP+IU=; b=l5T1QBCPyOvf8IUM3aK1IpylGIJZt2hAJ0wSIHTa4BYrekc6GXV6+mTTJoodS3t8eI QmdspVOR+lx5WScA/3U1mRKTa8egMoTMGF6h08ElskP2wkO4sarwdphELO+iBwf4mfvz 6dFVcMXLbU+XlgF70sjed0/Kui5IhSWyhJMtvdczAHdqbgtEivwbXJj5oq3KeowQxCES 7Sq0qTH9ku1zLssnsEyZKhSZMlFTL97DsDo0FWdaFei5CWz6j9ZgUK4UXfNVVK1j0BuJ +v/3jj8E9gfoX6YR/ynOsWErkQsYwkDIqtU3whj25HFOR105G0UCg/kLgmxCrlwEMpni 27UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="FqMES/74"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q17si10173510edb.42.2020.06.08.10.40.25; Mon, 08 Jun 2020 10:40:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="FqMES/74"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730427AbgFHQLz (ORCPT + 99 others); Mon, 8 Jun 2020 12:11:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:35032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730336AbgFHQLy (ORCPT ); Mon, 8 Jun 2020 12:11:54 -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 6202E2063A; Mon, 8 Jun 2020 16:11:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591632714; bh=5iBPmL/VaZp2yDxe19nlMgBARsfJrpmyX/uXreSE6s4=; h=Date:From:To:Cc:Subject:From; b=FqMES/74tLwdfEcstzqlW1bpCj4STuxaIxv6VybgT2a2O9VFJj1dLdeyE5baFBY14 OsP0B9SGy9kq0nu6HfJB0usy5yEdp0ndg1/7UAZHvdTiytTSk5wwLXUnX9pb5VO+Lm xon6F+I0xVyU3E51oWkMQJWhLa1f9/zr2TmlKBwA= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id E3C2940AFD; Mon, 8 Jun 2020 13:11:50 -0300 (-03) Date: Mon, 8 Jun 2020 13:11:50 -0300 From: Arnaldo Carvalho de Melo To: Andrii Nakryiko Cc: Peter Zijlstra , Ian Rogers , Namhyung Kim , Pekka Enberg , Jiri Olsa , Irina Tirdea , bpf@vger.kernel.org, Linux Kernel Mailing List Subject: libbpf's hashmap use of __WORDSIZE Message-ID: <20200608161150.GA3073@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Url: http://acmel.wordpress.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrii, We've got that hashmap.[ch] copy from libbpf so that we can build perf in systems where libbpf isn't available, and to make it build in all the containers I regularly test build perf I had to add the patch below, I test build with many versions of both gcc and clang and multiple libcs. https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html The way that tools/include/linux/bitops.h has been doing since 2012 is explained in: http://git.kernel.org/torvalds/c/3f34f6c0233ae055b5 Please take a look and see if you find it acceptable, Thanks, - Arnaldo Warning: Kernel ABI header at 'tools/perf/util/hashmap.h' differs from latest version at 'tools/lib/bpf/hashmap.h' diff -u tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h $ diff -u tools/lib/bpf/hashmap.h tools/perf/util/hashmap.h --- tools/lib/bpf/hashmap.h 2020-06-05 13:25:27.822079838 -0300 +++ tools/perf/util/hashmap.h 2020-06-05 13:25:27.838079794 -0300 @@ -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)