scc-patches

scc patches
Log | Files | Refs | README

0009-lib-c-Update-crt-posix.s-for-i386-linux.patch (928B)


      1 From 74c77c18854c2008b93e39cef1d6198a1f56a35e Mon Sep 17 00:00:00 2001
      2 From: zerous Naveen Narayanan <zerous@nocebo.space>
      3 Date: Fri, 1 Nov 2019 20:46:51 +0100
      4 Subject: [PATCH 09/10] [lib/c] Update crt-posix.s for i386/linux
      5 
      6 According to i386 ABI, function parameters should be passed over the
      7 stack.
      8 ---
      9  src/libc/arch/i386/crt-posix.s | 11 +++++++----
     10  1 file changed, 7 insertions(+), 4 deletions(-)
     11 
     12 diff --git a/src/libc/arch/i386/crt-posix.s b/src/libc/arch/i386/crt-posix.s
     13 index 88013697..ca0c7f1e 100644
     14 --- a/src/libc/arch/i386/crt-posix.s
     15 +++ b/src/libc/arch/i386/crt-posix.s
     16 @@ -2,16 +2,19 @@
     17  	.globl	_environ
     18  _environ:
     19  	.long	0
     20 -
     21 +	
     22  	.text
     23 -	.global	start
     24 +	.globl	_start
     25  _start:
     26  	movl	%esp,%ebp
     27  
     28 -	movl	(%ebp),%edi
     29 -	leal	8(%ebp),%esi
     30  	leal	16(%ebp,%edi,8),%edx
     31  	movl	%edx,_environ
     32 +	pushl	%edx
     33 +	leal	8(%ebp),%esi
     34 +	pushl	%esi
     35 +	movl	(%ebp),%edi
     36 +	pushl	%edi
     37  
     38  	call 	main
     39  	movl	%eax,%edi
     40 -- 
     41 2.23.0
     42