perf bpf: Add bpf.h to be used in eBPF proggies
authorArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 4 May 2018 15:23:29 +0000 (12:23 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 15 May 2018 17:31:23 +0000 (14:31 -0300)
commitdd8e4ead6e983acea959d10252688ef1471106fe
treed5bd2697f2da73fe19477a08694cf0148ab0db52
parent8f12a2ff00e5e48ad5618167bac72cad7c9f214e
perf bpf: Add bpf.h to be used in eBPF proggies

So, the first helper is the one shortening a variable/function section
attribute, from, for instance:

  char _license[] __attribute__((section("license"), used)) = "GPL";

to:

  char _license[] SEC("license") = "GPL";

Convert empty.c to that and it becomes:

  # cat ~acme/lib/examples/perf/bpf/empty.c
  #include <bpf.h>

  char _license[] SEC("license") = "GPL";
  int _version SEC("version") = LINUX_VERSION_CODE;
  #

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-zmeg52dlvy51rdlhyumfl5yf@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/Makefile.perf
tools/perf/examples/bpf/empty.c
tools/perf/include/bpf/bpf.h [new file with mode: 0644]