scc

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

commit b5aa89ba22f93e3fe5d5edbe35badce27ab37a1f
parent 06ac542c1d1eef0a4b0801f321a1efa65129804d
Author: zerous Naveen Narayanan <zerous@nocebo.space>
Date:   Wed,  4 Sep 2019 00:19:01 +0200

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

Diffstat:
Msrc/libc/arch/Makefile | 2+-
Asrc/libc/arch/i386/Makefile | 14++++++++++++++
Asrc/libc/arch/i386/crt-posix.s | 18++++++++++++++++++
Asrc/libc/arch/i386/darwin/Makefile | 10++++++++++
Asrc/libc/arch/i386/dragonfly/Makefile | 10++++++++++
Asrc/libc/arch/i386/linux/Makefile | 17+++++++++++++++++
Asrc/libc/arch/i386/linux/crt.s | 1+
Asrc/libc/arch/i386/netbsd/Makefile | 10++++++++++
Asrc/libc/arch/i386/openbsd/Makefile | 10++++++++++
9 files changed, 91 insertions(+), 1 deletion(-)

diff --git a/src/libc/arch/Makefile b/src/libc/arch/Makefile @@ -3,7 +3,7 @@ PROJECTDIR =../../.. include $(PROJECTDIR)/scripts/rules.mk include ../rules.mk -DIRS = amd64 arm32 arm64 +DIRS = amd64 arm32 arm64 i386 all: +@cd $(ARCH) && $(MAKE) diff --git a/src/libc/arch/i386/Makefile b/src/libc/arch/i386/Makefile @@ -0,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) diff --git a/src/libc/arch/i386/crt-posix.s b/src/libc/arch/i386/crt-posix.s @@ -0,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 diff --git a/src/libc/arch/i386/darwin/Makefile b/src/libc/arch/i386/darwin/Makefile @@ -0,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 diff --git a/src/libc/arch/i386/dragonfly/Makefile b/src/libc/arch/i386/dragonfly/Makefile @@ -0,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 diff --git a/src/libc/arch/i386/linux/Makefile b/src/libc/arch/i386/linux/Makefile @@ -0,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 diff --git a/src/libc/arch/i386/linux/crt.s b/src/libc/arch/i386/linux/crt.s @@ -0,0 +1 @@ + .include "../crt-posix.s" diff --git a/src/libc/arch/i386/netbsd/Makefile b/src/libc/arch/i386/netbsd/Makefile @@ -0,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 diff --git a/src/libc/arch/i386/openbsd/Makefile b/src/libc/arch/i386/openbsd/Makefile @@ -0,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