| ... | ... | @@ -193,8 +193,8 @@ pub fn flushStaticLib(macho_file: *MachO, comp: *Compilation, module_obj_path: ? |
| 193 | 193 | // Update file offsets of contributing objects |
| 194 | 194 | const total_size: usize = blk: { |
| 195 | 195 | var pos: usize = Archive.SARMAG; |
| 196 | | pos += @sizeOf(Archive.ar_hdr) + Archive.SYMDEF.len + 1; |
| 197 | | pos = mem.alignForward(usize, pos, ptr_width); |
| 196 | pos += @sizeOf(Archive.ar_hdr); |
| 197 | pos += mem.alignForward(usize, Archive.SYMDEF.len + 1, ptr_width); |
| 198 | 198 | pos += ar_symtab.size(format); |
| 199 | 199 | |
| 200 | 200 | for (files.items) |index| { |
| ... | ... | @@ -209,10 +209,10 @@ pub fn flushStaticLib(macho_file: *MachO, comp: *Compilation, module_obj_path: ? |
| 209 | 209 | .object => |x| x.path, |
| 210 | 210 | else => unreachable, |
| 211 | 211 | }; |
| 212 | | pos = mem.alignForward(usize, pos, ptr_width); |
| 212 | pos = mem.alignForward(usize, pos, 2); |
| 213 | 213 | state.file_off = pos; |
| 214 | | pos += @sizeOf(Archive.ar_hdr) + path.len + 1; |
| 215 | | pos = mem.alignForward(usize, pos, ptr_width); |
| 214 | pos += @sizeOf(Archive.ar_hdr); |
| 215 | pos += mem.alignForward(usize, path.len + 1, ptr_width); |
| 216 | 216 | pos += math.cast(usize, state.size) orelse return error.Overflow; |
| 217 | 217 | } |
| 218 | 218 | |
| ... | ... | @@ -236,7 +236,7 @@ pub fn flushStaticLib(macho_file: *MachO, comp: *Compilation, module_obj_path: ? |
| 236 | 236 | |
| 237 | 237 | // Write object files |
| 238 | 238 | for (files.items) |index| { |
| 239 | | const aligned = mem.alignForward(usize, buffer.items.len, ptr_width); |
| 239 | const aligned = mem.alignForward(usize, buffer.items.len, 2); |
| 240 | 240 | const padding = aligned - buffer.items.len; |
| 241 | 241 | if (padding > 0) { |
| 242 | 242 | try writer.writeByteNTimes(0, padding); |