]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - tools/perf/util/llvm-utils.c
perf tools: Call clang to compile C source to object code
authorWang Nan <wangnan0@huawei.com>
Thu, 11 Jun 2015 10:31:09 +0000 (10:31 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 7 Aug 2015 13:16:59 +0000 (10:16 -0300)
commit4cea3a9cb30a962fa759fcb081fb83351113d9c4
tree6eaae7b42e635694a375afd719c32f9a2f0f5a04
parentaa61fd05ca79666c973d5b15e0f91ecdc7dcfa21
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>
tools/perf/util/llvm-utils.c
tools/perf/util/llvm-utils.h