From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932515AbbFINnS (ORCPT ); Tue, 9 Jun 2015 09:43:18 -0400 Received: from [119.145.14.66] ([119.145.14.66]:52145 "EHLO szxga03-in.huawei.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751582AbbFINnG (ORCPT ); Tue, 9 Jun 2015 09:43:06 -0400 Message-ID: <5576EADF.1030902@huawei.com> Date: Tue, 9 Jun 2015 21:32:15 +0800 From: "Wangnan (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: , , , , , , , , , , CC: , , , , Subject: Re: [RFC PATCH v6 32/32] perf record: Add LLVM options for compiling BPF scripts References: <1433829036-23687-1-git-send-email-wangnan0@huawei.com> <1433829036-23687-33-git-send-email-wangnan0@huawei.com> In-Reply-To: <1433829036-23687-33-git-send-email-wangnan0@huawei.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.5576ED30.0129,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 0b82d47b855240d5437d963936c88e16 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015/6/9 13:50, Wang Nan wrote: > Although previous patch allows setting BPF compiler related options in > perfconfig, on some ad-hoc situation it still requires passing options > through cmdline. This patch introduces 4 options to 'perf record' for > this propose: --clang-path, --clang-opt, --llc-path and --llc-opt. > > Signed-off-by: Wang Nan > --- > tools/perf/builtin-record.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c > index 235c3d9..ad5892e 100644 > --- a/tools/perf/builtin-record.c > +++ b/tools/perf/builtin-record.c > @@ -1070,6 +1070,14 @@ struct option __record_options[] = { > parse_clockid), > OPT_STRING_OPTARG('S', "snapshot", &record.opts.auxtrace_snapshot_opts, > "opts", "AUX area tracing Snapshot Mode", ""), > + OPT_STRING(0, "clang-path", &bpf_param.clang_path, "clang patch", > + "clang binary to use for compiling BPF scriptlets"), > + OPT_STRING(0, "clang-opt", &bpf_param.clang_opt, "clang options", > + "options passed to clang when compiling BPF scriptlets"), > + OPT_STRING(0, "llc-path", &bpf_param.llc_path, "llc path", > + "llc binary to use for compiling BPF scriptlets"), > + OPT_STRING(0, "llc-opt", &bpf_param.llc_opt, "llc opt", > + "options passed to llc when compiling BPF scriptlets"), > OPT_END() > }; > These 4 options should be wrapped inside "#ifdef HAVE_LIBBPF_SUPPORT" because it requires bpf_param which won't be compiled if HAVE_LIBBPF_SUPPORT is set. Another choice should be introducing something like tools/perf/utils/llvm.c and putting all llvm related things into it. If other part of perf also use llvm, making a new file to hold those options should be a better way.