On Fri, Nov 19, 2021 at 7:33 PM Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote: > > From: Alexei Starovoitov <ast@xxxxxxxxxx> > > Make relo_core.c to be compiled for the kernel and for user space libbpf. > > Note the patch is reducing BPF_CORE_SPEC_MAX_LEN from 64 to 32. > This is the maximum number of nested structs and arrays. > For example: > struct sample { > int a; > struct { > int b[10]; > }; > }; > > struct sample *s = ...; > int y = &s->b[5]; > This field access is encoded as "0:1:0:5" and spec len is 4. > > The follow up patch might bump it back to 64. > > Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx> > --- Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > include/linux/btf.h | 81 +++++++++++++++++++++++++++++++++++++++ > kernel/bpf/Makefile | 4 ++ > kernel/bpf/btf.c | 26 +++++++++++++ > tools/lib/bpf/relo_core.c | 76 ++++++++++++++++++++++++++++++------ > 4 files changed, 176 insertions(+), 11 deletions(-) > [...]