Commit 7c5ddb6ae4

Jakub Konka <kubkon@jakubkonka.com>
2024-03-08 14:47:59
elf+aarch64: handle PREL32 reloc
1 parent 47100bd
Changed files (1)
src
link
src/link/Elf/Atom.zig
@@ -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));