On Tue, Oct 15, 2019 at 2:26 PM Andrii Nakryiko <andriin@xxxxxx> wrote: > > This patch set generalizes libbpf's CO-RE relocation support. In addition to > existing field's byte offset relocation, libbpf now supports field existence > relocations, which are emitted by Clang when using > __builtin_preserve_field_info(<field>, BPF_FIELD_EXISTS). A convenience > bpf_core_field_exists() macro is added to bpf_core_read.h BPF-side header, > along the bpf_field_info_kind enum containing currently supported types of > field information libbpf supports. This list will grow as libbpf gains support > for other relo kinds. > > This patch set upgrades the format of .BTF.ext's relocation record to match > latest Clang's format (12 -> 16 bytes). This is not a breaking change, as the > previous format hasn't been released yet as part of official Clang version > release. > > v1->v2: > - unify bpf_field_info_kind enum and naming changes (Alexei); > - added bpf_core_field_exists() to bpf_core_read.h. I'm not excited about duplicated enum definition for libbpf internal and bpf prog purpose, but it's a lesser evil. If we do new .h now to be shared between bpf progs and libbpf it could be too early in release cycle. Both libbpf and llvm side may still change. So let's make a note to clean it up later when we're sure on numbers and whether numbers will indeed be the same in .btf.ext and in what bpf prog passes to llvm. Applied to bpf-next. Thanks