mirror of
https://github.com/ziglang/zig.git
synced 2025-01-09 19:50:29 +00:00
macho: write non-incremental atoms in ZigObject
This commit is contained in:
parent
e5a66184ed
commit
129fe8668c
@ -2351,6 +2351,9 @@ fn writeSectionsAndUpdateLinkeditSizes(self: *MachO) !void {
|
||||
for (self.objects.items) |index| {
|
||||
try self.getFile(index).?.writeAtoms(self);
|
||||
}
|
||||
if (self.getZigObject()) |zo| {
|
||||
try zo.writeAtoms(self);
|
||||
}
|
||||
if (self.getInternalObject()) |obj| {
|
||||
try obj.asFile().writeAtoms(self);
|
||||
}
|
||||
|
@ -508,9 +508,20 @@ pub fn writeAtomsRelocatable(self: *ZigObject, macho_file: *MachO) !void {
|
||||
// For example, TLS data gets written out via traditional route.
|
||||
// Is there any better way of handling this?
|
||||
pub fn writeAtoms(self: *ZigObject, macho_file: *MachO) !void {
|
||||
const gpa = macho_file.base.comp.gpa;
|
||||
_ = gpa;
|
||||
_ = self;
|
||||
const tracy = trace(@src());
|
||||
defer tracy.end();
|
||||
|
||||
for (self.getAtoms()) |atom_index| {
|
||||
const atom = self.getAtom(atom_index) orelse continue;
|
||||
if (!atom.flags.alive) continue;
|
||||
const sect = atom.getInputSection(macho_file);
|
||||
if (sect.isZerofill()) continue;
|
||||
if (macho_file.isZigSection(atom.out_n_sect)) continue;
|
||||
const off = atom.value;
|
||||
const buffer = macho_file.sections.items(.out)[atom.out_n_sect].items;
|
||||
try self.getAtomData(macho_file, atom.*, buffer[off..][0..atom.size]);
|
||||
try atom.resolveRelocs(macho_file, buffer[off..][0..atom.size]);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn calcSymtabSize(self: *ZigObject, macho_file: *MachO) void {
|
||||
|
Loading…
Reference in New Issue
Block a user