Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bpf: Add typecast to raw_tracepoints to help BTF generation

When pahole converts dwarf to btf it emits only used types.
Wrap existing __bpf_trace_##template() function into
btf_trace_##template typedef and use it in type cast to
make gcc emits this type into dwarf. Then pahole will convert it to btf.
The "btf_trace_" prefix will be used to identify BTF enabled raw tracepoints.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20191016032505.2089704-2-ast@kernel.org

authored by

Alexei Starovoitov and committed by
Daniel Borkmann
e8c423fb eac9153f

+2 -1
+2 -1
include/trace/bpf_probe.h
··· 74 74 { \ 75 75 check_trace_callback_type_##call(__bpf_trace_##template); \ 76 76 } \ 77 + typedef void (*btf_trace_##call)(void *__data, proto); \ 77 78 static struct bpf_raw_event_map __used \ 78 79 __attribute__((section("__bpf_raw_tp_map"))) \ 79 80 __bpf_trace_tp_map_##call = { \ 80 81 .tp = &__tracepoint_##call, \ 81 - .bpf_func = (void *)__bpf_trace_##template, \ 82 + .bpf_func = (void *)(btf_trace_##call)__bpf_trace_##template, \ 82 83 .num_args = COUNT_ARGS(args), \ 83 84 .writable_size = size, \ 84 85 };