Permalink
Browse files

Replace gocc with gcc

  • Loading branch information...
tatsumack committed Mar 22, 2017
1 parent 877ec9d commit ab4b5d483e32b52d04e40306acd4d44e71672fcf
View
@@ -0,0 +1,26 @@
+TARGET = libgolibc.a
+STACKSIZE =
+MALLOCSIZE =
+MMAREA =
+OBJS = abs.o atof.o atoi.o errno.o frexp.o ldexp.o \
+ memchr.o memcmp.o memmove.o memset.o qsort.o rand.o \
+ sprintf.o strcat.o strcmp.o strcpy.o strcspn.o strdup.o \
+ strlen.o strncat.o strncmp.o strncpy.o strpbrk.o strrchr.o \
+ strspn.o strstr.o strtol.o strtoul.o strtoul0.o vsprintf.o
+
+GCC = /usr/local/i386elfgcc/bin/i386-elf-gcc
+CFLAGS = -I. -fno-common -Wall -O2 -c \
+ -finhibit-size-directive -fno-ident \
+ -fomit-frame-pointer -fcall-used-ebx
+AR = /usr/local/i386elfgcc/bin/i386-elf-ar
+RANLIB = /usr/local/i386elfgcc/bin/i386-elf-ranlib
+
+ALL : ${OBJS}
+ ${AR} rv ${TARGET} ${OBJS}
+ ${RANLIB} ${TARGET}
+
+%.o : %.c Makefile
+ ${GCC} ${CFLAGS} $<
+
+clean :
+ rm -f *.o ${TARGET}
View
@@ -0,0 +1,44 @@
+F ABS.C;1 abs.c
+F ATOF.C;1 atof.c
+F ATOI.C;1 atoi.c
+F ERRNO.C;1 errno.c
+F ERRNO.H;1 errno.h
+F FLOAT.H;1 float.h
+F FREXP.C;1 frexp.c
+F LDEXP.C;1 ldexp.c
+F LIMITS.H;1 limits.h
+F MAKEFILE.;1 Makefile
+F MATH.H;1 math.h
+F MEMCHR.C;1 memchr.c
+F MEMCMP.C;1 memcmp.c
+F MEMCPY.C;1 memcpy.c
+F MEMMOVE.C;1 memmove.c
+F MEMSET.C;1 memset.c
+F QSORT.C;1 qsort.c
+F RAND.C_;1 rand.c_
+F RAND.NAS;1 rand.nas
+F SETJMP.H;1 setjmp.h
+F SPRINTF.C;1 sprintf.c
+F STDARG.H;1 stdarg.h
+F STDDEF.H;1 stddef.h
+F STDIO.H;1 stdio.h
+F STDLIB.H;1 stdlib.h
+F STRCAT.C;1 strcat.c
+F STRCHR.C;1 strchr.c
+F STRCMP.C;1 strcmp.c
+F STRCPY.C;1 strcpy.c
+F STRCSPN.C;1 strcspn.c
+F STRDUP.C;1 strdup.c
+F STRING.H;1 string.h
+F STRLEN.C;1 strlen.c
+F STRNCAT.C;1 strncat.c
+F STRNCMP.C;1 strncmp.c
+F STRNCPY.C;1 strncpy.c
+F STRPBRK.C;1 strpbrk.c
+F STRRCHR.C;1 strrchr.c
+F STRSPN.C;1 strspn.c
+F STRSTR.C;1 strstr.c
+F STRTOL.C;1 strtol.c
+F STRTOUL.C;1 strtoul.c
+F STRTOUL0.C;1 strtoul0.c
+F VSPRINTF.C;1 vsprintf.c
View
@@ -0,0 +1,8 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */
+
+int abs(int n)
+{
+ if (n < 0)
+ n = - n;
+ return n;
+}
View
@@ -0,0 +1,9 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */
+
+#include <stdlib.h> /* strtod */
+#include <stdio.h> /* NULL */
+
+double atof(const char *s)
+{
+ return strtod(s, (const char **) NULL);
+}
View
@@ -0,0 +1,9 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */
+
+#include <stdlib.h> /* strtol */
+#include <stdio.h> /* NULL */
+
+int atoi(const char *s)
+{
+ return (int) strtol(s, (const char **) NULL, 10);
+}
View
@@ -0,0 +1 @@
+int errno = 0;
View
@@ -0,0 +1,20 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */
+
+#if (!defined(ERRNO_H))
+
+#define ERRNO_H 1
+
+#if (defined(__cplusplus))
+ extern "C" {
+#endif
+
+extern int errno;
+
+#define ENOENT 2 /* No such file or directory */
+#define ERANGE 34 /* Result too large (or too small) */
+
+#if (defined(__cplusplus))
+ }
+#endif
+
+#endif
View
@@ -0,0 +1,26 @@
+/* copyright(C) 2002 H.Kawai (under KL-01). */
+
+#if (!defined(FLOAT_H))
+
+#define FLOAT_H 1
+
+#define FLT_RADIX 2
+#define FLT_ROUNDS 1 /* nearest */
+#define FLT_DIG 6
+#define FLT_EPSILON 1.19209290e-07F
+#define FLT_MANT_DIG 24
+#define FLT_MAX 3.40282347e+38F
+#define FLT_MAX_EXP (+128)
+#define FLT_MIN 1.17549435e-38F
+#define FLT_MIN_EXP (-125)
+
+#define DBL_DIG 15
+#define DBL_EPSILON 2.2204460492503131e-16
+#define DBL_MANT_DIG 53
+#define DBL_MAX 1.7976931348623157e+308
+#define DBL_MAX_EXP 1024
+#define DBL_MIN 2.2250738585072014e-308
+#define DBL_MIN_EXP (-1021)
+
+#endif
+
View
@@ -0,0 +1,27 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */
+
+double frexp(double x, int *exp)
+{
+ int n = 0;
+ double s = 1.0;
+ if (x < 0.0) {
+ x = - x;
+ s = -1.0;
+ }
+ if (x != 0.0) {
+ if (x >= 1.0) {
+ do {
+ n++;
+ x *= 0.5;
+ } while (x >= 1.0);
+ }
+ if (x < 0.5) {
+ do {
+ n--;
+ x *= 2.0;
+ } while (x < 0.5);
+ }
+ }
+ *exp = n;
+ return x * s;
+}
View
@@ -0,0 +1,16 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */
+
+double ldexp(double x, int n)
+{
+ if (n > 0) {
+ do {
+ x *= 2.0;
+ } while (--n);
+ }
+ if (n < 0) {
+ do {
+ x *= 0.5;
+ } while (++n);
+ }
+ return x;
+}
View
@@ -0,0 +1,23 @@
+/* copyright(C) 2002 H.Kawai (under KL-01). */
+
+#if (!defined(LIMITS_H))
+
+#define LIMITS_H 1
+
+#define CHAR_BIT 8
+#define CHAR_MAX (+127)
+#define CHAR_MIN 0
+#define INT_MAX (+0x7fffffff)
+#define INT_MIN (-0x7fffffff)
+#define LONG_MAX INT_MAX
+#define LONG_MIN INT_MIN
+#define SCHAR_MAX (+127)
+#define SCHAR_MIN (-127)
+#define SHRT_MAX (+0x7fff)
+#define SHRT_MIN (-0x7fff)
+#define UCHAR_MAX (+0xff)
+#define UINT_MAX (+0xffffffff)
+#define ULONG_MAX UINT_MAX
+#define USHRT_MAX (+0xffff)
+
+#endif
View
@@ -0,0 +1,42 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */
+
+#if (!defined(MATH_H))
+
+#define MATH_H 1
+
+#if (defined(__cplusplus))
+ extern "C" {
+#endif
+
+double sin(double);
+double cos(double);
+double sqrt(double);
+double ldexp(double x, int n);
+double frexp(double x, int *exp);
+
+extern __inline__ double sin(double x)
+{
+ double res;
+ __asm__ ("fsin" : "=t" (res) : "0" (x));
+ return res;
+}
+
+extern __inline__ double cos(double x)
+{
+ double res;
+ __asm__ ("fcos" : "=t" (res) : "0" (x));
+ return res;
+}
+
+extern __inline__ double sqrt(double x)
+{
+ double res;
+ __asm__ ("fsqrt" : "=t" (res) : "0" (x));
+ return res;
+}
+
+#if (defined(__cplusplus))
+ }
+#endif
+
+#endif
View
@@ -0,0 +1,23 @@
+//*****************************************************************************
+// memchr.c : memory function
+// 2002/02/04 by Gaku : this is rough sketch
+//*****************************************************************************
+
+#include <stdio.h>
+#include <stddef.h>
+
+//=============================================================================
+// search SZ bytes of D for C
+//=============================================================================
+void* memchr (void *d, int c, size_t sz)
+{
+ char *dp = (char*)d;
+
+ while (sz--) {
+ if (c == *dp)
+ return dp;
+ dp++;
+ }
+
+ return NULL;
+}
View
@@ -0,0 +1,24 @@
+//*****************************************************************************
+// memcmp.c : memory function
+// 2002/02/04 by Gaku : this is rough sketch
+//*****************************************************************************
+
+#include <stddef.h>
+
+//=============================================================================
+// compare SZ bytes of D and S
+//=============================================================================
+int memcmp (const void *d, const void *s, size_t sz)
+{
+ const char *dp = (const char*) d;
+ const char *sp = (const char*) s;
+
+ while (sz--) {
+ if (*dp != *sp)
+ return *dp - *sp;
+ dp++;
+ sp++;
+ }
+
+ return 0;
+}
View
@@ -0,0 +1,21 @@
+//*****************************************************************************
+// memcpy.c : memory function
+// 2002/02/04 by Gaku : this is rough sketch
+//*****************************************************************************
+
+#include <stddef.h>
+
+//=============================================================================
+// copy SZ bytes of S to D
+//=============================================================================
+void* memcpy (void *d, void *s, size_t sz)
+{
+ void *tmp = d;
+ char *dp = (char*)d;
+ char *sp = (char*)s;
+
+ while (sz--)
+ *dp++ = *sp++;
+
+ return tmp;
+}
View
@@ -0,0 +1,29 @@
+//*****************************************************************************
+// memmove.c : memory function
+// 2002/02/04 by Gaku : this is rough sketch
+//*****************************************************************************
+
+#include <stddef.h>
+
+//=============================================================================
+// copy SZ bytes of S to D
+// * guarantee - acceptable result for overlaped strings
+//=============================================================================
+void* memmove (void *d, void *s, size_t sz)
+{
+ void *tmp = d;
+ char *dp = (char*)d;
+ char *sp = (char*)s;
+
+ if (dp > sp) {
+ dp += sz;
+ sp += sz;
+ while (sz--)
+ *--dp = *--sp;
+ } else {
+ while (sz--)
+ *dp++ = *sp++;
+ }
+
+ return tmp;
+}
View
@@ -0,0 +1,20 @@
+//*****************************************************************************
+// memset.c : memory function
+// 2002/02/04 by Gaku : this is rough sketch
+//*****************************************************************************
+
+#include <stddef.h>
+
+//=============================================================================
+// set SZ bytes of S to C
+//=============================================================================
+void * memset (void *d, int c, size_t sz)
+{
+ void *tmp = d;
+ char *dp = (char*)d;
+
+ while (sz--)
+ *dp++ = c;
+
+ return tmp;
+}
Oops, something went wrong.

0 comments on commit ab4b5d4

Please sign in to comment.