From aa1aa9886333e8b260901572142a227e5544f4df Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Sat, 3 Feb 2024 09:25:07 +0100 Subject: [PATCH] macho: fix remaining references to Atom.value --- src/link/MachO/Relocation.zig | 2 +- src/link/MachO/UnwindInfo.zig | 4 ++-- src/link/MachO/eh_frame.zig | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/link/MachO/Relocation.zig b/src/link/MachO/Relocation.zig index eff628071fd778a4fd64fe2364146679e44d6827..e350684eacfc608740765bd691a3cfc555855369 100644 --- a/src/link/MachO/Relocation.zig +++ b/src/link/MachO/Relocation.zig @@ -22,7 +22,7 @@ pub fn getTargetAtom(rel: Relocation, macho_file: *MachO) *Atom { pub fn getTargetAddress(rel: Relocation, macho_file: *MachO) u64 { return switch (rel.tag) { - .local => rel.getTargetAtom(macho_file).value, + .local => rel.getTargetAtom(macho_file).getAddress(macho_file), .@"extern" => rel.getTargetSymbol(macho_file).getAddress(.{}, macho_file), }; } diff --git a/src/link/MachO/UnwindInfo.zig b/src/link/MachO/UnwindInfo.zig index 8f62cc2f8855688e75069c50821872cce426d591..e16e03b09a677563d4a6a8297cfe307c1218b4f4 100644 --- a/src/link/MachO/UnwindInfo.zig +++ b/src/link/MachO/UnwindInfo.zig @@ -490,12 +490,12 @@ pub const Record = struct { pub fn getAtomAddress(rec: Record, macho_file: *MachO) u64 { const atom = rec.getAtom(macho_file); - return atom.value + rec.atom_offset; + return atom.getAddress(macho_file) + rec.atom_offset; } pub fn getLsdaAddress(rec: Record, macho_file: *MachO) u64 { const lsda = rec.getLsdaAtom(macho_file) orelse return 0; - return lsda.value + rec.lsda_offset; + return lsda.getAddress(macho_file) + rec.lsda_offset; } pub fn format( diff --git a/src/link/MachO/eh_frame.zig b/src/link/MachO/eh_frame.zig index 24b3d751a463430c7af1ab151d1dc54983194314..8e71960e69da524f6070f16cd1552548315a0028 100644 --- a/src/link/MachO/eh_frame.zig +++ b/src/link/MachO/eh_frame.zig @@ -416,7 +416,7 @@ pub fn write(macho_file: *MachO, buffer: []u8) void { { const offset = fde.out_offset + 8; const saddr = sect.addr + offset; - const taddr = fde.getAtom(macho_file).value; + const taddr = fde.getAtom(macho_file).getAddress(macho_file); std.mem.writeInt( i64, buffer[offset..][0..8], @@ -428,7 +428,7 @@ pub fn write(macho_file: *MachO, buffer: []u8) void { if (fde.getLsdaAtom(macho_file)) |atom| { const offset = fde.out_offset + fde.lsda_ptr_offset; const saddr = sect.addr + offset; - const taddr = atom.value + fde.lsda_offset; + const taddr = atom.getAddress(macho_file) + fde.lsda_offset; switch (fde.getCie(macho_file).lsda_size.?) { .p32 => std.mem.writeInt( i32, @@ -501,7 +501,7 @@ pub fn writeRelocs(macho_file: *MachO, code: []u8, relocs: *std.ArrayList(macho. { const offset = fde.out_offset + 8; const saddr = sect.addr + offset; - const taddr = fde.getAtom(macho_file).value; + const taddr = fde.getAtom(macho_file).getAddress(macho_file); std.mem.writeInt( i64, code[offset..][0..8], @@ -513,7 +513,7 @@ pub fn writeRelocs(macho_file: *MachO, code: []u8, relocs: *std.ArrayList(macho. if (fde.getLsdaAtom(macho_file)) |atom| { const offset = fde.out_offset + fde.lsda_ptr_offset; const saddr = sect.addr + offset; - const taddr = atom.value + fde.lsda_offset; + const taddr = atom.getAddress(macho_file) + fde.lsda_offset; switch (fde.getCie(macho_file).lsda_size.?) { .p32 => std.mem.writeInt( i32, -- 2.54.0