diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-10-30 10:09:37 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-10-30 10:09:37 +0100 |
commit | bebd23a2ed31d47e7dd746d3b125068aa2c42d85 (patch) | |
tree | 81cc1a59203c393286dba3e76daa343f5c35b127 /tools/perf/util/bpf-loader.c | |
parent | 66a565c203bc31b76969711fbd92da11bee2f129 (diff) | |
parent | 7ed4915ad60788d6b846e2cd034f49ee15698143 (diff) |
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
New features:
- Allow passing C language eBPF scriptlets via --event in all tools,
so that it gets built using clang and then pass it to the kernel via
sys_bpf(). (Wang Nan)
- Wire up the loaded ebpf object file with associated kprobes, so that
it can determine if the kprobes will be filtered or not. (Wang Nan)
User visible changes:
- Add cmd string table to decode sys_bpf first arg in 'trace'. (Arnaldo Carvalho de Melo)
- Enable printing of branch stack in 'perf script'. (Stephane Eranian)
- Pass the right file with debug info to libunwind. (Rabin Vincent)
Build Fixes:
- Make sure fixdep is built before libbpf, fixing a race. (Jiri Olsa)
- Fix libiberty feature detection. (Rabin Vincent)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/bpf-loader.c')
-rw-r--r-- | tools/perf/util/bpf-loader.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c index aa784a498c48..ba6f7526b282 100644 --- a/tools/perf/util/bpf-loader.c +++ b/tools/perf/util/bpf-loader.c @@ -12,6 +12,7 @@ #include "bpf-loader.h" #include "probe-event.h" #include "probe-finder.h" // for MAX_PROBES +#include "llvm-utils.h" #define DEFINE_PRINT_FN(name, level) \ static int libbpf_##name(const char *fmt, ...) \ @@ -33,7 +34,7 @@ struct bpf_prog_priv { struct perf_probe_event pev; }; -struct bpf_object *bpf__prepare_load(const char *filename) +struct bpf_object *bpf__prepare_load(const char *filename, bool source) { struct bpf_object *obj; static bool libbpf_initialized; @@ -45,7 +46,19 @@ struct bpf_object *bpf__prepare_load(const char *filename) libbpf_initialized = true; } - obj = bpf_object__open(filename); + if (source) { + int err; + void *obj_buf; + size_t obj_buf_sz; + + err = llvm__compile_bpf(filename, &obj_buf, &obj_buf_sz); + if (err) + return ERR_PTR(err); + obj = bpf_object__open_buffer(obj_buf, obj_buf_sz, filename); + free(obj_buf); + } else + obj = bpf_object__open(filename); + if (!obj) { pr_debug("bpf: failed to load %s\n", filename); return ERR_PTR(-EINVAL); |