bpftool: Generate externs datasec in BPF skeleton
authorAndrii Nakryiko <andriin@fb.com>
Sat, 14 Dec 2019 01:47:09 +0000 (17:47 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 16 Dec 2019 00:41:12 +0000 (16:41 -0800)
commit2ad97d473db57ab866f0756806bb94515f7f2551
tree6823aff4884341d6aa088f33cc1504375a6d2504
parent166750bc1dd256b2184b22588fb9fe6d3fbb93ae
bpftool: Generate externs datasec in BPF skeleton

Add support for generation of mmap()-ed read-only view of libbpf-provided
extern variables. As externs are not supposed to be provided by user code
(that's what .data, .bss, and .rodata is for), don't mmap() it initially. Only
after skeleton load is performed, map .extern contents as read-only memory.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20191214014710.3449601-4-andriin@fb.com
tools/bpf/bpftool/gen.c
tools/lib/bpf/libbpf.c