shithub: scc

Download patch

ref: ecf1b1b62ca8f0cca554c942ba02442397d21ad0
parent: a7553c3dc80894ae69ff122d45725131c9606231
author: zerous Naveen Narayanan <zerous@nocebo.space>
date: Tue Sep 3 20:19:01 EDT 2019

Add crt-posix.s/crt.s for i386/linux

diff: cannot open b/src/libc/arch/i386/darwin//null: file does not exist: 'b/src/libc/arch/i386/darwin//null' diff: cannot open b/src/libc/arch/i386/dragonfly//null: file does not exist: 'b/src/libc/arch/i386/dragonfly//null' diff: cannot open b/src/libc/arch/i386/linux//null: file does not exist: 'b/src/libc/arch/i386/linux//null' diff: cannot open b/src/libc/arch/i386/netbsd//null: file does not exist: 'b/src/libc/arch/i386/netbsd//null' diff: cannot open b/src/libc/arch/i386/openbsd//null: file does not exist: 'b/src/libc/arch/i386/openbsd//null' diff: cannot open b/src/libc/arch/i386//null: file does not exist: 'b/src/libc/arch/i386//null'
--- a/src/libc/arch/Makefile
+++ b/src/libc/arch/Makefile
@@ -3,7 +3,7 @@
 include $(PROJECTDIR)/scripts/rules.mk
 include ../rules.mk
 
-DIRS = amd64 arm32 arm64
+DIRS = amd64 arm32 arm64 i386
 
 all:
 	+@cd $(ARCH) && $(MAKE)
--- /dev/null
+++ b/src/libc/arch/i386/Makefile
@@ -1,0 +1,14 @@
+.POSIX:
+PROJECTDIR =../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+include ../../rules.mk
+
+DIRS = netbsd openbsd dragonfly linux darwin
+
+all: $(OBJS) $(SYS)
+
+$(SYS): FORCE
+	+@cd $@ && $(MAKE)
+
+clean:
+	$(FORALL)
--- /dev/null
+++ b/src/libc/arch/i386/crt-posix.s
@@ -1,0 +1,18 @@
+	.bss
+	.globl	_environ
+_environ:
+	.long	0
+
+	.text
+	.global	start
+_start:
+	movl	%esp,%ebp
+
+	movl	(%ebp),%edi
+	leal	8(%ebp),%esi
+	leal	16(%ebp,%edi,8),%edx
+	movl	%edx,_environ
+
+	call 	main
+	movl	%eax,%edi
+	jmp	exit
--- /dev/null
+++ b/src/libc/arch/i386/darwin/Makefile
@@ -1,0 +1,10 @@
+.POSIX:
+PROJECTDIR =../../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+include ../../../rules.mk
+
+all:
+
+clean:
+	rm -f `awk '/[0-9]*	_/ {print $$2".s"}' syscall.lst`
+	rm -f syscall _sys_errlist.c
--- /dev/null
+++ b/src/libc/arch/i386/dragonfly/Makefile
@@ -1,0 +1,10 @@
+.POSIX:
+PROJECTDIR =../../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+include ../../../rules.mk
+
+all:
+
+clean:
+	rm -f `awk '/[0-9]*	_/ {print $$2".s"}' syscall.lst`
+	rm -f syscall _sys_errlist.c
--- /dev/null
+++ b/src/libc/arch/i386/linux/Makefile
@@ -1,0 +1,17 @@
+.POSIX:
+PROJECTDIR =../../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+include ../../../rules.mk
+
+OBJS 	= crt.o
+
+all:
+	$(MAKE) objs
+
+objs: $(OBJS)
+
+crt.o:	../crt-posix.s
+
+clean:
+	rm -f `awk '/[0-9]*	_/ {print $$2".s"}' syscall.lst`
+	rm -f syscall _sys_errlist.c
--- /dev/null
+++ b/src/libc/arch/i386/linux/crt.s
@@ -1,0 +1,1 @@
+	.include	"../crt-posix.s"
--- /dev/null
+++ b/src/libc/arch/i386/netbsd/Makefile
@@ -1,0 +1,10 @@
+.POSIX:
+PROJECTDIR =../../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+include ../../../rules.mk
+
+all:
+
+clean:
+	rm -f `awk '/[0-9]*	_/ {print $$2".s"}' syscall.lst`
+	rm -f syscall _sys_errlist.c
--- /dev/null
+++ b/src/libc/arch/i386/openbsd/Makefile
@@ -1,0 +1,10 @@
+.POSIX:
+PROJECTDIR =../../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+include ../../../rules.mk
+
+all:
+
+clean:
+	rm -f `awk '/[0-9]*	_/ {print $$2".s"}' syscall.lst`
+	rm -f syscall _sys_errlist.c