aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-04-11 12:13:08 +0200
committerlemon <lsof@mailbox.org>2026-04-11 12:13:08 +0200
commit116a53553bfc3f5c55fb532550b97be8fab4c200 (patch)
treeaf8f46c770013fae30e092f60e75545d66f48c86
parent87824748c3223f300dae9a725f823da02bff89d9 (diff)
x86-64/emit: fix stack arg offset for edgecases
It was wrong for functions that didn't use the frame pointer but took arguments in the stack
-rw-r--r--src/t_x86-64_emit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/t_x86-64_emit.c b/src/t_x86-64_emit.c
index 616ccf4..6079f3c 100644
--- a/src/t_x86-64_emit.c
+++ b/src/t_x86-64_emit.c
@@ -1360,7 +1360,6 @@ emitbin(Function *fn)
DS("\x55\x48\x89\xE5");
}
saverestore = npush = calleesave(pcode, fn);
- npush += !frame.usebp;
/* ensure stack is 16-byte aligned */
if (frame.usebp) {
@@ -1370,6 +1369,8 @@ emitbin(Function *fn)
fn->stksiz += 8;
frame.size += 8;
}
+ } else {
+ frame.size = npush*8;
}
frame.stksiz = fn->stksiz;