Commit 2cdbad6f10

Jakub Konka <kubkon@jakubkonka.com>
2024-03-09 19:34:34
elf+aarch64: handle PREL64 reloc
1 parent b7b6385
Changed files (1)
src
link
src/link/Elf/Atom.zig
@@ -1666,6 +1666,7 @@ const aarch64 = struct {
             .LDST64_ABS_LO12_NC,
             .LDST128_ABS_LO12_NC,
             .PREL32,
+            .PREL64,
             => {},
 
             else => try atom.reportUnhandledRelocError(rel, elf_file),
@@ -1727,6 +1728,11 @@ const aarch64 = struct {
                 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 => {
                 // TODO: check for relaxation of ADRP+ADD
                 const saddr = @as(u64, @intCast(P));