authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-11-16 20:16:34+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-11-26 11:50:09+01:00
log8450e6f156e365dd14756f74e748f755fc0cc5ab
tree9a89c0cd3202c1fb64025e642dd796acad5c8f4d
parent4a3d757f3e57d115ef2f6889f52a06e013bcfc06

stage2 macho: pages need to be 16kb aligned!


1 files changed, 4 insertions(+), 4 deletions(-)

src/link/MachO.zig+4-4
......@@ -387,7 +387,7 @@ pub fn flushModule(self: *MachO, comp: *Compilation) !void {
387387 const symtab = &self.load_commands.items[self.symtab_cmd_index.?].Symtab;
388388 const file_size = symtab.stroff + symtab.strsize - linkedit.fileoff;
389389 linkedit.filesize = file_size;
390 linkedit.vmsize = mem.alignForwardGeneric(u64, file_size, 0x1000);
390 linkedit.vmsize = mem.alignForwardGeneric(u64, file_size, 0x4000);
391391 }
392392
393393 if (self.cmd_table_dirty) {
......@@ -1163,8 +1163,8 @@ pub fn populateMissingMetadata(self: *MachO) !void {
11631163
11641164 // const program_code_size_hint = self.base.options.program_code_size_hint;
11651165 const program_code_size_hint = 128;
1166 const file_size = mem.alignForwardGeneric(u64, program_code_size_hint, 0x1000);
1167 const off = @intCast(u32, self.findFreeSpace(file_size, 0x1000)); // TODO maybe findFreeSpace should return u32 directly?
1166 const file_size = mem.alignForwardGeneric(u64, program_code_size_hint, 0x4000);
1167 const off = @intCast(u32, self.findFreeSpace(file_size, 0x4000)); // TODO maybe findFreeSpace should return u32 directly?
11681168 const flags = macho.S_REGULAR | macho.S_ATTR_PURE_INSTRUCTIONS | macho.S_ATTR_SOME_INSTRUCTIONS;
11691169
11701170 log.debug("found __text section free space 0x{x} to 0x{x}\n", .{ off, off + file_size });
......@@ -1237,7 +1237,7 @@ pub fn populateMissingMetadata(self: *MachO) !void {
12371237 .reserved3 = 0,
12381238 });
12391239
1240 const segment_size = mem.alignForwardGeneric(u64, file_size, 0x1000);
1240 const segment_size = mem.alignForwardGeneric(u64, file_size, 0x4000);
12411241 data_segment.vmsize = segment_size;
12421242 data_segment.filesize = segment_size;
12431243 data_segment.fileoff = off;