Oracle Working On BPF CO-RE Support For GCC To Easily Run BPF Programs On Any Kernel
Running eBPF kernel programs continues to be increasing popular and used for a variety of use-cases in production environments but one of the challenges is around needing to compile the (e)BPF programs for a given kernel while BPF CO-RE has been working to change that. The LLVM Clang compiler already supports the ability for BPF "Compile Once, Run Everywhere" while now Oracle engineers are working to bring the same level of support to GCC.
BPF CO-RE aims to allow BPF programs to work across kernel versions and not needing to in turn have LLVM/Clang (or GCC) on each system nor the kernel headers for compiling BPF programs on-the-fly with the conventional approach. BPF CO-RE allows for adapting the program at load-time depending upon the kernel with dynamically adjusting for differences in the kernel data structures used. At compile-time additional information on the utilized kernel data structures is recorded so when loading at run-time on a different kernel that ideally the necessary changes can be made automatically.
LLVM Clang supports BPF CO-RE while Oracle's David Faust sent out a set of patches today for bringing up this "Compile Once, Run Everywhere" support for the GNU Compiler Collection's BPF back-end.
The proposed GCC patches for now can be found on the mailing list.
More information on BPF CO-RE in general can be found via this Facebook slide deck and the BPF blog.