Skip to content

Commit

Permalink
macho: skip __TEXT,__stubs_helper in writeSections as handled elsewhere
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Jun 29, 2024
1 parent 29a6714 commit 957b777
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/MachO.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1971,8 +1971,11 @@ pub fn updateLinkeditSizeWorker(self: *MachO, tag: enum {

fn writeSections(self: *MachO) !void {
const slice = self.sections.slice();
for (slice.items(.header), slice.items(.out)) |header, *out| {
for (slice.items(.header), slice.items(.out), 0..) |header, *out, n_sect| {
if (header.isZerofill()) continue;
if (self.stubs_helper_sect_index) |sid| {
if (sid == n_sect) continue; // Handled separately
}
const cpu_arch = self.options.cpu_arch.?;
try out.resize(self.base.allocator, header.size);
const padding_byte: u8 = if (header.isCode() and cpu_arch == .x86_64) 0xcc else 0;
Expand Down

0 comments on commit 957b777

Please sign in to comment.