aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido G√ľnther <agx@sigxcpu.org>2009-04-26 14:57:08 +0200
committerGuido G√ľnther <agx@sigxcpu.org>2009-04-26 15:26:25 +0200
commit3c8b9481088b546af3f0fd161a432ba0f0cb682e (patch)
treee6a83124f6becb94abc6dfbd03b8bd6400170f81
parentd8a73fe012567565113419dc0c4678df5abe5bc5 (diff)
Move libc functions into a pseudo libc away from libarc
-rw-r--r--arclib/Makefile2
-rw-r--r--common/Makefile13
-rw-r--r--common/stddef.h (renamed from arclib/stddef.h)0
-rw-r--r--common/stdio.c (renamed from arclib/stdio.c)13
-rw-r--r--common/stdio.h (renamed from arclib/stdio.h)3
-rw-r--r--common/stdlib.c (renamed from arclib/stdlib.c)4
-rw-r--r--common/stdlib.h (renamed from arclib/stdlib.h)3
-rw-r--r--common/string.c (renamed from arclib/string.c)0
-rw-r--r--common/string.h (renamed from arclib/string.h)0
-rw-r--r--ext2load/Makefile4
10 files changed, 23 insertions, 19 deletions
diff --git a/arclib/Makefile b/arclib/Makefile
index 4a53c26..c519786 100644
--- a/arclib/Makefile
+++ b/arclib/Makefile
@@ -4,7 +4,7 @@
CFLAGS += -O2 -Werror -Wall -mno-abicalls -G 0 -fno-pic
TARGETS = libarc.a
-OBJECTS = arc.o stdio.o stdlib.o string.o
+OBJECTS = arc.o
all: $(TARGETS)
diff --git a/common/Makefile b/common/Makefile
index f1f75ca..8a1b06a 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -1,11 +1,18 @@
SUBARCH ?= IP22
-CFLAGS += -Wall -O2 -I. -I../arclib -DSUBARCH=${SUBARCH}
+CFLAGS += -Wall -O2 -I../arclib -mno-abicalls -G 0 -fno-pic -fno-builtin -I. -DSUBARCH=${SUBARCH}
HOSTCC = $(CC)
HOSTCFLAGS += -Wall -O2 -DSUBARCH=$(SUBARCH)
-all:
+TARGETS = libc.a
+OBJECTS = stdlib.o stdio.o string.o
+
+all: $(TARGETS)
+
+libc.a: $(OBJECTS)
+ rm -f $@
+ $(AR) -crs $@ $(OBJECTS)
clean:
- rm -f *~ tags
+ rm -f $(OBJECTS) *~ tags
diff --git a/arclib/stddef.h b/common/stddef.h
index 97ee87f..97ee87f 100644
--- a/arclib/stddef.h
+++ b/common/stddef.h
diff --git a/arclib/stdio.c b/common/stdio.c
index 333f9aa..2d94385 100644
--- a/arclib/stdio.c
+++ b/common/stdio.c
@@ -1,11 +1,10 @@
/*
* Copyright 1999 Silicon Graphics, Inc.
*/
-#include "arc.h"
#include "string.h"
-
#include "stdio.h"
+#include <arc.h>
#include <stdarg.h>
static FILE arc_stdin = ARC_STDIN;
@@ -17,8 +16,8 @@ FILE *stdout = &arc_stdout;
int fputs(const char *s, FILE * stream)
{
- LONG status;
- ULONG count;
+ long status;
+ unsigned long count;
if (strlen(s) > 0) {
status = ArcWrite(*stream, (char *) s, strlen(s), &count);
@@ -41,9 +40,9 @@ int puts(const char *s)
int fgetc(FILE * stream)
{
- LONG status;
- CHAR ch;
- ULONG count;
+ long status;
+ char ch;
+ unsigned long count;
status = ArcRead(*stream, &ch, sizeof(CHAR), &count);
if ((status != ESUCCESS) || (count != sizeof(CHAR)))
diff --git a/arclib/stdio.h b/common/stdio.h
index 4a29336..9ee52d3 100644
--- a/arclib/stdio.h
+++ b/common/stdio.h
@@ -4,10 +4,9 @@
#ifndef _STDIO_H_
#define _STDIO_H_
-#include "types.h"
#include <stdarg.h>
-typedef ULONG FILE;
+typedef unsigned long FILE;
#define EOF (-1)
diff --git a/arclib/stdlib.c b/common/stdlib.c
index 1377ff0..1d3355a 100644
--- a/arclib/stdlib.c
+++ b/common/stdlib.c
@@ -3,7 +3,6 @@
*/
#include "stdlib.h"
#include "string.h"
-#include "arc.h"
typedef struct _Node {
@@ -13,7 +12,6 @@ typedef struct _Node {
static Node *freeList = NULL;
-
void *malloc(size_t size)
{
Node **free, *mem;
@@ -109,7 +107,7 @@ void *realloc(void *ptr, size_t size)
}
-void arclib_malloc_add(ULONG start, ULONG size)
+void arclib_malloc_add(unsigned long start, unsigned long size)
{
Node *node = (Node *) start;
diff --git a/arclib/stdlib.h b/common/stdlib.h
index 7fb829f..8bd1e8b 100644
--- a/arclib/stdlib.h
+++ b/common/stdlib.h
@@ -5,12 +5,11 @@
#define _STDLIB_H_
#include "stddef.h"
-#include "types.h"
extern void *malloc(size_t size);
extern void free(void *ptr);
extern void *realloc(void *ptr, size_t size);
-extern void arclib_malloc_add(ULONG start, ULONG size);
+extern void arclib_malloc_add(unsigned long start, unsigned long size);
#endif /* _STDLIB_H_ */
diff --git a/arclib/string.c b/common/string.c
index 1c424c0..1c424c0 100644
--- a/arclib/string.c
+++ b/common/string.c
diff --git a/arclib/string.h b/common/string.h
index 04cf123..04cf123 100644
--- a/arclib/string.h
+++ b/common/string.h
diff --git a/ext2load/Makefile b/ext2load/Makefile
index f39ea51..3a06f08 100644
--- a/ext2load/Makefile
+++ b/ext2load/Makefile
@@ -15,8 +15,10 @@ ARCINCLUDEDIR = ../arclib
ARCLIBDIR = ../arclib
ARCLIB = $(ARCLIBDIR)/libarc.a
+LIBC = ../common/libc.a
+
OBJECTS = loader.o ext2io.o conffile.o
-LIBS = $(EXT2LIB) $(ARCLIB)
+LIBS = $(EXT2LIB) $(ARCLIB) $(LIBC)
TARGETS = ext2load
CFLAGS = -O2 -I$(COMMONDIR) -I$(ARCINCLUDEDIR) -I$(E2FSINCLUDEDIR) \