| ... | @@ -508,9 +508,20 @@ pub fn writeAtomsRelocatable(self: *ZigObject, macho_file: *MachO) !void { | ... | @@ -508,9 +508,20 @@ pub fn writeAtomsRelocatable(self: *ZigObject, macho_file: *MachO) !void { |
| 508 | // For example, TLS data gets written out via traditional route. | 508 | // For example, TLS data gets written out via traditional route. |
| 509 | // Is there any better way of handling this? | 509 | // Is there any better way of handling this? |
| 510 | pub fn writeAtoms(self: *ZigObject, macho_file: *MachO) !void { | 510 | pub fn writeAtoms(self: *ZigObject, macho_file: *MachO) !void { |
| 511 | const gpa = macho_file.base.comp.gpa; | 511 | const tracy = trace(@src()); |
| 512 | _ = gpa; | 512 | defer tracy.end(); |
| 513 | _ = self; | 513 | |
| | 514 | for (self.getAtoms()) |atom_index| { |
| | 515 | const atom = self.getAtom(atom_index) orelse continue; |
| | 516 | if (!atom.flags.alive) continue; |
| | 517 | const sect = atom.getInputSection(macho_file); |
| | 518 | if (sect.isZerofill()) continue; |
| | 519 | if (macho_file.isZigSection(atom.out_n_sect)) continue; |
| | 520 | const off = atom.value; |
| | 521 | const buffer = macho_file.sections.items(.out)[atom.out_n_sect].items; |
| | 522 | try self.getAtomData(macho_file, atom.*, buffer[off..][0..atom.size]); |
| | 523 | try atom.resolveRelocs(macho_file, buffer[off..][0..atom.size]); |
| | 524 | } |
| 514 | } | 525 | } |
| 515 | | 526 | |
| 516 | pub fn calcSymtabSize(self: *ZigObject, macho_file: *MachO) void { | 527 | pub fn calcSymtabSize(self: *ZigObject, macho_file: *MachO) void { |