diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2024-02-03 10:52:29 +0100 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2024-02-03 10:52:29 +0100 |
| commit | 0a0f90f949942b19950455647bc955b369407dd4 (patch) | |
| tree | 44debca2e688edfcee5db118bbc4c5967dd304f3 /src/link/MachO.zig | |
| parent | aa1aa9886333e8b260901572142a227e5544f4df (diff) | |
| download | zig-0a0f90f949942b19950455647bc955b369407dd4.tar.gz zig-0a0f90f949942b19950455647bc955b369407dd4.zip | |
macho: migrate thunks to use new relative addressing mechanism
Diffstat (limited to 'src/link/MachO.zig')
| -rw-r--r-- | src/link/MachO.zig | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/link/MachO.zig b/src/link/MachO.zig index d5706eb4de..b0b576acfb 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -596,7 +596,6 @@ pub fn flushModule(self: *MachO, arena: Allocator, prog_node: *std.Progress.Node try self.allocateSections(); self.allocateSegments(); - self.allocateAtoms(); self.allocateSyntheticSymbols(); try self.allocateLinkeditSegment(); @@ -2392,14 +2391,6 @@ fn allocateSegments(self: *MachO) void { } } -pub fn allocateAtoms(self: *MachO) void { - // TODO: redo this like atoms - for (self.thunks.items) |*thunk| { - const header = self.sections.items(.header)[thunk.out_n_sect]; - thunk.value += header.addr; - } -} - fn allocateSyntheticSymbols(self: *MachO) void { const text_seg = self.getTextSegment(); @@ -2608,7 +2599,7 @@ fn writeAtoms(self: *MachO) !void { for (self.thunks.items) |thunk| { const header = slice.items(.header)[thunk.out_n_sect]; - const offset = thunk.value - header.addr + header.offset; + const offset = thunk.value + header.offset; const buffer = try gpa.alloc(u8, thunk.size()); defer gpa.free(buffer); var stream = std.io.fixedBufferStream(buffer); |
