| ... | @@ -482,6 +482,37 @@ pub fn writeRelocs(self: *ZigObject, macho_file: *MachO) !void { | ... | @@ -482,6 +482,37 @@ pub fn writeRelocs(self: *ZigObject, macho_file: *MachO) !void { |
| 482 | } | 482 | } |
| 483 | } | 483 | } |
| 484 | | 484 | |
| | 485 | // TODO we need this because not everything gets written out incrementally. |
| | 486 | // For example, TLS data gets written out via traditional route. |
| | 487 | // Is there any better way of handling this? |
| | 488 | pub fn writeAtomsRelocatable(self: *ZigObject, macho_file: *MachO) !void { |
| | 489 | const tracy = trace(@src()); |
| | 490 | defer tracy.end(); |
| | 491 | |
| | 492 | for (self.getAtoms()) |atom_index| { |
| | 493 | const atom = self.getAtom(atom_index) orelse continue; |
| | 494 | if (!atom.flags.alive) continue; |
| | 495 | const sect = atom.getInputSection(macho_file); |
| | 496 | if (sect.isZerofill()) continue; |
| | 497 | if (macho_file.isZigSection(atom.out_n_sect)) continue; |
| | 498 | const off = atom.value; |
| | 499 | const buffer = macho_file.sections.items(.out)[atom.out_n_sect].items; |
| | 500 | try self.getAtomData(macho_file, atom.*, buffer[off..][0..atom.size]); |
| | 501 | const relocs = macho_file.sections.items(.relocs)[atom.out_n_sect].items; |
| | 502 | const extra = atom.getExtra(macho_file); |
| | 503 | try atom.writeRelocs(macho_file, buffer[off..][0..atom.size], relocs[extra.rel_out_index..][0..extra.rel_out_count]); |
| | 504 | } |
| | 505 | } |
| | 506 | |
| | 507 | // TODO we need this because not everything gets written out incrementally. |
| | 508 | // For example, TLS data gets written out via traditional route. |
| | 509 | // Is there any better way of handling this? |
| | 510 | pub fn writeAtoms(self: *ZigObject, macho_file: *MachO) !void { |
| | 511 | const gpa = macho_file.base.comp.gpa; |
| | 512 | _ = gpa; |
| | 513 | _ = self; |
| | 514 | } |
| | 515 | |
| 485 | pub fn calcSymtabSize(self: *ZigObject, macho_file: *MachO) void { | 516 | pub fn calcSymtabSize(self: *ZigObject, macho_file: *MachO) void { |
| 486 | const tracy = trace(@src()); | 517 | const tracy = trace(@src()); |
| 487 | defer tracy.end(); | 518 | defer tracy.end(); |