Skip to content

Commit

Permalink
macho: calculate __la_symbol_ptr size
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Nov 19, 2023
1 parent 065e903 commit 75a47e7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/MachO.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,12 @@ fn calcSectionSizes(self: *MachO) !void {
else => 0,
};
}

if (self.la_symbol_ptr_sect_index) |idx| {
const header = &self.sections.items(.header)[idx];
header.size = self.la_symbol_ptr.size(self);
header.@"align" = 3;
}
}

fn initSegments(self: *MachO) !void {
Expand Down
7 changes: 6 additions & 1 deletion src/MachO/synthetic.zig
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ pub const StubsHelperSection = struct {
}
};

pub const LaSymbolPtrSection = struct {};
pub const LaSymbolPtrSection = struct {
pub fn size(laptr: LaSymbolPtrSection, macho_file: *MachO) usize {
_ = laptr;
return macho_file.stubs.symbols.items.len * @sizeOf(u64);
}
};

pub const TlvSection = struct {
symbols: std.ArrayListUnmanaged(Symbol.Index) = .{},
Expand Down

0 comments on commit 75a47e7

Please sign in to comment.