Currently, BPF only contains three relocations:
R_BPF_NONE for no relocation
R_BPF_64_64 for LD_imm64 and normal 64-bit data relocation
R_BPF_64_32 for call insn and normal 32-bit data relocation
Also .BTF and .BTF.ext sections contain symbols in allocated
program and data sections. These two sections reserved 32bit
space to hold the offset relative to the symbol's section.
LLVM JIT tries to resolve these symbols with an actual 64bit
address and it won't work since we only have 32bit space.
Also, we don't really want JIT to do relocatin for such cases.
So we used R_BPF_NONE for such relocations.
This all works fine until when we try to do linking of
. R_BPF_64_64 handling of LD_imm64 vs. normal 64-bit data
is different, so target->relocate() needs more context
to do a correct job.
. The same for R_BPF_64_32.
. Since relocations in .BTF and .BTF.ext are set to none,
they will not be relocated properly.
This patch intends to address this issue by adding additional
R_BPF_64_LD64 for LD_imm64 relocation
R_BPF_64_PC32 for call insn relocation
R_BPF_64_ALLOC32 for .BTF and .BTF.ext style relocations.
R_BPF_64_64 and R_BPF_64_32 are used for 64- and 32-bit data
relocations. The elfutils already used them for dwarf.
This patch does not change that. So elfutils does not
need change even with this patch.
I also removed handling of FK_SecRel_4 Fixup Kind as it seems
there is no bpf insn which could trigger this fixup kind.