Re: [RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-11 Thread Alexei Starovoitov
On 6/11/15 12:35 AM, Wangnan (F) wrote: Now I'm trying this: "$CLANG_EXEC $CLANG_OPTIONS $KERNEL_INC_OPTIONS " "-Wno-unused-value -Wno-pointer-sign " "-working-directory $WORKING_DIR " " -c \"$CLANG_SOURCE\" -march=bpf -O2 -o -" WORKING_DIR is appended because we

Re: [RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-11 Thread Wangnan (F)
On 2015/6/11 15:19, Namhyung Kim wrote: Hi Wang, On Wed, Jun 10, 2015 at 08:06:17AM +0800, Wangnan (F) wrote: On 2015/6/10 5:48, Alexei Starovoitov wrote: 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

Re: [RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-11 Thread Namhyung Kim
Hi Wang, On Wed, Jun 10, 2015 at 08:06:17AM +0800, Wangnan (F) wrote: > On 2015/6/10 5:48, Alexei Starovoitov wrote: > >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. > >

Re: [RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-11 Thread Namhyung Kim
Hi Wang, On Wed, Jun 10, 2015 at 08:06:17AM +0800, Wangnan (F) wrote: On 2015/6/10 5:48, Alexei Starovoitov wrote: 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

Re: [RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-11 Thread Wangnan (F)
On 2015/6/11 15:19, Namhyung Kim wrote: Hi Wang, On Wed, Jun 10, 2015 at 08:06:17AM +0800, Wangnan (F) wrote: On 2015/6/10 5:48, Alexei Starovoitov wrote: 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

Re: [RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-11 Thread Alexei Starovoitov
On 6/11/15 12:35 AM, Wangnan (F) wrote: Now I'm trying this: $CLANG_EXEC $CLANG_OPTIONS $KERNEL_INC_OPTIONS -Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c \$CLANG_SOURCE\ -march=bpf -O2 -o - WORKING_DIR is appended because we will get

Re: [RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-09 Thread Alexei Starovoitov
On 6/9/15 5:06 PM, Wangnan (F) wrote: 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

Re: [RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-09 Thread Wangnan (F)
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

Re: [RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-09 Thread Alexei Starovoitov
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

Re: [RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-09 Thread Wangnan (F)
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

Re: [RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-09 Thread Alexei Starovoitov
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

Re: [RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-09 Thread Alexei Starovoitov
On 6/9/15 5:06 PM, Wangnan (F) wrote: 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

[RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-08 Thread Wang Nan
This patch enables passing source files to --event directly using: # perf record --event bpf-file.c command This patch does following works: 1) 'struct bpf_param' is introduced to store compiler related options; 2) bpf__compile() is introduced for compiling source code by calling clang

[RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-08 Thread Wang Nan
This patch enables passing source files to --event directly using: # perf record --event bpf-file.c command This patch does following works: 1) 'struct bpf_param' is introduced to store compiler related options; 2) bpf__compile() is introduced for compiling source code by calling clang