authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-02-03 09:25:07+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-02-03 09:28:37+01:00
logaa1aa9886333e8b260901572142a227e5544f4df
tree856d938cf054b256e7c2bd72fd833ab67df35e7f
parentdc6db3b30911a09890d6b5674c72a9db5a52e050

macho: fix remaining references to Atom.value


3 files changed, 7 insertions(+), 7 deletions(-)

src/link/MachO/Relocation.zig+1-1
...@@ -22,7 +22,7 @@ pub fn getTargetAtom(rel: Relocation, macho_file: *MachO) *Atom {...@@ -22,7 +22,7 @@ pub fn getTargetAtom(rel: Relocation, macho_file: *MachO) *Atom {
2222
23pub fn getTargetAddress(rel: Relocation, macho_file: *MachO) u64 {23pub fn getTargetAddress(rel: Relocation, macho_file: *MachO) u64 {
24 return switch (rel.tag) {24 return switch (rel.tag) {
25 .local => rel.getTargetAtom(macho_file).value,25 .local => rel.getTargetAtom(macho_file).getAddress(macho_file),
26 .@"extern" => rel.getTargetSymbol(macho_file).getAddress(.{}, macho_file),26 .@"extern" => rel.getTargetSymbol(macho_file).getAddress(.{}, macho_file),
27 };27 };
28}28}
src/link/MachO/UnwindInfo.zig+2-2
...@@ -490,12 +490,12 @@ pub const Record = struct {...@@ -490,12 +490,12 @@ pub const Record = struct {
490490
491 pub fn getAtomAddress(rec: Record, macho_file: *MachO) u64 {491 pub fn getAtomAddress(rec: Record, macho_file: *MachO) u64 {
492 const atom = rec.getAtom(macho_file);492 const atom = rec.getAtom(macho_file);
493 return atom.value + rec.atom_offset;493 return atom.getAddress(macho_file) + rec.atom_offset;
494 }494 }
495495
496 pub fn getLsdaAddress(rec: Record, macho_file: *MachO) u64 {496 pub fn getLsdaAddress(rec: Record, macho_file: *MachO) u64 {
497 const lsda = rec.getLsdaAtom(macho_file) orelse return 0;497 const lsda = rec.getLsdaAtom(macho_file) orelse return 0;
498 return lsda.value + rec.lsda_offset;498 return lsda.getAddress(macho_file) + rec.lsda_offset;
499 }499 }
500500
501 pub fn format(501 pub fn format(
src/link/MachO/eh_frame.zig+4-4
...@@ -416,7 +416,7 @@ pub fn write(macho_file: *MachO, buffer: []u8) void {...@@ -416,7 +416,7 @@ pub fn write(macho_file: *MachO, buffer: []u8) void {
416 {416 {
417 const offset = fde.out_offset + 8;417 const offset = fde.out_offset + 8;
418 const saddr = sect.addr + offset;418 const saddr = sect.addr + offset;
419 const taddr = fde.getAtom(macho_file).value;419 const taddr = fde.getAtom(macho_file).getAddress(macho_file);
420 std.mem.writeInt(420 std.mem.writeInt(
421 i64,421 i64,
422 buffer[offset..][0..8],422 buffer[offset..][0..8],
...@@ -428,7 +428,7 @@ pub fn write(macho_file: *MachO, buffer: []u8) void {...@@ -428,7 +428,7 @@ pub fn write(macho_file: *MachO, buffer: []u8) void {
428 if (fde.getLsdaAtom(macho_file)) |atom| {428 if (fde.getLsdaAtom(macho_file)) |atom| {
429 const offset = fde.out_offset + fde.lsda_ptr_offset;429 const offset = fde.out_offset + fde.lsda_ptr_offset;
430 const saddr = sect.addr + offset;430 const saddr = sect.addr + offset;
431 const taddr = atom.value + fde.lsda_offset;431 const taddr = atom.getAddress(macho_file) + fde.lsda_offset;
432 switch (fde.getCie(macho_file).lsda_size.?) {432 switch (fde.getCie(macho_file).lsda_size.?) {
433 .p32 => std.mem.writeInt(433 .p32 => std.mem.writeInt(
434 i32,434 i32,
...@@ -501,7 +501,7 @@ pub fn writeRelocs(macho_file: *MachO, code: []u8, relocs: *std.ArrayList(macho....@@ -501,7 +501,7 @@ pub fn writeRelocs(macho_file: *MachO, code: []u8, relocs: *std.ArrayList(macho.
501 {501 {
502 const offset = fde.out_offset + 8;502 const offset = fde.out_offset + 8;
503 const saddr = sect.addr + offset;503 const saddr = sect.addr + offset;
504 const taddr = fde.getAtom(macho_file).value;504 const taddr = fde.getAtom(macho_file).getAddress(macho_file);
505 std.mem.writeInt(505 std.mem.writeInt(
506 i64,506 i64,
507 code[offset..][0..8],507 code[offset..][0..8],
...@@ -513,7 +513,7 @@ pub fn writeRelocs(macho_file: *MachO, code: []u8, relocs: *std.ArrayList(macho....@@ -513,7 +513,7 @@ pub fn writeRelocs(macho_file: *MachO, code: []u8, relocs: *std.ArrayList(macho.
513 if (fde.getLsdaAtom(macho_file)) |atom| {513 if (fde.getLsdaAtom(macho_file)) |atom| {
514 const offset = fde.out_offset + fde.lsda_ptr_offset;514 const offset = fde.out_offset + fde.lsda_ptr_offset;
515 const saddr = sect.addr + offset;515 const saddr = sect.addr + offset;
516 const taddr = atom.value + fde.lsda_offset;516 const taddr = atom.getAddress(macho_file) + fde.lsda_offset;
517 switch (fde.getCie(macho_file).lsda_size.?) {517 switch (fde.getCie(macho_file).lsda_size.?) {
518 .p32 => std.mem.writeInt(518 .p32 => std.mem.writeInt(
519 i32,519 i32,