scc

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

commit e71e1e190e6ee67707da53600ccca0a5190b6533
parent 279667d8ea28b3aad65091308047d742c2c1ea14
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 24 Jan 2020 09:22:56 +0100

libc: Add placeholder for ppc32

This is only a placeholder and it does not contain
actual code.

Diffstat:
Aconfig/conf/ppc32-linux.mk | 3+++
Aconfig/conf/ppc32-posix.mk | 3+++
Ainclude/bits/ppc32/arch/limits.h | 18++++++++++++++++++
Ainclude/bits/ppc32/arch/stddef.h | 9+++++++++
Ainclude/bits/ppc32/arch/stdint.h | 96+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ainclude/bits/ppc32/arch/stdio.h | 15+++++++++++++++
Ainclude/bits/ppc32/arch/stdlib.h | 14++++++++++++++
Ainclude/bits/ppc32/arch/string.h | 6++++++
Ainclude/bits/ppc32/arch/time.h | 8++++++++
Mscripts/libc-proto | 1+
Mscripts/proto | 14++++++++++++++
Msrc/libc/.gitignore | 1+
Msrc/libc/arch/Makefile | 7++++++-
Asrc/libc/arch/ppc32/Makefile | 30++++++++++++++++++++++++++++++
Asrc/libc/arch/ppc32/crt-posix.s | 0
Asrc/libc/arch/ppc32/deps.mk | 1+
Asrc/libc/arch/ppc32/linux/Makefile | 30++++++++++++++++++++++++++++++
Asrc/libc/arch/ppc32/linux/crt.s | 1+
Asrc/libc/arch/ppc32/linux/deps.mk | 1+
Asrc/libc/arch/ppc32/longjmp.s | 0
Asrc/libc/arch/ppc32/memchr.c | 1+
Asrc/libc/arch/ppc32/memcmp.c | 1+
Asrc/libc/arch/ppc32/memcpy.c | 1+
Asrc/libc/arch/ppc32/memmove.c | 1+
Asrc/libc/arch/ppc32/memset.c | 1+
Asrc/libc/arch/ppc32/setjmp.s | 0
Msrc/libc/rules.mk | 11+++++++++--
27 files changed, 271 insertions(+), 3 deletions(-)

diff --git a/config/conf/ppc32-linux.mk b/config/conf/ppc32-linux.mk @@ -0,0 +1,3 @@ +include $(PROJECTDIR)/config/conf/ppc32-posix.mk + +SYS = linux diff --git a/config/conf/ppc32-posix.mk b/config/conf/ppc32-posix.mk @@ -0,0 +1,3 @@ +ABI = ppc32-posix +ARCH = ppc32 +O = q diff --git a/include/bits/ppc32/arch/limits.h b/include/bits/ppc32/arch/limits.h @@ -0,0 +1,18 @@ +#define CHAR_BIT 8 +#define SCHAR_MAX 0x7F +#define SCHAR_MIN (-SCHAR_MAX - 1) +#define CHAR_MAX 0x7F +#define CHAR_MIN (-CHAR_MAX - 1) +#define UCHAR_MAX 0xFF +#define SHRT_MAX 0x7FFF +#define SHRT_MIN (-SHRT_MAX - 1) +#define USHRT_MAX 0xFFFF +#define INT_MAX 0x7FFFFFFF +#define INT_MIN (-INT_MAX - 1) +#define UINT_MAX 0xFFFFFFFF +#define LONG_MAX 0x7FFFFFFF +#define LONG_MIN (-LONG_MAX - 1) +#define ULONG_MAX 0xFFFFFFFF +#define LLONG_MAX 0x7FFFFFFFFFFFFFFF +#define LLONG_MIN (-LLONG_MAX - 1) +#define ULLONG_MAX 0xFFFFFFFFFFFFFFFF diff --git a/include/bits/ppc32/arch/stddef.h b/include/bits/ppc32/arch/stddef.h @@ -0,0 +1,9 @@ +#ifndef SIZET_ +typedef unsigned int size_t; +#define SIZET_ +#endif + +#ifndef _PTRDIFF_T +typedef long ptrdiff_t; +#define _PTRDIFF_T +#endif diff --git a/include/bits/ppc32/arch/stdint.h b/include/bits/ppc32/arch/stdint.h @@ -0,0 +1,96 @@ +#define INT8_MAX 0x7F +#define INT8_MIN (-INT8_MAX - 1) +#define UINT8_MAX 0xFF + +#define INT16_MAX 0x7FFF +#define INT16_MIN (-INT16_MAX - 1) +#define UINT16_MAX 0xFFFF + +#define INT32_MAX 0x7FFFFFFF +#define INT32_MIN (-INT32_MAX - 1) +#define UINT32_MAX 0xFFFFFFFF + +#define INT64_MAX 0x7FFFFFFFFFFFFFFF +#define INT64_MIN (-INT64_MAX - 1) +#define UINT64_MAX 0xFFFFFFFFFFFFFFFF + +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define UINT_LEAST8_MAX UINT8_MAX + +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define UINT_LEAST16_MAX UINT16_MAX + +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define UINT_LEAST32_MAX UINT32_MAX + +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +#define INT_FAST8_MIN INT32_MIN +#define INT_FAST8_MAX INT32_MAX +#define UINT_FAST8_MAX UINT32_MAX + +#define INT_FAST16_MIN INT32_MIN +#define INT_FAST16_MAX INT32_MAX +#define UINT_FAST16_MAX UINT32_MAX + +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define UINT_FAST32_MAX UINT32_MAX + +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST64_MAX UINT64_MAX + +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX + +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +#define PTRDIFF_MIN INT32_MIN +#define PTRDIFF_MAX INT32_MAX + +#define SIZE_MAX UINT32_MAX + +typedef signed char int8_t; +typedef short int16_t; +typedef int int32_t; +typedef long long int64_t; + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; + +typedef signed char int8_least_t; +typedef short int16_least_t; +typedef int int32_least_t; +typedef long long int64_least_t; + +typedef unsigned char uint8_least_t; +typedef unsigned short uint16_least_t; +typedef unsigned int uint32_least_t; +typedef unsigned long long uint64_least_t; + +typedef int int8_fast_t; +typedef int int16_fast_t; +typedef int int32_fast_t; +typedef long long int64_fast_t; + +typedef unsigned int uint8_fast_t; +typedef unsigned int uint16_fast_t; +typedef unsigned int uint32_fast_t; +typedef unsigned long long uint64_fast_t; + +typedef long intptr_t; +typedef unsigned long uintptr_t; + +typedef long long intmax_t; +typedef unsigned long long uintmax_t; diff --git a/include/bits/ppc32/arch/stdio.h b/include/bits/ppc32/arch/stdio.h @@ -0,0 +1,15 @@ +#ifndef _SIZET +typedef unsigned int size_t; +#define _SIZET +#endif + +#define BUFSIZ 512 +#define FILENAME_MAX 256 +#define FOPEN_MAX 16 + +#define TMP_MAX 25 +#define L_tmpnam 256 + +#define _TMPNAME "/tmp/tmp.0000000" + +typedef int fpos_t; diff --git a/include/bits/ppc32/arch/stdlib.h b/include/bits/ppc32/arch/stdlib.h @@ -0,0 +1,14 @@ +#ifndef SIZET_ +typedef unsigned int size_t; +#define SIZET_ +#endif + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +#ifndef _WCHAR_T +typedef int wchar_t; // TODO +#define _WCHAR_T +#endif + +#define _ALIGNTYPE long double diff --git a/include/bits/ppc32/arch/string.h b/include/bits/ppc32/arch/string.h @@ -0,0 +1,6 @@ +#ifndef SIZET_ +typedef unsigned int size_t; +#define SIZET_ +#endif + +#define __NUMCHARS 128 diff --git a/include/bits/ppc32/arch/time.h b/include/bits/ppc32/arch/time.h @@ -0,0 +1,8 @@ +#ifndef _SIZET +typedef unsigned int size_t; +#define _SIZET +#endif + +#define _MAXYEAR 9999 + +typedef long int time_t; diff --git a/scripts/libc-proto b/scripts/libc-proto @@ -3,6 +3,7 @@ libexec libexec/scc lib lib/scc +lib/scc/ppc32-linux lib/scc/i386-linux lib/scc/arm32-linux lib/scc/arm64-linux diff --git a/scripts/proto b/scripts/proto @@ -26,6 +26,10 @@ d 755 lib/scc/amd64-linux f 644 lib/scc/amd64-linux/libc.a f 644 lib/scc/amd64-linux/crt.o f 644 lib/scc/amd64-linux/libcrt.a +d 755 lib/scc/ppc32-linux +f 644 lib/scc/ppc32-linux/libc.a +f 644 lib/scc/ppc32-linux/crt.o +f 644 lib/scc/ppc32-linux/libcrt.a d 755 bin f 755 bin/ld f 755 bin/cpp @@ -101,6 +105,16 @@ f 644 include/bits/arm32/arch/stddef.h f 644 include/bits/arm32/arch/setjmp.h f 644 include/bits/arm32/arch/time.h f 644 include/bits/arm32/arch/stdint.h +d 755 include/bits/ppc32 +d 755 include/bits/ppc32/arch +f 644 include/bits/ppc32/arch/string.h +f 644 include/bits/ppc32/arch/limits.h +f 644 include/bits/ppc32/arch/stdlib.h +f 644 include/bits/ppc32/arch/stdio.h +f 644 include/bits/ppc32/arch/stddef.h +f 644 include/bits/ppc32/arch/setjmp.h +f 644 include/bits/ppc32/arch/time.h +f 644 include/bits/ppc32/arch/stdint.h d 755 include/bits/z80 d 755 include/bits/z80/arch f 644 include/bits/z80/arch/string.h diff --git a/src/libc/.gitignore b/src/libc/.gitignore @@ -2,4 +2,5 @@ *.7 *.8 *.z +*.q libc.lst diff --git a/src/libc/arch/Makefile b/src/libc/arch/Makefile @@ -3,7 +3,12 @@ PROJECTDIR =../../.. include $(PROJECTDIR)/scripts/rules.mk include ../rules.mk -DIRS = amd64 arm32 arm64 i386 +DIRS =\ + amd64\ + arm32\ + arm64\ + i386\ + ppc32\ all: +@cd $(ARCH) && $(MAKE) diff --git a/src/libc/arch/ppc32/Makefile b/src/libc/arch/ppc32/Makefile @@ -0,0 +1,30 @@ +.POSIX: +PROJECTDIR =../../../.. +include $(PROJECTDIR)/scripts/rules.mk +include ../../rules.mk + +OBJS =\ + longjmp.$O\ + setjmp.$O\ + memchr.$O\ + memcmp.$O\ + memcpy.$O\ + memmove.$O\ + memset.$O\ + +DIRS = linux + +all: $(LIBC) $(SYS) + +$(LIBC): $(OBJS) + $(MKLST) + +$(SYS): FORCE + +@cd $@ && $(MAKE) + +dep: inc-dep + +dep clean: + $(FORALL) + +include deps.mk diff --git a/src/libc/arch/ppc32/crt-posix.s b/src/libc/arch/ppc32/crt-posix.s diff --git a/src/libc/arch/ppc32/deps.mk b/src/libc/arch/ppc32/deps.mk @@ -0,0 +1 @@ +#deps diff --git a/src/libc/arch/ppc32/linux/Makefile b/src/libc/arch/ppc32/linux/Makefile @@ -0,0 +1,30 @@ +.POSIX: +PROJECTDIR =../../../../.. +include $(PROJECTDIR)/scripts/rules.mk +include ../../../rules.mk + +GENOBJS = + +GENSRC = $(GENOBJS:.$O=.s) + +OBJS = \ + $(GENOBJS)\ + +# Rules + +all: $(LIBC) $(CRT) + +$(LIBC): $(OBJS) + $(MKLST) + +crt.$O: ../crt-posix.s + +$(GENSRC): syscall.lst + gensys.sh $(@:.s=) + +dep: inc-dep + +clean: + rm -f $(GENSRC) + +include deps.mk diff --git a/src/libc/arch/ppc32/linux/crt.s b/src/libc/arch/ppc32/linux/crt.s @@ -0,0 +1 @@ + .include "../crt-posix.s" diff --git a/src/libc/arch/ppc32/linux/deps.mk b/src/libc/arch/ppc32/linux/deps.mk @@ -0,0 +1 @@ +#deps diff --git a/src/libc/arch/ppc32/longjmp.s b/src/libc/arch/ppc32/longjmp.s diff --git a/src/libc/arch/ppc32/memchr.c b/src/libc/arch/ppc32/memchr.c @@ -0,0 +1 @@ +#include "../../string/memchr.c" diff --git a/src/libc/arch/ppc32/memcmp.c b/src/libc/arch/ppc32/memcmp.c @@ -0,0 +1 @@ +#include "../../string/memcmp.c" diff --git a/src/libc/arch/ppc32/memcpy.c b/src/libc/arch/ppc32/memcpy.c @@ -0,0 +1 @@ +#include "../../string/memcpy.c" diff --git a/src/libc/arch/ppc32/memmove.c b/src/libc/arch/ppc32/memmove.c @@ -0,0 +1 @@ +#include "../../string/memmove.c" diff --git a/src/libc/arch/ppc32/memset.c b/src/libc/arch/ppc32/memset.c @@ -0,0 +1 @@ +#include "../../string/memset.c" diff --git a/src/libc/arch/ppc32/setjmp.s b/src/libc/arch/ppc32/setjmp.s diff --git a/src/libc/rules.mk b/src/libc/rules.mk @@ -17,7 +17,7 @@ MKLST = \ # Rules -.SUFFIXES: .6 .7 .8 .z +.SUFFIXES: .6 .7 .8 .z .q _sys_errlist.c: $(SYSERRNO) ../../mkerrstr $(SYSERRNO) @@ -28,7 +28,7 @@ $(CRT): crt.$O clean: clean-libc clean-libc: FORCE - rm -f *.6 *.7 *.8 *.z + rm -f *.6 *.7 *.8 *.z *.q # amd64-posix objects .c.6: @@ -64,3 +64,10 @@ clean-libc: FORCE .s.z: $(AS) $(SCC_ASFLAGS) $< -o $@ + +# ppc32 objects +.c.q: + $(CC) $(SCC_CFLAGS) -o $@ -c $< + +.s.q: + $(AS) $(SCC_ASFLAGS) $< -o $@