shithub: mc

Download patch

ref: 1ed38b41793a7e5eac6c8280749ccf066577fa68
parent: 858ba07669c28ac1e8e88ef0283fb71615cd86c4
author: snocl <[email protected]>
date: Tue Dec 5 16:09:39 EST 2017

Align the stack in _start.

--- a/rt/start-freebsd.s
+++ b/rt/start-freebsd.s
@@ -15,6 +15,8 @@
  */
 .globl _start
 _start:
+	andq	$-16,%rsp		/* align the stack pointer */
+
 	/* load argc, argv, envp from stack */
 	movq	(%rdi),%rax		/* argc */
 	leaq	8(%rdi),%rbx		/* argv */
--- a/rt/start-linux.s
+++ b/rt/start-linux.s
@@ -16,6 +16,7 @@
 .globl _start
 _start:
 	movq	%rsp,%rbp
+	andq	$-16,%rsp		/* align the stack pointer */
 
 	/* load argc, argv, envp from stack */
 	movq	(%rbp),%rax		/* argc */
--- a/rt/start-netbsd.s
+++ b/rt/start-netbsd.s
@@ -24,6 +24,7 @@
 .globl _start
 _start:
 	movq	%rsp,%rbp
+	andq	$-16,%rsp		/* align the stack pointer */
 
 	/* load argc, argv, envp from stack */
 	movq	(%rbp),%rax		/* argc */
--- a/rt/start-openbsd.s
+++ b/rt/start-openbsd.s
@@ -25,6 +25,7 @@
 .globl _start
 _start:
 	movq	%rsp,%rbp
+	andq	$-16,%rsp		/* align the stack pointer */
 
 	/* load argc, argv, envp from stack */
 	movq	(%rbp),%rax		/* argc */
--- a/rt/start-osx.s
+++ b/rt/start-osx.s
@@ -16,6 +16,7 @@
 .globl start
 start:
 	movq	%rsp,%rbp
+	andq	$-16,%rsp		/* align the stack pointer */
 
 	/* load argc, argv, envp from stack */
 	movq	(%rbp),%rax		/* argc */