Library: Add putchar_wrapper.c for use with libgcc
authorTormod Volden <debian.tormod@gmail.com>
Tue, 14 Apr 2015 21:23:12 +0000 (23:23 +0200)
committerAlan Cox <alan@linux.intel.com>
Wed, 15 Apr 2015 11:35:24 +0000 (12:35 +0100)
Once we link in libgcc.a it seems we need the putchar
without underscore (in C).

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Library/libs/Makefile.6809
Library/libs/putchar_wrapper.c [new file with mode: 0644]

index 784ed1d..a571c97 100644 (file)
@@ -27,7 +27,7 @@ SRC_C += gmtime.c gmtime_r.c grent.c index.c isatty.c killpg.c
 SRC_C += libintl.c
 SRC_C += localtim.c localtim_r.c lseek.c lsearch.c lstat.c ltoa.c ltostr.c
 SRC_C += malloc.c mkfifo.c mkstemps.c nanosleep.c opendir.c pause.c perror.c
-SRC_C += popen.c printf.c putenv.c putgetch.c putpwent.c pwent.c qsort.c
+SRC_C += popen.c printf.c putenv.c putchar_wrapper.c putpwent.c pwent.c qsort.c
 SRC_C += raise.c rand.c readdir.c readlink.c realloc.c regerror.c
 SRC_C += regsub.c remove.c rewind.c rindex.c setbuffer.c setenv.c setjmp.c
 SRC_C += setlocale.c setvbuf.c settimeofday.c sleep.c sprintf.c
diff --git a/Library/libs/putchar_wrapper.c b/Library/libs/putchar_wrapper.c
new file mode 100644 (file)
index 0000000..e0a0089
--- /dev/null
@@ -0,0 +1,7 @@
+/* This little wrapper seems needed when linking with libgcc */
+
+int putchar(int ch)
+{
+        unsigned char c = ch;
+        return write(1, &c, 1);
+}