Speaker
Description
Writing BPF programs in the long past meant wrestling with Linux kernel version fragmentation. That problem was solved, many years ago, thanks to CO-RE (Compile Once, Run Everywhere) relocations. CO-RE is a mechanism that uses the BTF type format and its relocation entries (BTF.ext) to handle layout differences, by patching the loaded BPF bytecode with correct offsets that match the running kernel version.
However, as of today, only C compilers (Clang, GCC) are able to emit these relocations, while the Rust ecosystem has been missing that final piece for 100% developer experience parity.
In this talk, we'll dive into the design and experimental implementation of native CO-RE support in the Rust compiler — from the #[btf_relocatable] attribute and core::btf field-info macros, through compiler lowering to the llvm.bpf.preserve.field.info intrinsic, to the final BTF.ext emission. We'll also discuss the trade-offs behind requiring explicit relocation queries rather than making ordinary field projection relocatable.