]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Properly ignore STT_SECTION symbols in legacy map definitions
authorToke Høiland-Jørgensen <toke@redhat.com>
Wed, 29 Sep 2021 21:38:37 +0000 (23:38 +0200)
committerAndrii Nakryiko <andrii@kernel.org>
Wed, 29 Sep 2021 22:50:32 +0000 (15:50 -0700)
commit1a326de47a63c9b2c2bb956ee7203309fbe800d2
tree5a1d2a597723c75b2f0f191559fd629315b87d03
parenta7e23cfc671bc21d58eea5c2198f80e9cc794bed
libbpf: Properly ignore STT_SECTION symbols in legacy map definitions

The previous patch to ignore STT_SECTION symbols only added the ignore
condition in one of them. This fails if there's more than one map
definition in the 'maps' section, because the subsequent modulus check will
fail, resulting in error messages like:

libbpf: elf: unable to determine legacy map definition size in ./xdpdump_xdp.o

Fix this by also ignoring STT_SECTION in the first loop.

Fixes: 46f5229a639d ("libbpf: Ignore STT_SECTION symbols in 'maps' section")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210929213837.832449-1-toke@redhat.com
tools/lib/bpf/libbpf.c