scc-patches

scc patches
Log | Files | Refs | README

0007-lib-c-Add-_cerrno.s-for-i386-linux.patch (2235B)


      1 From 3458863cfb5aa290cda1b143323fdc2650160212 Mon Sep 17 00:00:00 2001
      2 From: zerous Naveen Narayanan <zerous@nocebo.space>
      3 Date: Fri, 1 Nov 2019 15:24:43 +0100
      4 Subject: [PATCH 07/11] [lib/c] Add _cerrno.s for i386/linux
      5 
      6 Update Makefile
      7 Remove unused strings from umoddi3.s and udivdi3.s
      8 ---
      9  src/libc/arch/i386/linux/Makefile  |  7 +++++++
     10  src/libc/arch/i386/linux/_cerrno.s | 13 +++++++++++++
     11  src/libc/arch/i386/linux/udivdi3.s |  8 ++------
     12  src/libc/arch/i386/linux/umoddi3.s |  4 ----
     13  4 files changed, 22 insertions(+), 10 deletions(-)
     14  create mode 100644 src/libc/arch/i386/linux/_cerrno.s
     15 
     16 diff --git a/src/libc/arch/i386/linux/Makefile b/src/libc/arch/i386/linux/Makefile
     17 index 03ab52ec..3c8e18d0 100644
     18 --- a/src/libc/arch/i386/linux/Makefile
     19 +++ b/src/libc/arch/i386/linux/Makefile
     20 @@ -15,7 +15,12 @@ OBJS 	=\
     21  	_getpid.o\
     22  	_Exit.o\
     23  	_kill.o\
     24 +	_getheap.o\
     25  	crt.o\
     26 +	_cerrno.o\
     27 +	umoddi3.o\
     28 +	udivdi3.o\
     29 +	raise.o\
     30  
     31  all: syscall
     32  	$(MAKE) objs
     33 @@ -24,6 +29,8 @@ objs: $(OBJS)
     34  
     35  crt.o:	../crt-posix.s
     36  
     37 +_getheap.o:	../../posix/_getheap.c
     38 +
     39  syscall: syscall.lst
     40  	gensys.sh syscall.lst
     41  	touch syscall
     42 diff --git a/src/libc/arch/i386/linux/_cerrno.s b/src/libc/arch/i386/linux/_cerrno.s
     43 new file mode 100644
     44 index 00000000..51c61b71
     45 --- /dev/null
     46 +++ b/src/libc/arch/i386/linux/_cerrno.s
     47 @@ -0,0 +1,13 @@
     48 +	.file	"_cerrno.s"
     49 +	.globl	_cerrno
     50 +
     51 +_cerrno:
     52 +	cmpl	$0,%eax
     53 +	js	1f
     54 +	ret
     55 +
     56 +1:	neg	%eax
     57 +	mov	%eax,(errno)
     58 +	mov	$-1,%eax
     59 +	ret
     60 +	
     61 diff --git a/src/libc/arch/i386/linux/udivdi3.s b/src/libc/arch/i386/linux/udivdi3.s
     62 index 588d7124..45a0f289 100644
     63 --- a/src/libc/arch/i386/linux/udivdi3.s
     64 +++ b/src/libc/arch/i386/linux/udivdi3.s
     65 @@ -1,9 +1,5 @@
     66 -	.file	"umoddi3.s"
     67 -	.section	.rodata
     68 -errmsg:
     69 -	.string	"floating point exception\n"
     70 -	.equ	msgsz,.-errmsg-1
     71 -	
     72 +	.file	"umoddi3.s"	
     73 +
     74  	.text
     75  	.globl	__udivdi3
     76  	.type	__udivdi3,@function
     77 diff --git a/src/libc/arch/i386/linux/umoddi3.s b/src/libc/arch/i386/linux/umoddi3.s
     78 index 404a4f30..dc39c665 100644
     79 --- a/src/libc/arch/i386/linux/umoddi3.s
     80 +++ b/src/libc/arch/i386/linux/umoddi3.s
     81 @@ -1,8 +1,4 @@
     82  	.file	"umoddi3.s"
     83 -	.section	.rodata
     84 -errmsg:
     85 -	.string	"floating point exception\n"
     86 -	.equ	msgsz,.-errmsg-1
     87  	
     88  	.text
     89  	.globl	__umoddi3
     90 -- 
     91 2.23.0
     92