Skip to content

Commit eccf459

Browse files
committed
fix bug with external C function calls in x86_64
1 parent 6b7aaf0 commit eccf459

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/backends/x86_64.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ class BackendX86_64 : CompilerBackend {
649649
}
650650

651651
// align stack pointer
652-
output ~= "mov rbp, rsp\n";
652+
output ~= "mov rbx, rsp\n";
653653
output ~= "and rsp, 0xFFFFFFFFFFFFFFF0\n";
654654

655655
if ((word.params.length > 6) && (word.params.length % 2 != 0)) {
@@ -668,7 +668,7 @@ class BackendX86_64 : CompilerBackend {
668668
output ~= format("sub r15, %d\n", word.params.length * 8);
669669

670670
output ~= format("call %s\n", ExternSymbol(word.symbolName));
671-
output ~= "mov rsp, rbp\n";
671+
output ~= "mov rsp, rbx\n";
672672

673673
if (!word.isVoid) {
674674
output ~= "mov [r15], rax\n";

0 commit comments

Comments
 (0)