> On Nov 19, 2021, at 3:14 PM, Andrii Nakryiko <andrii@xxxxxxxxxx> wrote: > > Load global data maps lazily, if kernel is too old to support global > data. Make sure that programs are still correct by detecting if any of > the to-be-loaded programs have relocation against any of such maps. > > This allows to solve the issue ([0]) with bpf_printk() and Clang > generating unnecessary and unreferenced .rodata.strX.Y sections, but it > also goes further along the CO-RE lines, allowing to have a BPF object > in which some code can work on very old kernels and relies only on BPF > maps explicitly, while other BPF programs might enjoy global variable > support. If such programs are correctly set to not load at runtime on > old kernels, bpf_object will load and function correctly now.' > > [0] https://lore.kernel.org/bpf/CAK-59YFPU3qO+_pXWOH+c1LSA=8WA1yabJZfREjOEXNHAqgXNg@xxxxxxxxxxxxxx/ > > Fixes: aed659170a31 ("libbpf: Support multiple .rodata.* and .data.* BPF maps") > Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx> Acked-by: Song Liu <songliubraving@xxxxxx>