shithub: scc

Download patch

ref: 4e59e135f609876c0b76121c7fffd175c6f5ea29
parent: 1fcd39f3a818478f4d7da9bb333e02d06531ddd4
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Aug 24 16:19:41 EDT 2018

[tests/libc] Add basic support for NetBSD and OpenBSD

This patch adds the basic support for running the amd64
test based in the host system.

diff: cannot open b/lib/c/target/amd64-sysv-netbsd//null: file does not exist: 'b/lib/c/target/amd64-sysv-netbsd//null'
--- a/lib/c/target/Makefile
+++ b/lib/c/target/Makefile
@@ -4,13 +4,12 @@
 include $(PROJECTDIR)/rules.mk
 
 DIRS = amd64-sysv-linux \
-       amd64-sysv-openbsd
+       amd64-sysv-openbsd \
+       amd64-sysv-netbsd \
 
-#       i386-sysv-linux-elf \
-#       z80-scc-none-none
+all clean distclean:
+	$(FORALL)
 
 dep:
 	./script/objlst.sh
-
-all clean distclean:
 	$(FORALL)
--- /dev/null
+++ b/lib/c/target/amd64-sysv-netbsd/Makefile
@@ -1,0 +1,14 @@
+.POSIX:
+
+PROJECTDIR = ../../../..
+include $(PROJECTDIR)/rules.mk
+
+SYSNAME    = amd64-sysv-netbsd
+SCC_CFLAGS = -nostdinc -I$(INCDIR) -I$(INCDIR)/bits/amd64-sysv/
+SYSOBJ = raise.o
+
+include syscall.mk
+include ../script/objlst.mk
+include ../script/common.mk
+
+raise.o: ../posix/raise.c ../../syscall.h
--- /dev/null
+++ b/lib/c/target/amd64-sysv-netbsd/syscall.lst
@@ -1,0 +1,13 @@
+#number	name
+0	_read
+1	_write
+2	_open
+3	_close
+3	_lseek
+12	_brk
+13	_rt_sigaction
+38	_getpid
+60	_Exit
+32	_kill
+39	_getpid
+62	_kill
--- /dev/null
+++ b/lib/c/target/amd64-sysv-netbsd/syscall.mk
@@ -1,0 +1,1 @@
+SYSCALL = _read.o _write.o _open.o _close.o _lseek.o _brk.o _rt_sigaction.o _getpid.o _Exit.o _kill.o _getpid.o _kill.o 
--- a/lib/c/target/amd64-sysv-openbsd/Makefile
+++ b/lib/c/target/amd64-sysv-openbsd/Makefile
@@ -1,10 +1,14 @@
 .POSIX:
 
 PROJECTDIR = ../../../..
-SYSNAME    = amd64-sysv-openbsd
-
 include $(PROJECTDIR)/rules.mk
+
+SYSNAME    = amd64-sysv-netbsd
+SCC_CFLAGS = -nostdinc -I$(INCDIR) -I$(INCDIR)/bits/amd64-sysv/
+SYSOBJ = raise.o
+
+include syscall.mk
 include ../script/objlst.mk
 include ../script/common.mk
 
-SCC_CFLAGS = -nostdinc -I$(INCDIR) -I$(INCDIR)/bits/amd64-sysv/
+raise.o: ../posix/raise.c ../../syscall.h
--- /dev/null
+++ b/lib/c/target/amd64-sysv-openbsd/syscall.lst
@@ -1,0 +1,13 @@
+#number	name
+0	_read
+1	_write
+2	_open
+3	_close
+3	_lseek
+12	_brk
+13	_rt_sigaction
+38	_getpid
+60	_Exit
+32	_kill
+39	_getpid
+62	_kill
--- /dev/null
+++ b/lib/c/target/amd64-sysv-openbsd/syscall.mk
@@ -1,0 +1,1 @@
+SYSCALL = _read.o _write.o _open.o _close.o _lseek.o _brk.o _rt_sigaction.o _getpid.o _Exit.o _kill.o _getpid.o _kill.o 
--- a/tests/libc/execute/cc.sh
+++ b/tests/libc/execute/cc.sh
@@ -24,7 +24,7 @@
 	esac
 done
 
-sys=${sys:-linux}
+sys=${sys:-`uname | tr 'A-Z' 'a-z'`}
 abi=${abi:-amd64-sysv}
 root=${root:-$SCCPREFIX}
 inc=$root/include/scc