Re: [PATCH] perf record: Limit --intr-regs to platforms supporting PERF_REGS

From: Jiri Olsa
Date: Thu Sep 24 2015 - 08:57:13 EST


On Thu, Sep 24, 2015 at 05:41:58PM +0530, Naveen N. Rao wrote:
> perf build currently fails on powerpc:
>
> LINK perf
> libperf.a(libperf-in.o):(.toc+0x120): undefined reference to
> `sample_reg_masks'
> libperf.a(libperf-in.o):(.toc+0x130): undefined reference to
> `sample_reg_masks'
> collect2: error: ld returned 1 exit status
> make[1]: *** [perf] Error 1
> make: *** [all] Error 2
>
> This is due to parse-regs-options.c using sample_reg_masks, which is
> defined only with CONFIG_PERF_REGS.
>
> In addition, perf record -I is only useful if the arch supports
> PERF_REGS. Hence, let's expose -I conditionally.
>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@xxxxxxxxxxxxxxxxxx>

hum, I wonder why we have sample_reg_masks defined as weak in util/perf_regs.c
which is also built only via CONFIG_PERF_REGS

I wonder we could get rid of the weak definition via attached patch, Stephane?


anyway this looks ok

Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>

thanks,
jirka


---
diff --git a/tools/perf/arch/x86/util/Build b/tools/perf/arch/x86/util/Build
index ff63649fa9ac..e5627b3d1bb8 100644
--- a/tools/perf/arch/x86/util/Build
+++ b/tools/perf/arch/x86/util/Build
@@ -2,7 +2,7 @@ libperf-y += header.o
libperf-y += tsc.o
libperf-y += pmu.o
libperf-y += kvm-stat.o
-libperf-y += perf_regs.o
+libperf-$(CONFIG_PERF_REGS) += perf_regs.o

libperf-$(CONFIG_DWARF) += dwarf-regs.o

diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c
index 885e8ac83997..43168fb0d9a2 100644
--- a/tools/perf/util/perf_regs.c
+++ b/tools/perf/util/perf_regs.c
@@ -2,10 +2,6 @@
#include "perf_regs.h"
#include "event.h"

-const struct sample_reg __weak sample_reg_masks[] = {
- SMPL_REG_END
-};
-
int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
{
int i, idx = 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/