diff options
author | Wang Nan <wangnan0@huawei.com> | 2015-06-11 13:31:09 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-08-07 16:16:59 +0300 |
commit | 4cea3a9cb30a962fa759fcb081fb83351113d9c4 (patch) | |
tree | 6eaae7b42e635694a375afd719c32f9a2f0f5a04 /tools/perf/util/llvm-utils.h | |
parent | aa61fd05ca79666c973d5b15e0f91ecdc7dcfa21 (diff) | |
download | linux-4cea3a9cb30a962fa759fcb081fb83351113d9c4.tar.xz |
perf tools: Call clang to compile C source to object code
This is the core patch for supporting eBPF on-the-fly compiling, does
the following work:
1. Search clang compiler using search_program().
2. Run command template defined in llvm-bpf-cmd-template option in
[llvm] config section using read_from_pipe(). Patch of clang and
source code path is injected into shell command using environment
variable using force_set_env().
Commiter notice:
When building with DEBUG=1 we get a compiler error that gets fixed with
the same approach described in commit b236512280fb:
perf kmem: Fix compiler warning about may be accessing uninitialized variable
The last argument to strtok_r doesn't need to be initialized, its
just a placeholder to make this routine reentrant, but gcc doesn't know
about that and complains, breaking the build, fix it by setting it to
NULL.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David Ahern <dsahern@gmail.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kaixu Xia <xiakaixu@huawei.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/n/1436445342-1402-14-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/llvm-utils.h')
-rw-r--r-- | tools/perf/util/llvm-utils.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/perf/util/llvm-utils.h b/tools/perf/util/llvm-utils.h index 504b799687fb..d23adbca120b 100644 --- a/tools/perf/util/llvm-utils.h +++ b/tools/perf/util/llvm-utils.h @@ -33,4 +33,7 @@ struct llvm_param { extern struct llvm_param llvm_param; extern int perf_llvm_config(const char *var, const char *value); + +extern int llvm__compile_bpf(const char *path, void **p_obj_buf, + size_t *p_obj_buf_sz); #endif |