[PATCH v4 00/18] perf clang: Builtin clang and perfhook support

From: Wang Nan
Date: Tue Dec 06 2016 - 02:31:48 EST


This is version 4 of perf builtin clang and perfhook patch series.

In this patch set:
1. Cleanup options passed to clang.
2. Check LLVM version. Fail if llvm version < 3.9.0, and
warn when it > 3.9.0. More version will be allowed after
releasing of LLVM 3.9.1 / 4.0.0.
3. Support dynamic linking LLVM and clang libraries.
4. Rebase to Arnaldo's newest perf/core.

Wang Nan (18):
perf build: Check LLVM version in feature check
perf build: Support dynamic linking clang libraries
perf clang: Cleanup clang options
perf clang: Pass full path to builtin clang
perf clang: Pass CFLAGS to builtin clang
perf clang jit: Wrap llvm::Module using PerfModule
perf clang jit: Insignt BPF and JIT functions in a Module
perf clang jit: add PerfModule::doJIT to JIT perfhook functions
perf clang jit: Export functions for jitted code
perf clang jit: Actually JIT and hook in bpf loader
perf clang jit: Collect the lowest address in maps section as map_base
perf clang jit: Retrive fd of BPF map from its offset
perf clang jit: Allow jitted perf hook access BPF maps
perf clang: Link BPF functions declaration into perf
perf clang: Declare BPF functions for BPF scripts automatically
perf clang: Include helpers to BPF scripts
perf clang builtin: Define hook helpers by default
perf clang jit: Export getpid() to perf hook

tools/build/feature/Makefile | 8 +-
tools/build/feature/test-llvm-version.cpp | 12 +
tools/build/feature/test-llvm.cpp | 5 +
tools/perf/Makefile.config | 8 +-
tools/perf/Makefile.perf | 20 +-
tools/perf/tests/Build | 2 +-
tools/perf/tests/bpf-script-example.c | 30 ++-
tools/perf/tests/bpf-script-test-kbuild.c | 2 +
tools/perf/tests/bpf-script-test-prologue.c | 6 +-
tools/perf/tests/bpf-script-test-relocation.c | 17 +-
tools/perf/tests/clang.c | 4 +
tools/perf/util/Build | 1 +
tools/perf/util/bpf-loader.c | 85 ++++++-
tools/perf/util/bpf-loader.h | 19 ++
tools/perf/util/c++/Build | 2 +
tools/perf/util/c++/bpf-funcs-str.c | 49 ++++
tools/perf/util/c++/bpf-helper-str.c | 23 ++
tools/perf/util/c++/clang-bpf-includes.h | 13 +
tools/perf/util/c++/clang-c.h | 24 +-
tools/perf/util/c++/clang-test.cpp | 51 +++-
tools/perf/util/c++/clang.cpp | 335 ++++++++++++++++++++++++--
tools/perf/util/c++/clang.h | 47 +++-
tools/perf/util/jit-helpers.c | 57 +++++
tools/perf/util/jit-helpers.h | 28 +++
tools/perf/util/llvm-utils.h | 9 +-
25 files changed, 802 insertions(+), 55 deletions(-)
create mode 100644 tools/build/feature/test-llvm-version.cpp
create mode 100644 tools/perf/util/c++/bpf-funcs-str.c
create mode 100644 tools/perf/util/c++/bpf-helper-str.c
create mode 100644 tools/perf/util/c++/clang-bpf-includes.h
create mode 100644 tools/perf/util/jit-helpers.c
create mode 100644 tools/perf/util/jit-helpers.h

Signed-off-by: Wang Nan <wangnan0@xxxxxxxxxx>
Cc: Alexei Starovoitov <ast@xxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: He Kuang <hekuang@xxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Joe Stringer <joe@xxxxxxx>
Cc: Zefan Li <lizefan@xxxxxxxxxx>
Cc: pi3orama@xxxxxxx
--
2.10.1