aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk@arm.linux.org.uk>2002-08-23 23:11:01 +0000
committerH. Peter Anvin <hpa@zytor.com>2002-08-23 23:11:01 +0000
commita85e07743a0dd0c1de0e5650c259b4d34e8b9236 (patch)
treeab929ad2ade68c1ec6d2bebb8a9e1507f5c4a9fc
parent7c07997dd59d9b3fab322f0ab00459d9456b613c (diff)
downloadklibc-a85e07743a0dd0c1de0e5650c259b4d34e8b9236.tar.gz
gcc 3.2 issues. asm fixes. Make sure we clean up when we make a new hash.klibc-0.59
-rw-r--r--include/stdio.h3
-rw-r--r--klibc/Makefile4
-rw-r--r--klibc/fputc.c14
-rw-r--r--klibc/include/stdio.h3
-rw-r--r--klibc/memcpy.c6
-rw-r--r--klibc/memset.c6
6 files changed, 30 insertions, 6 deletions
diff --git a/include/stdio.h b/include/stdio.h
index 7bcf32ea3807f..d51e969c4fb92 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -66,6 +66,9 @@ static __inline__ off_t ftell(FILE *__f)
__extern int fputs(const char *, FILE *);
__extern int puts(const char *);
+__extern int fputc(int, FILE *);
+#define putc(c,f) fputc((c),(f))
+#define putchar(c) fputc((c),stdout)
__extern size_t _fread(void *, size_t, FILE *);
__extern size_t _fwrite(const void *, size_t, FILE *);
diff --git a/klibc/Makefile b/klibc/Makefile
index e3ecdb5df110a..23a8f347f64b8 100644
--- a/klibc/Makefile
+++ b/klibc/Makefile
@@ -19,7 +19,7 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \
execl.o execle.o execv.o execvpe.o execvp.o execlp.o execlpe.o \
fork.o wait.o wait3.o waitpid.o setpgrp.o \
printf.o vprintf.o fprintf.o vfprintf.o perror.o \
- fopen.o fread.o fread2.o fwrite.o fwrite2.o fputs.o puts.o \
+ fopen.o fread.o fread2.o fwrite.o fwrite2.o fputc.o fputs.o puts.o \
sleep.o usleep.o raise.o abort.o assert.o alarm.o pause.o \
signal.o siglist.o siglongjmp.o \
sigaction.o sigpending.o sigprocmask.o sigsuspend.o \
@@ -77,11 +77,11 @@ $(SOLIB).hash: $(SOLIB) md5hash.pl
$(NM) $(SOLIB) | \
egrep '^[0-9a-fA-F]+ [ADRTW] ' | \
sort | $(PERL) md5hash.pl > $@
- ln -s $(SOLIB) klibc-`cat $@`.so
$(SOHASH): $(SOLIB) $(SOLIB).hash
cp -f $(SOLIB) $@
$(STRIP) $@
+ rm -f klibc-??????????????????????.so
ln -f $@ klibc-`cat $(SOLIB).hash`.so
interp.o: interp.S $(SOLIB).hash
diff --git a/klibc/fputc.c b/klibc/fputc.c
new file mode 100644
index 0000000000000..61aff1644bf28
--- /dev/null
+++ b/klibc/fputc.c
@@ -0,0 +1,14 @@
+/*
+ * fputc.c
+ *
+ * gcc "printf decompilation" expects this to exist...
+ */
+
+#include <stdio.h>
+
+int fputc(int c, FILE *f)
+{
+ unsigned char ch = c;
+
+ return _fwrite(&ch, 1, f) == 1 ? ch : EOF;
+}
diff --git a/klibc/include/stdio.h b/klibc/include/stdio.h
index 7bcf32ea3807f..d51e969c4fb92 100644
--- a/klibc/include/stdio.h
+++ b/klibc/include/stdio.h
@@ -66,6 +66,9 @@ static __inline__ off_t ftell(FILE *__f)
__extern int fputs(const char *, FILE *);
__extern int puts(const char *);
+__extern int fputc(int, FILE *);
+#define putc(c,f) fputc((c),(f))
+#define putchar(c) fputc((c),stdout)
__extern size_t _fread(void *, size_t, FILE *);
__extern size_t _fwrite(const void *, size_t, FILE *);
diff --git a/klibc/memcpy.c b/klibc/memcpy.c
index bd84822b4297c..3130aa85b78d6 100644
--- a/klibc/memcpy.c
+++ b/klibc/memcpy.c
@@ -9,12 +9,14 @@ void *memcpy(void *dst, const void *src, size_t n)
const char *p = src;
char *q = dst;
#if defined(__i386__)
+ size_t nl = n >> 2;
asm volatile("cld ; rep ; movsl ; movl %3,%0 ; rep ; movsb"
- : "+c" (n >> 2), "+S" (p), "+D" (q)
+ : "+c" (nl), "+S" (p), "+D" (q)
: "r" (n & 3));
#elif defined(__x86_64__)
+ size_t nq = n >> 3;
asm volatile("cld ; rep ; movsq ; movl %3,%%ecx ; rep ; movsb"
- : "+c" (n), "+S" (p), "+D" (q)
+ : "+c" (nq), "+S" (p), "+D" (q)
: "r" ((uint32_t)n & 7));
#else
while ( n-- ) {
diff --git a/klibc/memset.c b/klibc/memset.c
index 572f834cc294e..93a0673bfcd7d 100644
--- a/klibc/memset.c
+++ b/klibc/memset.c
@@ -9,12 +9,14 @@ void *memset(void *dst, int c, size_t n)
char *q = dst;
#if defined(__i386__)
+ size_t nl = n >> 2;
asm volatile("cld ; rep ; stosl ; movl %3,%0 ; rep ; stosb"
- : "+c" (n >> 2), "+D" (q)
+ : "+c" (nl), "+D" (q)
: "a" ((unsigned char)c * 0x01010101U), "r" (n & 3));
#elif defined(__x86_64__)
+ size_t nq = n >> 3;
asm volatile("cld ; rep ; stosq ; movl %3,%%ecx ; rep ; stosb"
- : "+c" (n >> 3), "+D" (q)
+ : "+c" (nq), "+D" (q)
: "a" ((unsigned char)c * 0x0101010101010101U,
"r" ((uint32_t)n & 7));
#else