ref: a94bf959708854d93cb82e4d73eeffa108633036
parent: 074d2d430db947164948e6778259504aed29778c
author: zerous Naveen Narayanan <zerous@nocebo.space>
date: Sat Nov 16 08:43:48 EST 2019
Update crt-posix.s for i386/linux According to i386 ABI, function parameters should be passed over the stack.
--- a/src/libc/arch/i386/crt-posix.s
+++ b/src/libc/arch/i386/crt-posix.s
@@ -4,14 +4,17 @@
.long 0
.text
- .global start
+ .globl _start
_start:
movl %esp,%ebp
- movl (%ebp),%edi
- leal 8(%ebp),%esi
leal 16(%ebp,%edi,8),%edx
movl %edx,_environ
+ pushl %edx
+ leal 8(%ebp),%esi
+ pushl %esi
+ movl (%ebp),%edi
+ pushl %edi
call main
movl %eax,%edi