elf+aarch64: handle PREL32 reloc

This commit is contained in:
Jakub Konka
2024-03-08 14:47:59 +01:00
parent 47100bd40a
commit 7c5ddb6ae4

View File

@@ -1658,6 +1658,7 @@ const aarch64 = struct {
.LDST32_ABS_LO12_NC,
.LDST64_ABS_LO12_NC,
.LDST128_ABS_LO12_NC,
.PREL32,
=> {},
else => try atom.reportUnhandledRelocError(rel, elf_file),
@@ -1716,6 +1717,11 @@ const aarch64 = struct {
aarch64_util.writeBranchImm(disp, code);
},
.PREL32 => {
const value = math.cast(i32, S + A - P) orelse return error.Overflow;
mem.writeInt(u32, code, @bitCast(value), .little);
},
.ADR_PREL_PG_HI21 => {
// TODO: check for relaxation of ADRP+ADD
const saddr = @as(u64, @intCast(P));