summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsnocl <snorredc@gmail.com>2017-12-05 21:09:39 +0100
committerOri Bernstein <ori@eigenstate.org>2017-12-05 13:31:35 -0800
commit1ed38b41793a7e5eac6c8280749ccf066577fa68 (patch)
tree30374701880dbfb8ea99add8e9e6fda68117c868
parent858ba07669c28ac1e8e88ef0283fb71615cd86c4 (diff)
downloadmc-1ed38b41793a7e5eac6c8280749ccf066577fa68.tar.gz
Align the stack in _start.
-rw-r--r--rt/start-freebsd.s2
-rw-r--r--rt/start-linux.s1
-rw-r--r--rt/start-netbsd.s1
-rw-r--r--rt/start-openbsd.s1
-rw-r--r--rt/start-osx.s1
5 files changed, 6 insertions, 0 deletions
diff --git a/rt/start-freebsd.s b/rt/start-freebsd.s
index e3795af..9c1091b 100644
--- a/rt/start-freebsd.s
+++ b/rt/start-freebsd.s
@@ -15,6 +15,8 @@ sys$__cenvp:
*/
.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 */
diff --git a/rt/start-linux.s b/rt/start-linux.s
index 0c6cf3f..742b4a3 100644
--- a/rt/start-linux.s
+++ b/rt/start-linux.s
@@ -16,6 +16,7 @@ sys$__cenvp:
.globl _start
_start:
movq %rsp,%rbp
+ andq $-16,%rsp /* align the stack pointer */
/* load argc, argv, envp from stack */
movq (%rbp),%rax /* argc */
diff --git a/rt/start-netbsd.s b/rt/start-netbsd.s
index a5eecc4..dd3213e 100644
--- a/rt/start-netbsd.s
+++ b/rt/start-netbsd.s
@@ -24,6 +24,7 @@ sys$__cenvp:
.globl _start
_start:
movq %rsp,%rbp
+ andq $-16,%rsp /* align the stack pointer */
/* load argc, argv, envp from stack */
movq (%rbp),%rax /* argc */
diff --git a/rt/start-openbsd.s b/rt/start-openbsd.s
index b96e12b..d11dafa 100644
--- a/rt/start-openbsd.s
+++ b/rt/start-openbsd.s
@@ -25,6 +25,7 @@ sys$__cenvp:
.globl _start
_start:
movq %rsp,%rbp
+ andq $-16,%rsp /* align the stack pointer */
/* load argc, argv, envp from stack */
movq (%rbp),%rax /* argc */
diff --git a/rt/start-osx.s b/rt/start-osx.s
index d904746..b43b30c 100644
--- a/rt/start-osx.s
+++ b/rt/start-osx.s
@@ -16,6 +16,7 @@ _sys$__cenvp:
.globl start
start:
movq %rsp,%rbp
+ andq $-16,%rsp /* align the stack pointer */
/* load argc, argv, envp from stack */
movq (%rbp),%rax /* argc */