| ... | @@ -512,9 +512,11 @@ fn gen(self: *Self) InnerError!void { | ... | @@ -512,9 +512,11 @@ fn gen(self: *Self) InnerError!void { |
| 512 | }); | 512 | }); |
| 513 | } | 513 | } |
| 514 | while (self.stack_args_relocs.popOrNull()) |index| { | 514 | while (self.stack_args_relocs.popOrNull()) |index| { |
| | 515 | // TODO like above, gotta figure out the alignment shenanigans for macOS, etc. |
| | 516 | const adjustment = if (self.target.isDarwin()) 2 * stack_adjustment else stack_adjustment; |
| 515 | // +16 bytes to account for saved return address of the `call` instruction and | 517 | // +16 bytes to account for saved return address of the `call` instruction and |
| 516 | // `push rbp`. | 518 | // `push rbp`. |
| 517 | self.mir_instructions.items(.data)[index].imm += stack_adjustment + aligned_stack_end + 16; | 519 | self.mir_instructions.items(.data)[index].imm += adjustment + aligned_stack_end + 16; |
| 518 | } | 520 | } |
| 519 | } else { | 521 | } else { |
| 520 | _ = try self.addInst(.{ | 522 | _ = try self.addInst(.{ |