scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit e8e9a686078131d6daf0168af15352c2c6a9f219
parent cc91dc2eb3036c06b19a4388b44302b84fc94787
Author: zerous Naveen Narayanan <zerous@nocebo.space>
Date:   Sat, 16 Nov 2019 13:43:50 +0100

Add _cerrno.s, _getheap.c, raise.c & signal.c for i386/linux

Diffstat:
Msrc/libc/arch/i386/linux/Makefile | 10+++++++++-
Asrc/libc/arch/i386/linux/_cerrno.s | 12++++++++++++
Asrc/libc/arch/i386/linux/_getheap.c | 1+
Msrc/libc/arch/i386/linux/gensys.sh | 4++--
Asrc/libc/arch/i386/linux/raise.c | 1+
Asrc/libc/arch/i386/linux/signal.c | 1+
6 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/src/libc/arch/i386/linux/Makefile b/src/libc/arch/i386/linux/Makefile @@ -15,8 +15,12 @@ OBJS =\ _getpid.o\ _Exit.o\ _kill.o\ + _getheap.o\ crt.o\ signal.o\ + raise.o\ + _cerrno.o\ + signal.o all: syscall $(MAKE) objs @@ -25,10 +29,14 @@ objs: $(OBJS) crt.o: ../crt-posix.s +raise.o: ../../posix/raise.c + +signal.o: ../../posix/signal.c + syscall: syscall.lst gensys.sh syscall.lst touch syscall clean: - rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst` + rm -f `awk '/[0-9]*\t/{print $$2".s"}' syscall.lst` rm -f syscall _sys_errlist.c diff --git a/src/libc/arch/i386/linux/_cerrno.s b/src/libc/arch/i386/linux/_cerrno.s @@ -0,0 +1,12 @@ + .file "_cerrno.s" + .globl _cerrno + +_cerrno: + cmpl $0,%eax + js 1f + ret + +1: neg %eax + mov %eax,(errno) + mov $-1,%eax + ret diff --git a/src/libc/arch/i386/linux/_getheap.c b/src/libc/arch/i386/linux/_getheap.c @@ -0,0 +1 @@ +#include "../../posix/_getheap.c" diff --git a/src/libc/arch/i386/linux/gensys.sh b/src/libc/arch/i386/linux/gensys.sh @@ -1,7 +1,7 @@ #!/bin/sh -awk ' -NR > 1 {syscall=$2 +awk '/^[0-9]*\t/ { + syscall=$2 fname=$2".s" noper=$3 diff --git a/src/libc/arch/i386/linux/raise.c b/src/libc/arch/i386/linux/raise.c @@ -0,0 +1 @@ +#include "../../posix/raise.c" diff --git a/src/libc/arch/i386/linux/signal.c b/src/libc/arch/i386/linux/signal.c @@ -0,0 +1 @@ +#include "../../posix/signal.c"