mirror of git://git.musl-libc.org/musl
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].
This commit is contained in:
parent
efe9751468
commit
259071c249
|
@ -14,6 +14,7 @@ _start:
|
||||||
lw $5, ($sp) # Get argc...
|
lw $5, ($sp) # Get argc...
|
||||||
addu $6, $sp, 4 # and argv ...
|
addu $6, $sp, 4 # and argv ...
|
||||||
lw $7, %call16(_init)($gp) # and _init() ...
|
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.
|
addi $sp, $sp, -4*6 # Leave space for arguments 0..3, arg4, and arg5.
|
||||||
lw $12, %call16(_fini)($gp) # and _fini() ...
|
lw $12, %call16(_fini)($gp) # and _fini() ...
|
||||||
sw $12, 4*4($sp) # Save arg4.
|
sw $12, 4*4($sp) # Save arg4.
|
||||||
|
|
Loading…
Reference in New Issue