summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2020-03-15 12:08:51 -0700
committerOri Bernstein <ori@eigenstate.org>2020-03-15 12:08:51 -0700
commitd5bd2eea7d38b65c82ea48df9c10a32348c20a25 (patch)
tree4a10a4b0bcdab482d3b514197d0a0f224cd1cc17
parent334ffbc2750c2be18dbbf8dc3ebbe8b22e8a9db3 (diff)
downloadmc-d5bd2eea7d38b65c82ea48df9c10a32348c20a25.tar.gz
Align spilled arguments correctly for amd64 abi.
-rw-r--r--6/isel.c5
-rw-r--r--mbld/libs.myr2
-rw-r--r--parse/parse.h2
3 files changed, 7 insertions, 2 deletions
diff --git a/6/isel.c b/6/isel.c
index 0361578..4f90b0c 100644
--- a/6/isel.c
+++ b/6/isel.c
@@ -562,6 +562,7 @@ gencall(Isel *s, Node *n)
for (i = 0; i < nargs; i++) {
argsz = align(argsz, min(size(args[i]), Ptrsz));
argsz += size(args[i]);
+ argsz = align(argsz, 8);
}
argsz = align(argsz, 16);
stkbump = loclit(argsz, ModeQ);
@@ -578,6 +579,8 @@ gencall(Isel *s, Node *n)
argoff = alignto(argoff, exprtype(args[i]));
if (i >= vasplit)
vararg = 1;
+ else
+ argoff = align(argoff, 8);
if (stacknode(args[i])) {
src = locreg(ModeQ);
g(s, Ilea, arg, src, NULL);
@@ -998,6 +1001,8 @@ addarglocs(Isel *s, Func *fn)
argoff = alignto(argoff, decltype(arg));
if (i >= nargs)
vararg = 1;
+ else
+ argoff = align(argoff, 8);
if (stacknode(arg)) {
htput(s->stkoff, arg, itop(-(argoff + 2*Ptrsz)));
argoff += size(arg);
diff --git a/mbld/libs.myr b/mbld/libs.myr
index 19fd869..aca3a46 100644
--- a/mbld/libs.myr
+++ b/mbld/libs.myr
@@ -23,7 +23,7 @@ pkg bld =
;;
/* Keep in sync with parse/parse.h */
-const Abiversion = 21
+const Abiversion = 22
const builtlib = {b, mt, dep, dyndep
var ldep, l, u
diff --git a/parse/parse.h b/parse/parse.h
index 4fbbfa7..4fd6fd3 100644
--- a/parse/parse.h
+++ b/parse/parse.h
@@ -1,4 +1,4 @@
-#define Abiversion 21
+#define Abiversion 22
typedef struct Srcloc Srcloc;
typedef struct Tysubst Tysubst;