]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Don't error out on CO-RE relos for overriden weak subprogs
authorAndrii Nakryiko <andrii@kernel.org>
Fri, 8 Apr 2022 18:14:23 +0000 (11:14 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:22:46 +0000 (10:22 +0200)
commit710cbdc792c0f88e7fd3f9c2420a3647698b250c
tree00c5fb027e9ddcb1cf2b5ca0f3f2b89f9934cced
parent4829c085cffe7277bbe6f90efe51d8cc86d8641b
libbpf: Don't error out on CO-RE relos for overriden weak subprogs

[ Upstream commit 41fb81427a4aca85ab8455948221403d02c23787 ]

During BPF static linking, all the ELF relocations and .BTF.ext
information (including CO-RE relocations) are preserved for __weak
subprograms that were logically overriden by either previous weak
subprogram instance or by corresponding "strong" (non-weak) subprogram.
This is just how native user-space linkers work, nothing new.

But libbpf is over-zealous when processing CO-RE relocation to error out
when CO-RE relocation belonging to such eliminated weak subprogram is
encountered. Instead of erroring out on this expected situation, log
debug-level message and skip the relocation.

Fixes: 1dbf03242c2c ("libbpf: Support CO-RE relocations for multi-prog sections")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20220408181425.2287230-2-andrii@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/lib/bpf/libbpf.c