Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932920AbbFJANq (ORCPT ); Tue, 9 Jun 2015 20:13:46 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:62992 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752246AbbFJANi (ORCPT ); Tue, 9 Jun 2015 20:13:38 -0400 Message-ID: <55777F79.2080605@huawei.com> Date: Wed, 10 Jun 2015 08:06:17 +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: Alexei Starovoitov , , , , , , , , , , CC: , , , , Subject: Re: [RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event References: <1433829036-23687-1-git-send-email-wangnan0@huawei.com> <1433829036-23687-25-git-send-email-wangnan0@huawei.com> <55775F3A.9080204@plumgrid.com> In-Reply-To: <55775F3A.9080204@plumgrid.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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2347 Lines: 75 On 2015/6/10 5:48, Alexei Starovoitov wrote: > On 6/8/15 10:50 PM, Wang Nan wrote: >> +struct bpf_param bpf_param = { >> + .clang_path = "clang", >> + .llc_path = "llc", >> + .clang_opt = "", >> + .llc_opt = "", >> +}; > > the defaults are ok-ish, but llc is never in PATH. > So most likely it won't work out of the box. > I think the cleanest option is too wait a little bit > until we finish clang integration. > (hopefully few more days) > > we've quite been busy on llvm side > and I'm excited to announce that BPF backend finally > graduated from experimental. > So now anyone can just pull the latest llvm and > bpf will be present by default. > No more cmake -DLLVM_EXPERIMENTAL... > > Once clang integration is complete. One can pull > upsteam llvm and clang and just use 'clang -O2 -c -march=bpf file.c' > Good news, so llc part should be removed. Next version I'd like to use following config options: [llvm] clang-bpf-cmd-template = "$CLANG_EXEC $CLANG_OPTIONS -c $CLANG_SOURCE -emit-llvm -O2 -o - | /path/to/llc -march=bpf -filetype=obj -o -" clang-path = "/path/to/clang" clang-opt = "" And the default template should be: $CLANG_EXEC $CLANG_OPTIONS -c "$CLANG_SOURCE" -emit-llvm -O2 -o - Then with environment variable tricks we make it work with popen. By this way we can get rid of llc in perf side, and make it work even before clang integration is complete. Thank you. >> + err = WEXITSTATUS(pclose(file)); >> + if (err || read_sz <= 0) { >> + err = -EINVAL; >> + pr_err("Error:\tsomething went wrong when compiling %s\n", >> + filename); >> + pr_err("Hint:\tTry manually run following command and >> check:\n"); >> + pr_err(" # " CMD_FMT "\n\n", >> + clang_path, bpf_param.clang_opt, filename, >> + llc_path, bpf_param.llc_opt, "/dev/null"); > > not terribly informative hint. > I think would be good to point to some readme or at least mention > that only the latest clang/llvm support bpf. > Either svn/git trunk or upcoming 3.7 > May be a link to llvm.org? > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/