mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 07:01:23 +00:00
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>
This commit is contained in:
parent
8ad85e9e6f
commit
2bd42de0e1
3 changed files with 68 additions and 18 deletions
|
@ -90,6 +90,10 @@ struct bpf_object *bpf__prepare_load(const char *filename, bool source)
|
|||
if (err)
|
||||
return ERR_PTR(-BPF_LOADER_ERRNO__COMPILE);
|
||||
obj = bpf_object__open_buffer(obj_buf, obj_buf_sz, filename);
|
||||
|
||||
if (!IS_ERR(obj) && llvm_param.dump_obj)
|
||||
llvm__dump_obj(filename, obj_buf, obj_buf_sz);
|
||||
|
||||
free(obj_buf);
|
||||
} else
|
||||
obj = bpf_object__open(filename);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue