elf+aarch64: handle PREL64 reloc

This commit is contained in:
Jakub Konka 2024-03-09 19:34:34 +01:00
parent b7b63855d0
commit 2cdbad6f10

View File

@ -1666,6 +1666,7 @@ const aarch64 = struct {
.LDST64_ABS_LO12_NC, .LDST64_ABS_LO12_NC,
.LDST128_ABS_LO12_NC, .LDST128_ABS_LO12_NC,
.PREL32, .PREL32,
.PREL64,
=> {}, => {},
else => try atom.reportUnhandledRelocError(rel, elf_file), else => try atom.reportUnhandledRelocError(rel, elf_file),
@ -1727,6 +1728,11 @@ const aarch64 = struct {
mem.writeInt(u32, code, @bitCast(value), .little); mem.writeInt(u32, code, @bitCast(value), .little);
}, },
.PREL64 => {
const value = S + A - P;
mem.writeInt(u64, code_buffer[r_offset..][0..8], @bitCast(value), .little);
},
.ADR_PREL_PG_HI21 => { .ADR_PREL_PG_HI21 => {
// TODO: check for relaxation of ADRP+ADD // TODO: check for relaxation of ADRP+ADD
const saddr = @as(u64, @intCast(P)); const saddr = @as(u64, @intCast(P));