]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Remove assumptions about uniqueness of .rodata/.data/.bss maps
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 21 Oct 2021 01:43:58 +0000 (18:43 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 22 Oct 2021 00:10:10 +0000 (17:10 -0700)
commit160574e3580a11c1766b69d5596cf361252e11f3
treebb86f5e5092bf70d82b41fdcdd94856c368f0d8b
parente83106d8b1abd23ead7de781bca7ec4b3a7e1575
libbpf: Remove assumptions about uniqueness of .rodata/.data/.bss maps

Remove internal libbpf assumption that there can be only one .rodata,
.data, and .bss map per BPF object. To achieve that, extend and
generalize the scheme that was used for keeping track of relocation ELF
sections. Now each ELF section has a temporary extra index that keeps
track of logical type of ELF section (relocations, data, read-only data,
BSS). Switch relocation to this scheme, as well as .rodata/.data/.bss
handling.

We don't yet allow multiple .rodata, .data, and .bss sections, but no
libbpf internal code makes an assumption that there can be only one of
each and thus they can be explicitly referenced by a single index. Next
patches will actually allow multiple .rodata and .data sections.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20211021014404.2635234-5-andrii@kernel.org
tools/lib/bpf/libbpf.c