lkml.org 
[lkml]   [2020]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectlibbpf's hashmap use of __WORDSIZE
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 <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)
\
 
 \ /
  Last update: 2020-06-08 18:12    [W:0.054 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site