shithub: mc

Download patch

ref: d5bd2eea7d38b65c82ea48df9c10a32348c20a25
parent: 334ffbc2750c2be18dbbf8dc3ebbe8b22e8a9db3
author: Ori Bernstein <[email protected]>
date: Sun Mar 15 08:08:51 EDT 2020

Align spilled arguments correctly for amd64 abi.

--- a/6/isel.c
+++ b/6/isel.c
@@ -562,6 +562,7 @@
 	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 @@
 		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 @@
 		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);
--- a/mbld/libs.myr
+++ b/mbld/libs.myr
@@ -23,7 +23,7 @@
 ;;
 
 /* Keep in sync with parse/parse.h */
-const Abiversion = 21
+const Abiversion = 22
 
 const builtlib = {b, mt, dep, dyndep
 	var ldep, l, u
--- 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;