]> 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)
commitcc556f868645b8b36cdc48963d6c87b03bb96841
treebb86f5e5092bf70d82b41fdcdd94856c368f0d8b
parentec01944f15cb6c390a6a0a9d27e4e27d9756e9d6
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