summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/llvm-utils.h
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2016-11-26 08:03:30 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-12-05 19:51:42 +0100
commit2bd42de0e196f89994cbae1990d2c7c5a9b6a529 (patch)
tree38f5ca69a0cd1f64eb89715d6a1933eb5c63ee6c /tools/perf/util/llvm-utils.h
parentperf tools: Pass context to perf hook functions (diff)
downloadlinux-2bd42de0e196f89994cbae1990d2c7c5a9b6a529.tar.xz
linux-2bd42de0e196f89994cbae1990d2c7c5a9b6a529.zip
perf llvm: Extract helpers in llvm-utils.c
The following commits will use builtin clang to compile BPF scripts. llvm__get_kbuild_opts() and llvm__get_nr_cpus() are extracted to help building '-DKERNEL_VERSION_CODE' and '-D__NR_CPUS__' macros. Doing object dumping in bpf loader, so further builtin clang compiling needn't consider it. Signed-off-by: Wang Nan <wangnan0@huawei.com> Cc: Alexei Starovoitov <ast@fb.com> Cc: He Kuang <hekuang@huawei.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Joe Stringer <joe@ovn.org> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/20161126070354.141764-7-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.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/perf/util/llvm-utils.h b/tools/perf/util/llvm-utils.h
index 9f501cef06a1..c87a2a92a88f 100644
--- a/tools/perf/util/llvm-utils.h
+++ b/tools/perf/util/llvm-utils.h
@@ -50,4 +50,10 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf, size_t *p_obj_buf_sz);
/* This function is for test__llvm() use only */
int llvm__search_clang(void);
+
+/* Following functions are reused by builtin clang support */
+void llvm__get_kbuild_opts(char **kbuild_dir, char **kbuild_include_opts);
+int llvm__get_nr_cpus(void);
+
+void llvm__dump_obj(const char *path, void *obj_buf, size_t size);
#endif