authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-03-09 19:34:34+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-03-09 19:34:34+01:00
log2cdbad6f10ec5a3d07de3d02a2f0cb9e9660bd58
tree8bc65fb00a9f7368ed2ca5be594272f5778044d0
parentb7b63855d04c8a757b9c33982cccf538676256ad

elf+aarch64: handle PREL64 reloc


1 files changed, 6 insertions(+), 0 deletions(-)

src/link/Elf/Atom.zig+6
...@@ -1666,6 +1666,7 @@ const aarch64 = struct {...@@ -1666,6 +1666,7 @@ const aarch64 = struct {
1666 .LDST64_ABS_LO12_NC,1666 .LDST64_ABS_LO12_NC,
1667 .LDST128_ABS_LO12_NC,1667 .LDST128_ABS_LO12_NC,
1668 .PREL32,1668 .PREL32,
1669 .PREL64,
1669 => {},1670 => {},
16701671
1671 else => try atom.reportUnhandledRelocError(rel, elf_file),1672 else => try atom.reportUnhandledRelocError(rel, elf_file),
...@@ -1727,6 +1728,11 @@ const aarch64 = struct {...@@ -1727,6 +1728,11 @@ const aarch64 = struct {
1727 mem.writeInt(u32, code, @bitCast(value), .little);1728 mem.writeInt(u32, code, @bitCast(value), .little);
1728 },1729 },
17291730
1731 .PREL64 => {
1732 const value = S + A - P;
1733 mem.writeInt(u64, code_buffer[r_offset..][0..8], @bitCast(value), .little);
1734 },
1735
1730 .ADR_PREL_PG_HI21 => {1736 .ADR_PREL_PG_HI21 => {
1731 // TODO: check for relaxation of ADRP+ADD1737 // TODO: check for relaxation of ADRP+ADD
1732 const saddr = @as(u64, @intCast(P));1738 const saddr = @as(u64, @intCast(P));