authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-03-08 14:47:59+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-03-08 22:46:18+01:00
log7c5ddb6ae410a861e139ce36dec94434392bfdad
tree3177d5a8a9475e238705afb8b01654849c4fd968
parent47100bd40a026710076d2d9be6e03937201e8adc

elf+aarch64: handle PREL32 reloc


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

src/link/Elf/Atom.zig+6
...@@ -1658,6 +1658,7 @@ const aarch64 = struct {...@@ -1658,6 +1658,7 @@ const aarch64 = struct {
1658 .LDST32_ABS_LO12_NC,1658 .LDST32_ABS_LO12_NC,
1659 .LDST64_ABS_LO12_NC,1659 .LDST64_ABS_LO12_NC,
1660 .LDST128_ABS_LO12_NC,1660 .LDST128_ABS_LO12_NC,
1661 .PREL32,
1661 => {},1662 => {},
16621663
1663 else => try atom.reportUnhandledRelocError(rel, elf_file),1664 else => try atom.reportUnhandledRelocError(rel, elf_file),
...@@ -1716,6 +1717,11 @@ const aarch64 = struct {...@@ -1716,6 +1717,11 @@ const aarch64 = struct {
1716 aarch64_util.writeBranchImm(disp, code);1717 aarch64_util.writeBranchImm(disp, code);
1717 },1718 },
17181719
1720 .PREL32 => {
1721 const value = math.cast(i32, S + A - P) orelse return error.Overflow;
1722 mem.writeInt(u32, code, @bitCast(value), .little);
1723 },
1724
1719 .ADR_PREL_PG_HI21 => {1725 .ADR_PREL_PG_HI21 => {
1720 // TODO: check for relaxation of ADRP+ADD1726 // TODO: check for relaxation of ADRP+ADD
1721 const saddr = @as(u64, @intCast(P));1727 const saddr = @as(u64, @intCast(P));