aboutsummaryrefslogtreecommitdiffstats
path: root/tools/include
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2016-07-13 14:04:04 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-07-13 14:04:04 -0400
commit2a00f026a15d161b47ba3d3417d0fec5193468c3 (patch)
treed86f90501196e273b6c1e567a3f95e587b9ebb56 /tools/include
parent7b39cafb7aa68ef8e32a9f51fbe737d96084ca74 (diff)
tools: Fix up BITS_PER_LONG setting
It was set based on CONFIG_64BIT, that is available only when using Kconfig, which we're working towards but not to the point of having this CONFIG variable set, so synthesize it from available compiler defined defines, __SIZEOF_LONG__ or, lacking that, __WORDSIZE. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-og5fmkr17856lhupacihwxvb@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/include')
-rw-r--r--tools/include/asm-generic/bitsperlong.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/tools/include/asm-generic/bitsperlong.h b/tools/include/asm-generic/bitsperlong.h
index d1d70aa19021..cfd661c6fc17 100644
--- a/tools/include/asm-generic/bitsperlong.h
+++ b/tools/include/asm-generic/bitsperlong.h
@@ -3,6 +3,24 @@
3 3
4#include <uapi/asm-generic/bitsperlong.h> 4#include <uapi/asm-generic/bitsperlong.h>
5 5
6/*
7 * In the kernel, where this file comes from, we can rely on CONFIG_64BIT,
8 * here we have to make amends with what the various compilers provides us
9 * to figure out if we're on a 64-bit machine...
10 */
11#ifdef __SIZEOF_LONG__
12# if __SIZEOF_LONG__ == 8
13# define CONFIG_64BIT
14# endif
15#else
16# ifdef __WORDSIZE
17# if __WORDSIZE == 64
18# define CONFIG_64BIT
19# endif
20# else
21# error Failed to determine BITS_PER_LONG value
22# endif
23#endif
6 24
7#ifdef CONFIG_64BIT 25#ifdef CONFIG_64BIT
8#define BITS_PER_LONG 64 26#define BITS_PER_LONG 64
@@ -10,11 +28,7 @@
10#define BITS_PER_LONG 32 28#define BITS_PER_LONG 32
11#endif /* CONFIG_64BIT */ 29#endif /* CONFIG_64BIT */
12 30
13/* 31#if BITS_PER_LONG != __BITS_PER_LONG
14 * FIXME: The check currently breaks x86-64 build, so it's
15 * temporarily disabled. Please fix x86-64 and reenable
16 */
17#if 0 && BITS_PER_LONG != __BITS_PER_LONG
18#error Inconsistent word size. Check asm/bitsperlong.h 32#error Inconsistent word size. Check asm/bitsperlong.h
19#endif 33#endif
20 34