From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756934AbbIXRfo (ORCPT ); Thu, 24 Sep 2015 13:35:44 -0400 Received: from e28smtp02.in.ibm.com ([122.248.162.2]:45344 "EHLO e28smtp02.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756385AbbIXRfm (ORCPT ); Thu, 24 Sep 2015 13:35:42 -0400 X-Helo: d28dlp02.in.ibm.com X-MailFrom: naveen.n.rao@linux.vnet.ibm.com X-RcptTo: linux-kernel@vger.kernel.org Date: Thu, 24 Sep 2015 22:15:54 +0530 From: "Naveen N. Rao" To: Stephane Eranian Cc: Jiri Olsa , Arnaldo Carvalho de Melo , LKML , "mingo@redhat.com" Subject: Re: [PATCH] perf record: Limit --intr-regs to platforms supporting PERF_REGS Message-ID: <20150924164554.GA11493@naverao1-tp.in.ibm.com> References: <1443096718-11926-1-git-send-email-naveen.n.rao@linux.vnet.ibm.com> <20150924125703.GA11857@krava.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15092417-0005-0000-0000-000007B4BA01 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015/09/24 08:32AM, Stephane Eranian wrote: > On Thu, Sep 24, 2015 at 5:57 AM, Jiri Olsa 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 > > > > 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? As Jiri Olsa pointed out, powerpc and many other architectures don't (yet) have support for perf regs. But, the larger reason to introduce #ifdef is so the user doesn't see options (s)he can't use on a specific architecture, along the same lines as builtin-probe.c Regards, Naveen