| ... | @@ -3421,11 +3421,11 @@ fn populateLazyBindOffsetsInStubHelper(self: *MachO, lazy_bind: LazyBind) !void | ... | @@ -3421,11 +3421,11 @@ fn populateLazyBindOffsetsInStubHelper(self: *MachO, lazy_bind: LazyBind) !void |
| 3421 | const header = section.header; | 3421 | const header = section.header; |
| 3422 | var atom = section.last_atom.?; | 3422 | var atom = section.last_atom.?; |
| 3423 | | 3423 | |
| 3424 | var index: usize = lazy_bind.offsets.items.len; | 3424 | var index: usize = 0; |
| 3425 | while (index > 0) : (index -= 1) { | 3425 | while (index < lazy_bind.offsets.items.len) : (index += 1) { |
| 3426 | const sym = atom.getSymbol(self); | 3426 | const sym = atom.getSymbol(self); |
| 3427 | const file_offset = header.offset + sym.n_value - header.addr + stub_offset; | 3427 | const file_offset = header.offset + sym.n_value - header.addr + stub_offset; |
| 3428 | const bind_offset = lazy_bind.offsets.items[index - 1]; | 3428 | const bind_offset = lazy_bind.offsets.items[index]; |
| 3429 | | 3429 | |
| 3430 | log.debug("writing lazy bind offset 0x{x} in stub helper at 0x{x}", .{ bind_offset, file_offset }); | 3430 | log.debug("writing lazy bind offset 0x{x} in stub helper at 0x{x}", .{ bind_offset, file_offset }); |
| 3431 | | 3431 | |