authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-07-22 14:50:06+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-07-22 14:50:06+02:00
log773863150a96fcb9ddb3eccb585d10342d10cb78
tree6fdaa2bf681d9feb97fe3d72643385d2389c081b
parentca90efe88e3b354884a82d341936e5a0724d74c8

macho: fix incorrect prealloc in traditional path


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

src/link/MachO.zig+4-3
...@@ -425,7 +425,8 @@ pub fn flush(self: *MachO, comp: *Compilation) !void {...@@ -425,7 +425,8 @@ pub fn flush(self: *MachO, comp: *Compilation) !void {
425 }425 }
426 }426 }
427427
428 if (build_options.is_stage1) {428 const use_stage1 = build_options.is_stage1 and self.base.options.use_stage1;
429 if (use_stage1) {
429 return self.linkWithZld(comp);430 return self.linkWithZld(comp);
430 } else {431 } else {
431 switch (self.base.options.effectiveOutputMode()) {432 switch (self.base.options.effectiveOutputMode()) {
...@@ -3153,7 +3154,7 @@ fn writeSymbolTable(self: *MachO) !void {...@@ -3153,7 +3154,7 @@ fn writeSymbolTable(self: *MachO) !void {
3153 if (object.debug_info == null) continue;3154 if (object.debug_info == null) continue;
31543155
3155 // Open scope3156 // Open scope
3156 try locals.ensureUnusedCapacity(4);3157 try locals.ensureUnusedCapacity(3);
3157 locals.appendAssumeCapacity(.{3158 locals.appendAssumeCapacity(.{
3158 .n_strx = try self.makeString(object.tu_comp_dir.?),3159 .n_strx = try self.makeString(object.tu_comp_dir.?),
3159 .n_type = macho.N_SO,3160 .n_type = macho.N_SO,
...@@ -3192,7 +3193,7 @@ fn writeSymbolTable(self: *MachO) !void {...@@ -3192,7 +3193,7 @@ fn writeSymbolTable(self: *MachO) !void {
3192 }3193 }
31933194
3194 // Close scope3195 // Close scope
3195 locals.appendAssumeCapacity(.{3196 try locals.append(.{
3196 .n_strx = 0,3197 .n_strx = 0,
3197 .n_type = macho.N_SO,3198 .n_type = macho.N_SO,
3198 .n_sect = 0,3199 .n_sect = 0,