From 37cfe04a84afc794236e811724013edc5049f139 Mon Sep 17 00:00:00 2001 From: Dmitri Makarov Date: Wed, 3 Nov 2021 18:44:11 -0700 Subject: [PATCH] [SOL] Add R_BPF_64_ABS64 relocation handling in lld --- lld/ELF/Arch/BPF.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lld/ELF/Arch/BPF.cpp b/lld/ELF/Arch/BPF.cpp index fbe5a8c1d7339e..1d60ff58b96000 100644 --- a/lld/ELF/Arch/BPF.cpp +++ b/lld/ELF/Arch/BPF.cpp @@ -47,6 +47,8 @@ RelExpr BPF::getRelExpr(RelType type, const Symbol &s, return R_PC; case R_BPF_64_64: return R_ABS; + case R_BPF_64_ABS64: + return R_ADDEND; default: error(getErrorLocation(loc) + "unrecognized reloc " + toString(type)); } @@ -76,6 +78,14 @@ void BPF::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { write32le(loc + 8 + 4, val >> 32); break; } + case R_BPF_64_ABS64: { + // The relocation type is used for normal 64-bit data. The + // actual to-be-relocated data is stored at r_offset and the + // read/write data bitsize is 64 (8 bytes). The relocation can + // be resolved with the symbol value plus implicit addend. + write64le(loc, val); + break; + } default: error(getErrorLocation(loc) + "unrecognized reloc " + toString(rel.type)); }