From b25ad630be8b0f362fea44a97efbead83d1dd2ae Mon Sep 17 00:00:00 2001
From: "Peter S. Mazinger" <ps.m@gmx.net>
Date: Mon, 16 Jan 2006 18:07:18 +0000
Subject: Last relocs jump and global data, (even locales) that I could remove
 are gone from libc. The remaining are left as exercise for others ;-)

---
 libc/stdio/_fpmaxtostr.c   |  3 +++
 libc/stdio/_stdio.c        |  7 +++++++
 libc/stdio/_stdio.h        |  3 +++
 libc/stdio/_uintmaxtostr.c |  3 +++
 libc/stdio/gets.c          |  1 +
 libc/stdio/perror.c        |  1 +
 libc/stdio/scanf.c         |  8 ++++++++
 libc/stdio/vfprintf.c      | 14 ++++++++++++++
 8 files changed, 40 insertions(+)

(limited to 'libc/stdio')

diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c
index 03fe6b1db..8534677f0 100644
--- a/libc/stdio/_fpmaxtostr.c
+++ b/libc/stdio/_fpmaxtostr.c
@@ -12,6 +12,9 @@
 #include <bits/uClibc_fpmax.h>
 
 libc_hidden_proto(memset)
+#ifdef __UCLIBC_HAS_LOCALE__
+libc_hidden_proto(__global_locale)
+#endif
 
 typedef size_t (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len,
 								intptr_t buf);
diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c
index 6454b3f3b..5c8b72086 100644
--- a/libc/stdio/_stdio.c
+++ b/libc/stdio/_stdio.c
@@ -125,12 +125,19 @@ static FILE _stdio_streams[] = {
 							 0 )
 };
 
+/* psm: moved to _stdio.h: libc_hidden_proto(stdin/stdout) */
 FILE *stdin  = _stdio_streams;
+libc_hidden_def(stdin)
 FILE *stdout = _stdio_streams + 1;
+libc_hidden_def(stdout)
+libc_hidden_proto(stderr)
 FILE *stderr = _stdio_streams + 2;
+libc_hidden_def(stderr)
 
 #ifdef __STDIO_GETC_MACRO
+libc_hidden_proto(__stdin)
 FILE *__stdin = _stdio_streams;		 /* For getchar() macro. */
+libc_hidden_def(__stdin)
 #endif
 #ifdef __STDIO_PUTC_MACRO
 FILE *__stdout = _stdio_streams + 1; /* For putchar() macro. */
diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h
index d6b68b3bb..7c8176ecc 100644
--- a/libc/stdio/_stdio.h
+++ b/libc/stdio/_stdio.h
@@ -22,6 +22,9 @@
 #include <wchar.h>
 #endif
 
+libc_hidden_proto(stdin)
+libc_hidden_proto(stdout)
+
 #ifdef __UCLIBC_HAS_THREADS__
 #include <pthread.h>
 
diff --git a/libc/stdio/_uintmaxtostr.c b/libc/stdio/_uintmaxtostr.c
index 4310d6458..f9c83506e 100644
--- a/libc/stdio/_uintmaxtostr.c
+++ b/libc/stdio/_uintmaxtostr.c
@@ -12,6 +12,9 @@
 #include <bits/uClibc_uintmaxtostr.h>
 
 libc_hidden_proto(memcpy)
+#ifdef __UCLIBC_HAS_LOCALE__
+libc_hidden_proto(__global_locale)
+#endif
 
 /* Avoid using long long / and % operations to cut down dependencies on
  * libgcc.a.  Definitely helps on i386 at least. */
diff --git a/libc/stdio/gets.c b/libc/stdio/gets.c
index 1c908399c..fd084c90c 100644
--- a/libc/stdio/gets.c
+++ b/libc/stdio/gets.c
@@ -13,6 +13,7 @@ link_warning(gets, "the 'gets' function is dangerous and should not be used.")
 
 libc_hidden_proto(getchar_unlocked)
 libc_hidden_proto(__fgetc_unlocked)
+libc_hidden_proto(__stdin)
 
 char *gets(char *s)
 {
diff --git a/libc/stdio/perror.c b/libc/stdio/perror.c
index 993fcf428..2c3cbbdb5 100644
--- a/libc/stdio/perror.c
+++ b/libc/stdio/perror.c
@@ -9,6 +9,7 @@
 
 libc_hidden_proto(fprintf)
 libc_hidden_proto(__glibc_strerror_r)
+libc_hidden_proto(stderr)
 
 #ifdef __UCLIBC_MJN3_ONLY__
 #warning CONSIDER: Increase buffer size for error message (non-%m case)?
diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c
index 4b1fd0681..cfe52d94f 100644
--- a/libc/stdio/scanf.c
+++ b/libc/stdio/scanf.c
@@ -99,6 +99,14 @@ libc_hidden_proto(ungetwc)
 libc_hidden_proto(iswspace)
 libc_hidden_proto(fgetwc_unlocked)
 #endif
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b_loc)
+#else
+#ifdef __UCLIBC_HAS_LOCALE__
+libc_hidden_proto(__global_locale)
+#endif
+libc_hidden_proto(__ctype_b)
+#endif
 
 #ifdef __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__
 #ifdef L_vfscanf
diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c
index d467b8297..7794c6e39 100644
--- a/libc/stdio/vfprintf.c
+++ b/libc/stdio/vfprintf.c
@@ -513,6 +513,10 @@ size_t parse_printf_format(register const char *template,
 /**********************************************************************/
 #ifdef L__ppfs_init
 
+#ifdef __UCLIBC_HAS_LOCALE__
+libc_hidden_proto(__global_locale)
+#endif
+
 int attribute_hidden _ppfs_init(register ppfs_t *ppfs, const char *fmt0)
 {
 	int r;
@@ -731,6 +735,12 @@ void attribute_hidden _ppfs_setargs(register ppfs_t *ppfs)
 /**********************************************************************/
 #ifdef L__ppfs_parsespec
 
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b_loc)
+#else
+libc_hidden_proto(__ctype_b)
+#endif
+
 /* Notes: argtype differs from glibc for the following:
  *         mine              glibc
  *  lc     PA_WCHAR          PA_CHAR       the standard says %lc means %C
@@ -1245,6 +1255,10 @@ static size_t _fp_out_narrow(FILE *fp, intptr_t type, intptr_t len, intptr_t buf
 #define _outnwcs(stream, wstring, len)	_wstdio_fwrite(wstring, len, stream)
 #define FP_OUT _fp_out_wide
 
+#ifdef __UCLIBC_HAS_LOCALE__
+libc_hidden_proto(__global_locale)
+#endif
+
 static size_t _outnstr(FILE *stream, const char *s, size_t wclen)
 {
 	/* NOTE!!! len here is the number of wchars we want to generate!!! */
-- 
cgit v1.2.3