summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-08-17 21:23:10 -0400
committerRich Felker <dalias@aerifal.cx>2012-08-17 21:23:10 -0400
commit259071c249643ecb5e6799422d45d053cb64d515 (patch)
tree696e5509d2910704d6d278c86e6252833de8b734
parentefe9751468aae9eefd2f43781ae6d46170d97512 (diff)
downloadmusl-259071c249643ecb5e6799422d45d053cb64d515.tar.gz
musl-259071c249643ecb5e6799422d45d053cb64d515.tar.bz2
musl-259071c249643ecb5e6799422d45d053cb64d515.tar.xz
musl-259071c249643ecb5e6799422d45d053cb64d515.zip
crt1 must align stack pointer on mips
it's naturally aligned when entered with the kernel argv array, but if ld.so has been invoked explicitly to run a program, the stack will not be aligned due to having thrown away argv[0].
-rw-r--r--crt/mips/crt1.s1
1 files changed, 1 insertions, 0 deletions
diff --git a/crt/mips/crt1.s b/crt/mips/crt1.s
index bdb7c1a7..093d7d56 100644
--- a/crt/mips/crt1.s
+++ b/crt/mips/crt1.s
@@ -14,6 +14,7 @@ _start:
lw $5, ($sp) # Get argc...
addu $6, $sp, 4 # and argv ...
lw $7, %call16(_init)($gp) # and _init() ...
+ and $sp, $sp, -8 # Align the stack pointer to 8 bytes
addi $sp, $sp, -4*6 # Leave space for arguments 0..3, arg4, and arg5.
lw $12, %call16(_fini)($gp) # and _fini() ...
sw $12, 4*4($sp) # Save arg4.