Skip to content

Commit 9743d18

Browse files
committed
[SOL] Revert to R_BPF_64_64 for global data object relocations
RBPF doesn't support R_BPF_64_ABS64 and R_BPF_64_64 correctly represents relocation information for global data objects, so we can use them without breaking the correctness of generated object files.
1 parent 37cfe04 commit 9743d18

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

lld/ELF/Arch/BPF.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ RelExpr BPF::getRelExpr(RelType type, const Symbol &s,
4747
return R_PC;
4848
case R_BPF_64_64:
4949
return R_ABS;
50-
case R_BPF_64_ABS64:
51-
return R_ADDEND;
5250
default:
5351
error(getErrorLocation(loc) + "unrecognized reloc " + toString(type));
5452
}
@@ -78,14 +76,6 @@ void BPF::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
7876
write32le(loc + 8 + 4, val >> 32);
7977
break;
8078
}
81-
case R_BPF_64_ABS64: {
82-
// The relocation type is used for normal 64-bit data. The
83-
// actual to-be-relocated data is stored at r_offset and the
84-
// read/write data bitsize is 64 (8 bytes). The relocation can
85-
// be resolved with the symbol value plus implicit addend.
86-
write64le(loc, val);
87-
break;
88-
}
8979
default:
9080
error(getErrorLocation(loc) + "unrecognized reloc " + toString(rel.type));
9181
}

llvm/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ unsigned BPFELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,
6464
// CALL instruction.
6565
return ELF::R_BPF_64_32;
6666
case FK_Data_8:
67-
return ELF::R_BPF_64_ABS64;
67+
return ELF::R_BPF_64_64;
6868
case FK_Data_4:
6969
if (const MCSymbolRefExpr *A = Target.getSymA()) {
7070
const MCSymbol &Sym = A->getSymbol();

0 commit comments

Comments
 (0)