Skip to content

Commit 9fb4765

Browse files
Sukadev Bhattiproluacmel
authored andcommitted
perf tools: Fix build break on powerpc due to sample_reg_masks
perf_regs.c does not get built on Powerpc as CONFIG_PERF_REGS is false. So the weak definition for 'sample_regs_masks' doesn't get picked up. Adding perf_regs.o to util/Build unconditionally, exposes a redefinition error for 'perf_reg_value()' function (due to the static inline version in util/perf_regs.h). So use #ifdef HAVE_PERF_REGS_SUPPORT' around that function. Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Cc: Stephane Eranian <eranian@google.com> Cc: linuxppc-dev@ozlabs.org Link: http://lkml.kernel.org/r/20150930182836.GA27858@us.ibm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 097f70b commit 9fb4765

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

tools/perf/util/Build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ libperf-y += levenshtein.o
1717
libperf-y += llvm-utils.o
1818
libperf-y += parse-options.o
1919
libperf-y += parse-events.o
20+
libperf-y += perf_regs.o
2021
libperf-y += path.o
2122
libperf-y += rbtree.o
2223
libperf-y += bitmap.o
@@ -103,7 +104,6 @@ libperf-$(CONFIG_LIBBABELTRACE) += data-convert-bt.o
103104

104105
libperf-y += scripting-engines/
105106

106-
libperf-$(CONFIG_PERF_REGS) += perf_regs.o
107107
libperf-$(CONFIG_ZLIB) += zlib.o
108108
libperf-$(CONFIG_LZMA) += lzma.o
109109

tools/perf/util/perf_regs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const struct sample_reg __weak sample_reg_masks[] = {
66
SMPL_REG_END
77
};
88

9+
#ifdef HAVE_PERF_REGS_SUPPORT
910
int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
1011
{
1112
int i, idx = 0;
@@ -29,3 +30,4 @@ int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
2930
*valp = regs->cache_regs[id];
3031
return 0;
3132
}
33+
#endif

tools/perf/util/perf_regs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define __PERF_REGS_H
33

44
#include <linux/types.h>
5+
#include <linux/compiler.h>
56

67
struct regs_dump;
78

0 commit comments

Comments
 (0)