lkml.org 
[lkml]   [2015]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] perf record: Limit --intr-regs to platforms supporting PERF_REGS
On Thu, Sep 24, 2015 at 08:32:12AM -0700, Stephane Eranian wrote:
> On Thu, Sep 24, 2015 at 5:57 AM, Jiri Olsa <jolsa@redhat.com> wrote:
> >
> > 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@linux.vnet.ibm.com>
> >
> > 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?
> >
> But the whole point of having it weak is to avoid this error scenario
> on any arch without support
> and avoid ugly #ifdef HAVE_ in generic files.
>
> if perf_regs.c is compiled on PPC, then why do we get the undefined?

sample_reg_masks is touched via parse-regs-options.c as well
and perf_regs.o depends on CONFIG_PERF_REGS

so with keeping the weak deffinition, how about attached change

jirka


---
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 142eeb341b29..19c8fd22fbe3 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1082,9 +1082,11 @@ struct option __record_options[] = {
"sample transaction flags (special events only)"),
OPT_BOOLEAN(0, "per-thread", &record.opts.target.per_thread,
"use per-thread mmaps"),
+#ifdef HAVE_PERF_REGS_SUPPORT
OPT_CALLBACK_OPTARG('I', "intr-regs", &record.opts.sample_intr_regs, NULL, "any register",
"sample selected machine registers on interrupt,"
" use -I ? to list register names", parse_regs),
+#endif
OPT_BOOLEAN(0, "running-time", &record.opts.running_time,
"Record running/enabled time of read (:S) events"),
OPT_CALLBACK('k', "clockid", &record.opts,
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 4bc7a9ab45b1..93c6371405a3 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -104,7 +104,7 @@ libperf-$(CONFIG_LIBBABELTRACE) += data-convert-bt.o

libperf-y += scripting-engines/

-libperf-$(CONFIG_PERF_REGS) += perf_regs.o
+libperf-y += perf_regs.o
libperf-$(CONFIG_ZLIB) += zlib.o
libperf-$(CONFIG_LZMA) += lzma.o


\
 
 \ /
  Last update: 2015-09-24 18:21    [W:0.059 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site