From 957b7772f5d62fccfb63ffd5a7e1f47cd4fa692d Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Sat, 29 Jun 2024 07:29:06 +0200 Subject: [PATCH] macho: skip __TEXT,__stubs_helper in writeSections as handled elsewhere --- src/MachO.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/MachO.zig b/src/MachO.zig index 27db3cf6..75e850b7 100644 --- a/src/MachO.zig +++ b/src/MachO.zig @@ -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;