aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/linker.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <[email protected]>2021-10-21 01:43:57 +0000
committerAlexei Starovoitov <[email protected]>2021-10-22 00:10:10 +0000
commitad23b7238474c6319bf692ae6ce037d9696df1d1 (patch)
tree83b4b90531cd45ac106383e8025f5ab169c4bce3 /tools/lib/bpf/linker.c
parentlibbpf: Extract ELF processing state into separate struct (diff)
downloadkernel-ad23b7238474c6319bf692ae6ce037d9696df1d1.tar.gz
kernel-ad23b7238474c6319bf692ae6ce037d9696df1d1.zip
libbpf: Use Elf64-specific types explicitly for dealing with ELF
Minimize the usage of class-agnostic gelf_xxx() APIs from libelf. These APIs require copying ELF data structures into local GElf_xxx structs and have a more cumbersome API. BPF ELF file is defined to be always 64-bit ELF object, even when intended to be run on 32-bit host architectures, so there is no need to do class-agnostic conversions everywhere. BPF static linker implementation within libbpf has been using Elf64-specific types since initial implementation. Add two simple helpers, elf_sym_by_idx() and elf_rel_by_idx(), for more succinct direct access to ELF symbol and relocation records within ELF data itself and switch all the GElf_xxx usage into Elf64_xxx equivalents. The only remaining place within libbpf.c that's still using gelf API is gelf_getclass(), as there doesn't seem to be a direct way to get underlying ELF bitness. No functional changes intended. Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: Song Liu <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/linker.c')
-rw-r--r--tools/lib/bpf/linker.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c
index 2df880cefdae..13e6fdc7d8cb 100644
--- a/tools/lib/bpf/linker.c
+++ b/tools/lib/bpf/linker.c
@@ -15,7 +15,6 @@
#include <linux/btf.h>
#include <elf.h>
#include <libelf.h>
-#include <gelf.h>
#include <fcntl.h>
#include "libbpf.h"
#include "btf.h"