Commit aa1aa98863

Jakub Konka <kubkon@jakubkonka.com>
2024-02-03 09:25:07
macho: fix remaining references to Atom.value
1 parent dc6db3b
Changed files (3)
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,
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),
     };
 }
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(