| ... | @@ -816,8 +816,8 @@ pub fn flush(self: *MachO, comp: *Compilation) !void { | ... | @@ -816,8 +816,8 @@ pub fn flush(self: *MachO, comp: *Compilation) !void { |
| 816 | | 816 | |
| 817 | const laptr_atom = try self.createLazyPointerAtom(stub_atom.local_sym_index); | 817 | const laptr_atom = try self.createLazyPointerAtom(stub_atom.local_sym_index); |
| 818 | try self.allocateAtomStage1(laptr_atom, .{ | 818 | try self.allocateAtomStage1(laptr_atom, .{ |
| 819 | .seg = self.text_segment_cmd_index.?, | 819 | .seg = self.data_segment_cmd_index.?, |
| 820 | .sect = self.stub_helper_section_index.?, | 820 | .sect = self.la_symbol_ptr_section_index.?, |
| 821 | }); | 821 | }); |
| 822 | } | 822 | } |
| 823 | try self.allocateTextSegment(); | 823 | try self.allocateTextSegment(); |
| ... | @@ -2183,6 +2183,11 @@ fn createStubHelperAtom(self: *MachO) !*TextBlock { | ... | @@ -2183,6 +2183,11 @@ fn createStubHelperAtom(self: *MachO) !*TextBlock { |
| 2183 | .aarch64 => 3 * @sizeOf(u32), | 2183 | .aarch64 => 3 * @sizeOf(u32), |
| 2184 | else => unreachable, | 2184 | else => unreachable, |
| 2185 | }; | 2185 | }; |
| | 2186 | const alignment: u2 = switch (arch) { |
| | 2187 | .x86_64 => 0, |
| | 2188 | .aarch64 => 2, |
| | 2189 | else => unreachable, |
| | 2190 | }; |
| 2186 | const local_sym_index = @intCast(u32, self.locals.items.len); | 2191 | const local_sym_index = @intCast(u32, self.locals.items.len); |
| 2187 | try self.locals.append(self.base.allocator, .{ | 2192 | try self.locals.append(self.base.allocator, .{ |
| 2188 | .n_strx = try self.makeString("stub_in_stub_helper"), | 2193 | .n_strx = try self.makeString("stub_in_stub_helper"), |
| ... | @@ -2194,7 +2199,7 @@ fn createStubHelperAtom(self: *MachO) !*TextBlock { | ... | @@ -2194,7 +2199,7 @@ fn createStubHelperAtom(self: *MachO) !*TextBlock { |
| 2194 | const atom = try self.createEmptyAtom(.{ | 2199 | const atom = try self.createEmptyAtom(.{ |
| 2195 | .seg = self.text_segment_cmd_index.?, | 2200 | .seg = self.text_segment_cmd_index.?, |
| 2196 | .sect = self.stub_helper_section_index.?, | 2201 | .sect = self.stub_helper_section_index.?, |
| 2197 | }, local_sym_index, stub_size, 2); | 2202 | }, local_sym_index, stub_size, alignment); |
| 2198 | try atom.relocs.ensureTotalCapacity(self.base.allocator, 1); | 2203 | try atom.relocs.ensureTotalCapacity(self.base.allocator, 1); |
| 2199 | | 2204 | |
| 2200 | switch (arch) { | 2205 | switch (arch) { |