Open Alan-Jowett opened 2 days ago
Question: Are these global variables compile time constants?
On Linux, the use case for this feature is to be able to modify a "compile time constant" at load time of a BPF program. For example being able to change ETH_HLEN to accomodate VLAN tagging or similar. The verifier will then inline the constant into the BPF instruction stream before JITing. This makes this essentially free in terms of performance.
Roughly how it works from user space (I think this is type 0x2 in the list above):
volatile const
. The compiler turns the reference to the const into a load from the .rodata section at a specific offset
The BPF ISA defines additional 64bit immediate load instructions. eBPF-for-Windows should add support for type 3 at a minimum. This support can improve the performance of certain BPF programs by eliminating the need to perform map lookups.