Skip to content

Commit 25cd480

Browse files
committed
tools: Remove bitops/hweight usage of bits in tools/perf
We need to use lib/hweight.c for that, just like we do for lib/rbtree.c, so tools need to link hweight.o. For now do it directly, but we need to have a tools/lib/lk.a or .so that collects these goodies... Reported-by: Jan Beulich <JBeulich@suse.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-a1e91dx3apzqw5kbdt7ut21s@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 260d819 commit 25cd480

10 files changed

Lines changed: 30 additions & 42 deletions

File tree

tools/include/asm-generic/bitops.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#error only <linux/bitops.h> can be included directly
2323
#endif
2424

25+
#include <asm-generic/bitops/hweight.h>
26+
2527
#include <asm-generic/bitops/atomic.h>
2628

2729
#endif /* __TOOLS_ASM_GENERIC_BITOPS_H */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "../../../../include/asm-generic/bitops/arch_hweight.h"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "../../../../include/asm-generic/bitops/const_hweight.h"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifndef _TOOLS_LINUX_ASM_GENERIC_BITOPS_HWEIGHT_H_
2+
#define _TOOLS_LINUX_ASM_GENERIC_BITOPS_HWEIGHT_H_
3+
4+
#include <asm-generic/bitops/arch_hweight.h>
5+
#include <asm-generic/bitops/const_hweight.h>
6+
7+
#endif /* _TOOLS_LINUX_ASM_GENERIC_BITOPS_HWEIGHT_H_ */

tools/include/linux/bitops.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#ifndef _TOOLS_LINUX_BITOPS_H_
22
#define _TOOLS_LINUX_BITOPS_H_
33

4+
#include <asm/types.h>
45
#include <linux/kernel.h>
56
#include <linux/compiler.h>
6-
#include <asm/hweight.h>
77

88
#ifndef __WORDSIZE
99
#define __WORDSIZE (__SIZEOF_LONG__ * 8)
@@ -19,6 +19,11 @@
1919
#define BITS_TO_U32(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u32))
2020
#define BITS_TO_BYTES(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE)
2121

22+
extern unsigned int __sw_hweight8(unsigned int w);
23+
extern unsigned int __sw_hweight16(unsigned int w);
24+
extern unsigned int __sw_hweight32(unsigned int w);
25+
extern unsigned long __sw_hweight64(__u64 w);
26+
2227
/*
2328
* Include this here because some architectures need generic_ffs/fls in
2429
* scope

tools/perf/MANIFEST

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,24 @@ tools/lib/symbol/kallsyms.c
66
tools/lib/symbol/kallsyms.h
77
tools/lib/util/find_next_bit.c
88
tools/include/asm/bug.h
9+
tools/include/asm-generic/bitops/arch_hweight.h
910
tools/include/asm-generic/bitops/atomic.h
11+
tools/include/asm-generic/bitops/const_hweight.h
1012
tools/include/asm-generic/bitops/__ffs.h
1113
tools/include/asm-generic/bitops/__fls.h
1214
tools/include/asm-generic/bitops/find.h
1315
tools/include/asm-generic/bitops/fls64.h
1416
tools/include/asm-generic/bitops/fls.h
17+
tools/include/asm-generic/bitops/hweight.h
1518
tools/include/asm-generic/bitops.h
1619
tools/include/linux/bitops.h
1720
tools/include/linux/compiler.h
1821
tools/include/linux/export.h
1922
tools/include/linux/hash.h
2023
tools/include/linux/log2.h
2124
tools/include/linux/types.h
25+
include/asm-generic/bitops/arch_hweight.h
26+
include/asm-generic/bitops/const_hweight.h
2227
include/asm-generic/bitops/fls64.h
2328
include/asm-generic/bitops/__fls.h
2429
include/asm-generic/bitops/fls.h
@@ -29,6 +34,7 @@ include/linux/list.h
2934
include/linux/hash.h
3035
include/linux/stringify.h
3136
lib/find_next_bit.c
37+
lib/hweight.c
3238
lib/rbtree.c
3339
include/linux/swab.h
3440
arch/*/include/asm/unistd*.h

tools/perf/Makefile.perf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,15 @@ LIB_H += ../include/linux/hash.h
232232
LIB_H += ../../include/linux/stringify.h
233233
LIB_H += util/include/linux/bitmap.h
234234
LIB_H += ../include/linux/bitops.h
235+
LIB_H += ../include/asm-generic/bitops/arch_hweight.h
235236
LIB_H += ../include/asm-generic/bitops/atomic.h
237+
LIB_H += ../include/asm-generic/bitops/const_hweight.h
236238
LIB_H += ../include/asm-generic/bitops/find.h
237239
LIB_H += ../include/asm-generic/bitops/fls64.h
238240
LIB_H += ../include/asm-generic/bitops/fls.h
239241
LIB_H += ../include/asm-generic/bitops/__ffs.h
240242
LIB_H += ../include/asm-generic/bitops/__fls.h
243+
LIB_H += ../include/asm-generic/bitops/hweight.h
241244
LIB_H += ../include/asm-generic/bitops.h
242245
LIB_H += ../include/linux/compiler.h
243246
LIB_H += ../include/linux/log2.h
@@ -255,7 +258,6 @@ LIB_H += util/include/linux/linkage.h
255258
LIB_H += util/include/asm/asm-offsets.h
256259
LIB_H += ../include/asm/bug.h
257260
LIB_H += util/include/asm/byteorder.h
258-
LIB_H += util/include/asm/hweight.h
259261
LIB_H += util/include/asm/swab.h
260262
LIB_H += util/include/asm/system.h
261263
LIB_H += util/include/asm/uaccess.h
@@ -745,6 +747,9 @@ $(OUTPUT)util/kallsyms.o: ../lib/symbol/kallsyms.c $(OUTPUT)PERF-CFLAGS
745747
$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
746748
$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
747749

750+
$(OUTPUT)util/hweight.o: ../../lib/hweight.c $(OUTPUT)PERF-CFLAGS
751+
$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
752+
748753
$(OUTPUT)util/find_next_bit.o: ../lib/util/find_next_bit.c $(OUTPUT)PERF-CFLAGS
749754
$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
750755

tools/perf/util/hweight.c

Lines changed: 0 additions & 31 deletions
This file was deleted.

tools/perf/util/include/asm/hweight.h

Lines changed: 0 additions & 8 deletions
This file was deleted.

tools/perf/util/python-ext-sources

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ util/ctype.c
1010
util/evlist.c
1111
util/evsel.c
1212
util/cpumap.c
13-
util/hweight.c
13+
../../lib/hweight.c
1414
util/thread_map.c
1515
util/util.c
1616
util/xyarray.c

0 commit comments

Comments
 (0)