scc

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

commit fec580eda7bcb19f1b1a1e2670506cc2bd2d7e44
parent b6cdd6faa8852fe6e7e3c91c614f55f8f1f308e6
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 16 Jan 2019 22:31:35 +0000

[libc] Remove libcrt

Libc gets now all the functionality of libcrt.
In the current targets supported it is only
the crt.o.

Diffstat:
Msrc/Makefile | 2+-
Msrc/libc/Makefile.libc | 9+++++++--
Rsrc/libcrt/crt-amd64-darwin.s -> src/libc/arch/amd64/crt-posix.s | 0
Msrc/libc/arch/amd64/darwin/Makefile | 3+++
Asrc/libc/arch/amd64/darwin/crt.s | 1+
Msrc/libc/arch/amd64/dragonfly/Makefile | 3+++
Asrc/libc/arch/amd64/dragonfly/crt.s | 1+
Msrc/libc/arch/amd64/linux/Makefile | 3+++
Asrc/libc/arch/amd64/linux/crt.s | 1+
Msrc/libc/arch/amd64/netbsd/Makefile | 3+++
Asrc/libc/arch/amd64/netbsd/crt.s | 2++
Msrc/libc/arch/amd64/openbsd/Makefile | 3+++
Asrc/libc/arch/amd64/openbsd/crt.s | 2++
Rsrc/libcrt/crt-arm32-posix.s -> src/libc/arch/arm32/crt-posix.s | 0
Msrc/libc/arch/arm32/linux/Makefile | 3+++
Asrc/libc/arch/arm32/linux/crt.s | 1+
Rsrc/libcrt/crt-arm64-posix.s -> src/libc/arch/arm64/crt-posix.s | 0
Msrc/libc/arch/arm64/linux/Makefile | 3+++
Asrc/libc/arch/arm64/linux/crt.s | 1+
Rsrc/libcrt/crt-netbsd.s -> src/libc/arch/crt-netbsd.s | 0
Rsrc/libcrt/crt-openbsd.s -> src/libc/arch/crt-openbsd.s | 0
Dsrc/libcrt/Makefile | 11-----------
Dsrc/libcrt/crt-amd64-posix.s | 19-------------------
Dsrc/libcrt/crt-darwin.s | 1-
Dsrc/libcrt/crt-dragonfly.s | 1-
Dsrc/libcrt/crt-linux.s | 1-
26 files changed, 38 insertions(+), 36 deletions(-)

diff --git a/src/Makefile b/src/Makefile @@ -3,7 +3,7 @@ PROJECTDIR = .. include $(PROJECTDIR)/scripts/rules.mk -LIBS = libscc libc libcrt libmach +LIBS = libscc libc libmach DIRS = cmd $(LIBS) all: cmd diff --git a/src/libc/Makefile.libc b/src/libc/Makefile.libc @@ -4,9 +4,14 @@ include $(PROJECTDIR)/scripts/rules.mk include rules.mk include objlst.mk -TARGET = $(LIBCDIR)/libc.a +LIBC = $(LIBCDIR)/libc.a +CRT = $(LIBCDIR)/crt.o +TARGET = $(LIBC) $(CRT) all: $(TARGET) -$(TARGET): $(OBJS) +$(LIBC): $(OBJS) mklib -o $@ $? + +$(CRT): arch/$(ARCH)/$(SYS)/crt.o + cp arch/$(ARCH)/$(SYS)/crt.o $@ diff --git a/src/libcrt/crt-amd64-darwin.s b/src/libc/arch/amd64/crt-posix.s diff --git a/src/libc/arch/amd64/darwin/Makefile b/src/libc/arch/amd64/darwin/Makefile @@ -19,12 +19,15 @@ OBJS = __Exit.o \ signal.o \ time.o \ _sys_errlist.o \ + crt.o \ all: syscall $(MAKE) objs objs: $(OBJS) +crt.o: ../crt-posix.s + syscall: syscall.lst gensys.sh syscall.lst touch syscall diff --git a/src/libc/arch/amd64/darwin/crt.s b/src/libc/arch/amd64/darwin/crt.s @@ -0,0 +1 @@ + .include "../crt-posix.s" diff --git a/src/libc/arch/amd64/dragonfly/Makefile b/src/libc/arch/amd64/dragonfly/Makefile @@ -20,12 +20,15 @@ OBJS = _Exit.o \ signal.o \ time.o \ _sys_errlist.o \ + crt.o \ all: syscall $(MAKE) objs objs: $(OBJS) +crt.o: crt-posix.s + syscall: syscall.lst gensys.sh syscall.lst touch syscall diff --git a/src/libc/arch/amd64/dragonfly/crt.s b/src/libc/arch/amd64/dragonfly/crt.s @@ -0,0 +1 @@ + .include "../crt-posix.s" diff --git a/src/libc/arch/amd64/linux/Makefile b/src/libc/arch/amd64/linux/Makefile @@ -22,12 +22,15 @@ OBJS = _Exit.o \ signal.o \ time.o \ _sys_errlist.o \ + crt.o \ all: syscall $(MAKE) objs objs: $(OBJS) +crt.o: ../crt-posix.s + syscall: syscall.lst gensys.sh syscall.lst touch syscall diff --git a/src/libc/arch/amd64/linux/crt.s b/src/libc/arch/amd64/linux/crt.s @@ -0,0 +1 @@ + .include "../crt-posix.s" diff --git a/src/libc/arch/amd64/netbsd/Makefile b/src/libc/arch/amd64/netbsd/Makefile @@ -23,12 +23,15 @@ OBJS = _Exit.o \ signal.o \ time.o \ _sys_errlist.o \ + crt.o \ all: syscall $(MAKE) objs objs: $(OBJS) +crt.o: ../crt-posix.s ../../crt-netbsd.s + syscall: syscall.lst gensys.sh syscall.lst touch syscall diff --git a/src/libc/arch/amd64/netbsd/crt.s b/src/libc/arch/amd64/netbsd/crt.s @@ -0,0 +1,2 @@ + .include "../../crt-netbsd.s" + .include "../crt-posix.s" diff --git a/src/libc/arch/amd64/openbsd/Makefile b/src/libc/arch/amd64/openbsd/Makefile @@ -20,12 +20,15 @@ OBJS = _Exit.o \ signal.o \ time.o \ _sys_errlist.o \ + crt.o \ all: syscall $(MAKE) objs objs: $(OBJS) +crt.o: ../crt-posix.s ../../crt-openbsd.s + syscall: syscall.lst gensys.sh syscall.lst touch syscall diff --git a/src/libc/arch/amd64/openbsd/crt.s b/src/libc/arch/amd64/openbsd/crt.s @@ -0,0 +1,2 @@ + .include "../../crt-openbsd.s" + .include "../crt-posix.s" diff --git a/src/libcrt/crt-arm32-posix.s b/src/libc/arch/arm32/crt-posix.s diff --git a/src/libc/arch/arm32/linux/Makefile b/src/libc/arch/arm32/linux/Makefile @@ -22,12 +22,15 @@ OBJS = _Exit.o \ signal.o \ time.o \ _sys_errlist.o \ + crt.o \ all: syscall $(MAKE) objs objs: $(OBJS) +crt.o: ../crt-posix.s + syscall: syscall.lst gensys.sh syscall.lst touch syscall diff --git a/src/libc/arch/arm32/linux/crt.s b/src/libc/arch/arm32/linux/crt.s @@ -0,0 +1 @@ + .include "../crt-posix.s" diff --git a/src/libcrt/crt-arm64-posix.s b/src/libc/arch/arm64/crt-posix.s diff --git a/src/libc/arch/arm64/linux/Makefile b/src/libc/arch/arm64/linux/Makefile @@ -22,12 +22,15 @@ OBJS = _Exit.o \ signal.o \ time.o \ _sys_errlist.o \ + crt.o \ all: syscall $(MAKE) objs objs: $(OBJS) +crt.o: ../crt-posix.s + syscall: syscall.lst gensys.sh syscall.lst touch syscall diff --git a/src/libc/arch/arm64/linux/crt.s b/src/libc/arch/arm64/linux/crt.s @@ -0,0 +1 @@ + .include "../crt-posix.c" diff --git a/src/libcrt/crt-netbsd.s b/src/libc/arch/crt-netbsd.s diff --git a/src/libcrt/crt-openbsd.s b/src/libc/arch/crt-openbsd.s diff --git a/src/libcrt/Makefile b/src/libcrt/Makefile @@ -1,11 +0,0 @@ -.POSIX: -PROJECTDIR=../.. -include $(PROJECTDIR)/scripts/rules.mk - -OBJS = crt-$(SYS).o crt-$(ABI).o -TARGET = $(CRTDIR)/$(ARCH)-$(SYS)/crt.o - -all: $(TARGET) - -$(TARGET): $(OBJS) - $(LD) -r -o $@ $(OBJS) diff --git a/src/libcrt/crt-amd64-posix.s b/src/libcrt/crt-amd64-posix.s @@ -1,19 +0,0 @@ - .bss - .globl _environ -_environ: - .quad 0 - - .text - .global _start -_start: - movq %rsp,%rbp - - /* load argc, argv, envp from stack */ - movq (%rbp),%rdi /* argc */ - leaq 8(%rbp),%rsi /* argv */ - leaq 16(%rbp,%rdi,8),%rdx /* envp = argv + 8*argc + 8 */ - movq %rdx,_environ - - call main - movl %eax,%edi - jmp exit diff --git a/src/libcrt/crt-darwin.s b/src/libcrt/crt-darwin.s @@ -1 +0,0 @@ - .file "crt-darwin.s" diff --git a/src/libcrt/crt-dragonfly.s b/src/libcrt/crt-dragonfly.s @@ -1 +0,0 @@ - .file "crt-dragonfly.s" diff --git a/src/libcrt/crt-linux.s b/src/libcrt/crt-linux.s @@ -1 +0,0 @@ - .file "crt-linux.s"