libbpf: Generalize BTF and BTF.ext type ID and strings iteration
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 18 Mar 2021 19:40:26 +0000 (12:40 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 18 Mar 2021 23:14:22 +0000 (16:14 -0700)
commitf36e99a45dbe76949eb99bba413c67eda5cd2591
tree85e7df4c53f34e48a47c9e9c410f1da9c432165a
parente14ef4bf011192b61b48c4f3a35b3041140073ff
libbpf: Generalize BTF and BTF.ext type ID and strings iteration

Extract and generalize the logic to iterate BTF type ID and string offset
fields within BTF types and .BTF.ext data. Expose this internally in libbpf
for re-use by bpf_linker.

Additionally, complete strings deduplication handling for BTF.ext (e.g., CO-RE
access strings), which was previously missing. There previously was no
case of deduplicating .BTF.ext data, but bpf_linker is going to use it.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210318194036.3521577-3-andrii@kernel.org
tools/lib/bpf/btf.c
tools/lib/bpf/libbpf_internal.h