diff options
author | Stephane Eranian <eranian@google.com> | 2015-09-01 05:30:14 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-09-01 12:04:41 -0400 |
commit | af4aeadd8c04303c0aa2d112145c3627e2ebd026 (patch) | |
tree | 569c570d011874e21ff08843e223763338ffdf38 | |
parent | 04aa90b529ee45c5ee88997bc214202e07b26979 (diff) |
perf tools: Fix link time error with sample_reg_masks on non x86
This patch makes perf compile on non x86 platforms by defining a weak
symbol for sample_reg_masks[] in util/perf_regs.c.
The patch also moves the REG() and REG_END() macros into the
util/per_regs.h header file. The macros are renamed to
SMPL_REG/SMPL_REG_END to avoid clashes with other header files.
Signed-off-by: Stephane Eranian <eranian@google.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1441099814-26783-1-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/arch/x86/util/perf_regs.c | 44 | ||||
-rw-r--r-- | tools/perf/util/perf_regs.c | 4 | ||||
-rw-r--r-- | tools/perf/util/perf_regs.h | 2 |
3 files changed, 27 insertions, 23 deletions
diff --git a/tools/perf/arch/x86/util/perf_regs.c b/tools/perf/arch/x86/util/perf_regs.c index 087c84ef5234..c5db14f36cc7 100644 --- a/tools/perf/arch/x86/util/perf_regs.c +++ b/tools/perf/arch/x86/util/perf_regs.c | |||
@@ -1,30 +1,28 @@ | |||
1 | #include "../../perf.h" | 1 | #include "../../perf.h" |
2 | #include "../../util/perf_regs.h" | 2 | #include "../../util/perf_regs.h" |
3 | 3 | ||
4 | #define REG(n, b) { .name = #n, .mask = 1ULL << (b) } | ||
5 | #define REG_END { .name = NULL } | ||
6 | const struct sample_reg sample_reg_masks[] = { | 4 | const struct sample_reg sample_reg_masks[] = { |
7 | REG(AX, PERF_REG_X86_AX), | 5 | SMPL_REG(AX, PERF_REG_X86_AX), |
8 | REG(BX, PERF_REG_X86_BX), | 6 | SMPL_REG(BX, PERF_REG_X86_BX), |
9 | REG(CX, PERF_REG_X86_CX), | 7 | SMPL_REG(CX, PERF_REG_X86_CX), |
10 | REG(DX, PERF_REG_X86_DX), | 8 | SMPL_REG(DX, PERF_REG_X86_DX), |
11 | REG(SI, PERF_REG_X86_SI), | 9 | SMPL_REG(SI, PERF_REG_X86_SI), |
12 | REG(DI, PERF_REG_X86_DI), | 10 | SMPL_REG(DI, PERF_REG_X86_DI), |
13 | REG(BP, PERF_REG_X86_BP), | 11 | SMPL_REG(BP, PERF_REG_X86_BP), |
14 | REG(SP, PERF_REG_X86_SP), | 12 | SMPL_REG(SP, PERF_REG_X86_SP), |
15 | REG(IP, PERF_REG_X86_IP), | 13 | SMPL_REG(IP, PERF_REG_X86_IP), |
16 | REG(FLAGS, PERF_REG_X86_FLAGS), | 14 | SMPL_REG(FLAGS, PERF_REG_X86_FLAGS), |
17 | REG(CS, PERF_REG_X86_CS), | 15 | SMPL_REG(CS, PERF_REG_X86_CS), |
18 | REG(SS, PERF_REG_X86_SS), | 16 | SMPL_REG(SS, PERF_REG_X86_SS), |
19 | #ifdef HAVE_ARCH_X86_64_SUPPORT | 17 | #ifdef HAVE_ARCH_X86_64_SUPPORT |
20 | REG(R8, PERF_REG_X86_R8), | 18 | SMPL_REG(R8, PERF_REG_X86_R8), |
21 | REG(R9, PERF_REG_X86_R9), | 19 | SMPL_REG(R9, PERF_REG_X86_R9), |
22 | REG(R10, PERF_REG_X86_R10), | 20 | SMPL_REG(R10, PERF_REG_X86_R10), |
23 | REG(R11, PERF_REG_X86_R11), | 21 | SMPL_REG(R11, PERF_REG_X86_R11), |
24 | REG(R12, PERF_REG_X86_R12), | 22 | SMPL_REG(R12, PERF_REG_X86_R12), |
25 | REG(R13, PERF_REG_X86_R13), | 23 | SMPL_REG(R13, PERF_REG_X86_R13), |
26 | REG(R14, PERF_REG_X86_R14), | 24 | SMPL_REG(R14, PERF_REG_X86_R14), |
27 | REG(R15, PERF_REG_X86_R15), | 25 | SMPL_REG(R15, PERF_REG_X86_R15), |
28 | #endif | 26 | #endif |
29 | REG_END | 27 | SMPL_REG_END |
30 | }; | 28 | }; |
diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c index 43168fb0d9a2..885e8ac83997 100644 --- a/tools/perf/util/perf_regs.c +++ b/tools/perf/util/perf_regs.c | |||
@@ -2,6 +2,10 @@ | |||
2 | #include "perf_regs.h" | 2 | #include "perf_regs.h" |
3 | #include "event.h" | 3 | #include "event.h" |
4 | 4 | ||
5 | const struct sample_reg __weak sample_reg_masks[] = { | ||
6 | SMPL_REG_END | ||
7 | }; | ||
8 | |||
5 | int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) | 9 | int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) |
6 | { | 10 | { |
7 | int i, idx = 0; | 11 | int i, idx = 0; |
diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h index 92c1fff2153e..2984dcc54d67 100644 --- a/tools/perf/util/perf_regs.h +++ b/tools/perf/util/perf_regs.h | |||
@@ -9,6 +9,8 @@ struct sample_reg { | |||
9 | const char *name; | 9 | const char *name; |
10 | uint64_t mask; | 10 | uint64_t mask; |
11 | }; | 11 | }; |
12 | #define SMPL_REG(n, b) { .name = #n, .mask = 1ULL << (b) } | ||
13 | #define SMPL_REG_END { .name = NULL } | ||
12 | 14 | ||
13 | extern const struct sample_reg sample_reg_masks[]; | 15 | extern const struct sample_reg sample_reg_masks[]; |
14 | 16 | ||