On Thu, Oct 7, 2021 at 5:37 PM <andrii.nakryiko@xxxxxxxxx> wrote: > > From: Andrii Nakryiko <andrii@xxxxxxxxxx> > > 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 <andrii@xxxxxxxxxx> Acked-by: Song Liu <songliubraving@xxxxxx>