Browse Source

Last relocs jump and global data, (even locales) that I could remove are gone from libc. The remaining are left as exercise for others ;-)

Peter S. Mazinger 18 years ago
parent
commit
b25ad630be
59 changed files with 285 additions and 18 deletions
  1. 5 0
      libc/inet/addr.c
  2. 7 0
      libc/inet/ether_addr.c
  3. 1 0
      libc/inet/herror.c
  4. 5 0
      libc/inet/inet_net.c
  5. 5 0
      libc/inet/resolv.c
  6. 1 0
      libc/inet/rpc/auth_unix.c
  7. 2 1
      libc/inet/rpc/clnt_tcp.c
  8. 1 0
      libc/inet/rpc/clnt_udp.c
  9. 1 0
      libc/inet/rpc/clnt_unix.c
  10. 8 0
      libc/inet/rpc/rcmd.c
  11. 1 0
      libc/inet/rpc/rpc_private.h
  12. 1 0
      libc/inet/rpc/svc_tcp.c
  13. 1 0
      libc/inet/rpc/svc_udp.c
  14. 1 0
      libc/inet/rpc/svc_unix.c
  15. 1 0
      libc/inet/rpc/xdr.c
  16. 1 0
      libc/inet/rpc/xdr_array.c
  17. 1 0
      libc/inet/rpc/xdr_rec.c
  18. 1 0
      libc/inet/rpc/xdr_reference.c
  19. 1 0
      libc/misc/assert/__assert.c
  20. 40 0
      libc/misc/ctype/ctype.c
  21. 1 0
      libc/misc/error/err.c
  22. 2 0
      libc/misc/error/error.c
  23. 7 0
      libc/misc/fnmatch/fnmatch.c
  24. 5 0
      libc/misc/gnu/obstack.c
  25. 3 1
      libc/misc/internals/__errno_location.c
  26. 2 0
      libc/misc/internals/__h_errno_location.c
  27. 3 1
      libc/misc/internals/__uClibc_main.c
  28. 7 2
      libc/misc/internals/errno.c
  29. 20 1
      libc/misc/locale/locale.c
  30. 7 0
      libc/misc/regex/regex.c
  31. 11 2
      libc/misc/time/time.c
  32. 5 0
      libc/misc/ttyent/getttyent.c
  33. 6 0
      libc/misc/wchar/wchar.c
  34. 7 0
      libc/misc/wctype/wctype.c
  35. 5 0
      libc/pwd_grp/pwd_grp.c
  36. 3 0
      libc/stdio/_fpmaxtostr.c
  37. 7 0
      libc/stdio/_stdio.c
  38. 3 0
      libc/stdio/_stdio.h
  39. 3 0
      libc/stdio/_uintmaxtostr.c
  40. 1 0
      libc/stdio/gets.c
  41. 1 0
      libc/stdio/perror.c
  42. 8 0
      libc/stdio/scanf.c
  43. 14 0
      libc/stdio/vfprintf.c
  44. 2 2
      libc/stdlib/atexit.c
  45. 1 0
      libc/stdlib/getenv.c
  46. 1 0
      libc/stdlib/malloc-standard/mallinfo.c
  47. 1 0
      libc/stdlib/setenv.c
  48. 12 0
      libc/stdlib/stdlib.c
  49. 10 0
      libc/stdlib/strtod.c
  50. 2 0
      libc/string/_collate.c
  51. 1 0
      libc/string/psignal.c
  52. 3 0
      libc/string/strcasecmp.c
  53. 5 0
      libc/string/strcasestr.c
  54. 3 0
      libc/string/strncasecmp.c
  55. 3 0
      libc/sysdeps/linux/common/bits/errno.h
  56. 1 0
      libc/unistd/exec.c
  57. 17 8
      libc/unistd/getopt.c
  58. 2 0
      libc/unistd/getpass.c
  59. 5 0
      libc/unistd/usershell.c

+ 5 - 0
libc/inet/addr.c

@@ -43,6 +43,11 @@
  * leading 0   -> octal
  * all else    -> decimal
  */
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b_loc)
+#else
+libc_hidden_proto(__ctype_b)
+#endif
 libc_hidden_proto(inet_aton)
 int inet_aton(const char *cp, struct in_addr *addrptr)
 {

+ 7 - 0
libc/inet/ether_addr.c

@@ -34,6 +34,13 @@
 libc_hidden_proto(ether_aton_r)
 libc_hidden_proto(ether_ntoa_r)
 libc_hidden_proto(sprintf)
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b_loc)
+libc_hidden_proto(__ctype_tolower_loc)
+#else
+libc_hidden_proto(__ctype_b)
+libc_hidden_proto(__ctype_tolower)
+#endif
 
 struct ether_addr *ether_aton_r(const char *asc, struct ether_addr *addr)
 {

+ 1 - 0
libc/inet/herror.c

@@ -25,6 +25,7 @@
 
 libc_hidden_proto(fprintf)
 libc_hidden_proto(__h_errno_location)
+libc_hidden_proto(stderr)
 
 static const char *error_msg = "Resolver error";
 static const char *const h_errlist[] = {

+ 5 - 0
libc/inet/inet_net.c

@@ -37,6 +37,11 @@
 #include <ctype.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b_loc)
+#else
+libc_hidden_proto(__ctype_b)
+#endif
 
 /*
  * Internet network address interpretation routine.

+ 5 - 0
libc/inet/resolv.c

@@ -200,6 +200,11 @@ libc_hidden_proto(res_querydomain)
 libc_hidden_proto(gethostent_r)
 libc_hidden_proto(fprintf)
 libc_hidden_proto(__h_errno_location)
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b_loc)
+#else
+libc_hidden_proto(__ctype_b)
+#endif
 
 #define MAX_RECURSE 5
 #define REPLY_TIMEOUT 10

+ 1 - 0
libc/inet/rpc/auth_unix.c

@@ -69,6 +69,7 @@ libc_hidden_proto(gettimeofday)
 libc_hidden_proto(fputs)
 libc_hidden_proto(perror)
 libc_hidden_proto(abort)
+libc_hidden_proto(stderr)
 #ifdef USE_IN_LIBIO
 libc_hidden_proto(fwprintf)
 #endif

+ 2 - 1
libc/inet/rpc/clnt_tcp.c

@@ -84,10 +84,11 @@ libc_hidden_proto(connect)
 libc_hidden_proto(bindresvport)
 libc_hidden_proto(poll)
 libc_hidden_proto(fputs)
+libc_hidden_proto(__rpc_thread_createerr)
+libc_hidden_proto(stderr)
 #ifdef USE_IN_LIBIO
 libc_hidden_proto(fwprintf)
 #endif
-libc_hidden_proto(__rpc_thread_createerr)
 
 extern u_long _create_xid (void) attribute_hidden;
 

+ 1 - 0
libc/inet/rpc/clnt_udp.c

@@ -84,6 +84,7 @@ libc_hidden_proto(recvmsg)
 libc_hidden_proto(poll)
 libc_hidden_proto(fputs)
 libc_hidden_proto(__rpc_thread_createerr)
+libc_hidden_proto(stderr)
 
 extern u_long _create_xid (void) attribute_hidden;
 

+ 1 - 0
libc/inet/rpc/clnt_unix.c

@@ -87,6 +87,7 @@ libc_hidden_proto(sendmsg)
 libc_hidden_proto(poll)
 libc_hidden_proto(fputs)
 libc_hidden_proto(__rpc_thread_createerr)
+libc_hidden_proto(stderr)
 
 extern u_long _create_xid (void) attribute_hidden;
 

+ 8 - 0
libc/inet/rpc/rcmd.c

@@ -102,6 +102,14 @@ libc_hidden_proto(fopen)
 libc_hidden_proto(fclose)
 libc_hidden_proto(fprintf)
 libc_hidden_proto(__h_errno_location)
+libc_hidden_proto(stderr)
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b_loc)
+libc_hidden_proto(__ctype_tolower_loc)
+#else
+libc_hidden_proto(__ctype_b)
+libc_hidden_proto(__ctype_tolower)
+#endif
 
 libc_hidden_proto(rresvport)
 

+ 1 - 0
libc/inet/rpc/rpc_private.h

@@ -5,6 +5,7 @@
 extern u_long _create_xid (void) attribute_hidden;
 
 libc_hidden_proto(__rpc_thread_createerr)
+libc_hidden_proto(stderr)
 
 /*
  * Multi-threaded support

+ 1 - 0
libc/inet/rpc/svc_tcp.c

@@ -84,6 +84,7 @@ libc_hidden_proto(listen)
 libc_hidden_proto(fputs)
 libc_hidden_proto(fclose)
 libc_hidden_proto(abort)
+libc_hidden_proto(stderr)
 
 /*
  * Ops vector for TCP/IP based rpc service handle

+ 1 - 0
libc/inet/rpc/svc_udp.c

@@ -82,6 +82,7 @@ libc_hidden_proto(recvmsg)
 libc_hidden_proto(sendmsg)
 libc_hidden_proto(fputs)
 libc_hidden_proto(fprintf)
+libc_hidden_proto(stderr)
 
 #define rpc_buffer(xprt) ((xprt)->xp_p1)
 #ifndef MAX

+ 1 - 0
libc/inet/rpc/svc_unix.c

@@ -82,6 +82,7 @@ libc_hidden_proto(accept)
 libc_hidden_proto(listen)
 libc_hidden_proto(fputs)
 libc_hidden_proto(abort)
+libc_hidden_proto(stderr)
 
 /*
  * Ops vector for AF_UNIX based rpc service handle

+ 1 - 0
libc/inet/rpc/xdr.c

@@ -59,6 +59,7 @@ libc_hidden_proto(fwprintf)
 
 libc_hidden_proto(strlen)
 libc_hidden_proto(fputs)
+libc_hidden_proto(stderr)
 
 /*
  * constants specific to the xdr "protocol"

+ 1 - 0
libc/inet/rpc/xdr_array.c

@@ -58,6 +58,7 @@ libc_hidden_proto(fwprintf)
 libc_hidden_proto(memset)
 libc_hidden_proto(fputs)
 libc_hidden_proto(xdr_u_int)
+libc_hidden_proto(stderr)
 
 #define LASTUNSIGNED	((u_int)0-1)
 

+ 1 - 0
libc/inet/rpc/xdr_rec.c

@@ -64,6 +64,7 @@ libc_hidden_proto(fwprintf)
 libc_hidden_proto(memcpy)
 libc_hidden_proto(fputs)
 libc_hidden_proto(lseek)
+libc_hidden_proto(stderr)
 
 static bool_t xdrrec_getlong (XDR *, long *);
 static bool_t xdrrec_putlong (XDR *, const long *);

+ 1 - 0
libc/inet/rpc/xdr_reference.c

@@ -59,6 +59,7 @@ libc_hidden_proto(fwprintf)
 libc_hidden_proto(memset)
 libc_hidden_proto(xdr_bool)
 libc_hidden_proto(fputs)
+libc_hidden_proto(stderr)
 
 #define LASTUNSIGNED	((u_int)0-1)
 

+ 1 - 0
libc/misc/assert/__assert.c

@@ -35,6 +35,7 @@
 
 libc_hidden_proto(fprintf)
 libc_hidden_proto(abort)
+libc_hidden_proto(stderr)
 
 /* Get the prototype from assert.h as a double-check. */
 #undef NDEBUG

+ 40 - 0
libc/misc/ctype/ctype.c

@@ -36,6 +36,11 @@
 #include <stdint.h>
 #include <assert.h>
 #include <locale.h>
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b_loc)
+#else
+libc_hidden_proto(__ctype_b)
+#endif
 
 #ifdef __UCLIBC_HAS_XLOCALE__
 #include <xlocale.h>
@@ -270,6 +275,11 @@ IS_FUNC_BODY(xdigit);
 #ifdef L_tolower
 
 #undef tolower
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_tolower_loc)
+#else
+libc_hidden_proto(__ctype_tolower)
+#endif
 libc_hidden_proto(tolower)
 #ifdef __UCLIBC_HAS_CTYPE_TABLES__
 
@@ -311,6 +321,11 @@ libc_hidden_def(tolower_l)
 #ifdef L_toupper
 
 #undef toupper
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_toupper_loc)
+#else
+libc_hidden_proto(__ctype_toupper)
+#endif
 libc_hidden_proto(toupper)
 #ifdef __UCLIBC_HAS_CTYPE_TABLES__
 
@@ -411,6 +426,7 @@ const __ctype_mask_t **__ctype_b_loc(void)
 	return &(__UCLIBC_CURLOCALE_DATA).__ctype_b;
 }
 
+libc_hidden_def(__ctype_b_loc)
 #endif
 
 #endif
@@ -419,10 +435,12 @@ const __ctype_mask_t **__ctype_b_loc(void)
 
 #ifdef __UCLIBC_HAS_XLOCALE__
 
+libc_hidden_proto(__ctype_tolower_loc)
 const __ctype_touplow_t **__ctype_tolower_loc(void)
 {
 	return &(__UCLIBC_CURLOCALE_DATA).__ctype_tolower;
 }
+libc_hidden_def(__ctype_tolower_loc)
 
 #endif
 
@@ -432,10 +450,12 @@ const __ctype_touplow_t **__ctype_tolower_loc(void)
 
 #ifdef __UCLIBC_HAS_XLOCALE__
 
+libc_hidden_proto(__ctype_toupper_loc)
 const __ctype_touplow_t **__ctype_toupper_loc(void)
 {
 	return &(__UCLIBC_CURLOCALE_DATA).__ctype_toupper;
 }
+libc_hidden_def(__ctype_toupper_loc)
 
 #endif
 
@@ -443,6 +463,8 @@ const __ctype_touplow_t **__ctype_toupper_loc(void)
 /**********************************************************************/
 #ifdef L___C_ctype_b
 
+extern const __ctype_mask_t __C_ctype_b_data[];
+libc_hidden_proto(__C_ctype_b_data)
 const __ctype_mask_t __C_ctype_b_data[] = {
 #ifdef __UCLIBC_HAS_CTYPE_SIGNED__
 	/* -128  M-^@ */ 0,
@@ -831,12 +853,16 @@ const __ctype_mask_t __C_ctype_b_data[] = {
 	/*  254  M-~  */ 0,
 	/*  255  M-^? */ 0
 };
+libc_hidden_def(__C_ctype_b_data)
 
+libc_hidden_proto(__C_ctype_b)
 const __ctype_mask_t *__C_ctype_b = __C_ctype_b_data + __UCLIBC_CTYPE_B_TBL_OFFSET;
+libc_hidden_def(__C_ctype_b)
 
 #ifndef __UCLIBC_HAS_XLOCALE__
 
 const __ctype_mask_t *__ctype_b = __C_ctype_b_data + __UCLIBC_CTYPE_B_TBL_OFFSET;
+libc_hidden_def(__ctype_b)
 
 #endif
 
@@ -844,6 +870,8 @@ const __ctype_mask_t *__ctype_b = __C_ctype_b_data + __UCLIBC_CTYPE_B_TBL_OFFSET
 /**********************************************************************/
 #ifdef L___C_ctype_tolower
 
+extern const __ctype_touplow_t __C_ctype_tolower_data[];
+libc_hidden_proto(__C_ctype_tolower_data)
 const __ctype_touplow_t __C_ctype_tolower_data[] = {
 #ifdef __UCLIBC_HAS_CTYPE_SIGNED__
 	-128,         -127,         -126,         -125,
@@ -944,14 +972,19 @@ const __ctype_touplow_t __C_ctype_tolower_data[] = {
 	 248,          249,          250,          251,
 	 252,          253,          254,          255
 };
+libc_hidden_def(__C_ctype_tolower_data)
 
+libc_hidden_proto(__C_ctype_tolower)
 const __ctype_touplow_t *__C_ctype_tolower = __C_ctype_tolower_data
 											+ __UCLIBC_CTYPE_TO_TBL_OFFSET;
+libc_hidden_def(__C_ctype_tolower)
 
 #ifndef __UCLIBC_HAS_XLOCALE__
 
+libc_hidden_proto(__ctype_tolower)
 const __ctype_touplow_t *__ctype_tolower = __C_ctype_tolower_data
 											+ __UCLIBC_CTYPE_TO_TBL_OFFSET;
+libc_hidden_def(__ctype_tolower)
 
 #endif
 
@@ -959,6 +992,8 @@ const __ctype_touplow_t *__ctype_tolower = __C_ctype_tolower_data
 /**********************************************************************/
 #ifdef L___C_ctype_toupper
 
+extern const __ctype_touplow_t __C_ctype_toupper_data[];
+libc_hidden_proto(__C_ctype_toupper_data)
 const __ctype_touplow_t __C_ctype_toupper_data[] = {
 #ifdef __UCLIBC_HAS_CTYPE_SIGNED__
 	-128,         -127,         -126,         -125,
@@ -1059,14 +1094,19 @@ const __ctype_touplow_t __C_ctype_toupper_data[] = {
 	 248,          249,          250,          251,
 	 252,          253,          254,          255
 };
+libc_hidden_def(__C_ctype_toupper_data)
 
+libc_hidden_proto(__C_ctype_toupper)
 const __ctype_touplow_t *__C_ctype_toupper = __C_ctype_toupper_data
 											+ __UCLIBC_CTYPE_TO_TBL_OFFSET;
+libc_hidden_def(__C_ctype_toupper)
 
 #ifndef __UCLIBC_HAS_XLOCALE__
 
+libc_hidden_proto(__ctype_toupper)
 const __ctype_touplow_t *__ctype_toupper = __C_ctype_toupper_data
 											+ __UCLIBC_CTYPE_TO_TBL_OFFSET;
+libc_hidden_def(__ctype_toupper)
 
 #endif
 

+ 1 - 0
libc/misc/error/err.c

@@ -31,6 +31,7 @@ libc_hidden_proto(vfprintf)
 libc_hidden_proto(__xpg_strerror_r)
 libc_hidden_proto(exit)
 libc_hidden_proto(vfprintf)
+libc_hidden_proto(stderr)
 
 static void vwarn_work(const char *format, va_list args, int showerr)
 {

+ 2 - 0
libc/misc/error/error.c

@@ -37,6 +37,8 @@ libc_hidden_proto(vfprintf)
 libc_hidden_proto(fflush)
 libc_hidden_proto(fputc)
 libc_hidden_proto(__fputc_unlocked)
+libc_hidden_proto(stdout)
+libc_hidden_proto(stderr)
 
 /* This variable is incremented each time `error' is called.  */
 unsigned int error_message_count = 0;

+ 7 - 0
libc/misc/fnmatch/fnmatch.c

@@ -68,6 +68,13 @@ libc_hidden_proto(strcmp)
 /*libc_hidden_proto(strchrnul)*/
 libc_hidden_proto(strlen)
 libc_hidden_proto(strcoll)
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b_loc)
+libc_hidden_proto(__ctype_tolower_loc)
+#else
+libc_hidden_proto(__ctype_b)
+libc_hidden_proto(__ctype_tolower)
+#endif
 libc_hidden_proto(tolower)
 libc_hidden_proto(fnmatch)
 libc_hidden_proto(getenv)

+ 5 - 0
libc/misc/gnu/obstack.c

@@ -89,6 +89,7 @@ union fooround {long x; double d;};
    abort gracefully or use longjump - but shouldn't return.  This
    variable by default points to the internal function
    `print_and_abort'.  */
+libc_hidden_proto(obstack_alloc_failed_handler)
 # if defined __STDC__ && __STDC__
 static void print_and_abort (void);
 void (*obstack_alloc_failed_handler) (void) = print_and_abort;
@@ -96,6 +97,7 @@ void (*obstack_alloc_failed_handler) (void) = print_and_abort;
 static void print_and_abort ();
 void (*obstack_alloc_failed_handler) () = print_and_abort;
 # endif
+libc_hidden_def(obstack_alloc_failed_handler)
 
 
 /* Exit value used when `print_and_abort' is used.  */
@@ -109,11 +111,14 @@ void (*obstack_alloc_failed_handler) () = print_and_abort;
 libc_hidden_proto(fprintf)
 libc_hidden_proto(abort)
 libc_hidden_proto(exit)
+libc_hidden_proto(stderr)
 #ifdef __UCLIBC_HAS_WCHAR__
 libc_hidden_proto(fwprintf)
 #endif
 
+libc_hidden_proto(obstack_exit_failure)
 int obstack_exit_failure = EXIT_FAILURE;
+libc_hidden_def(obstack_exit_failure)
 
 /* The non-GNU-C macros copy the obstack into this global variable
    to avoid multiple evaluation.  */

+ 3 - 1
libc/misc/internals/__errno_location.c

@@ -1,8 +1,10 @@
 #include <errno.h>
 #undef errno
+libc_hidden_proto(errno)
 
+/* psm: moved to bits/errno.h: libc_hidden_proto(__errno_location) */
 int * weak_const_function __errno_location (void)
 {
     return &errno;
 }
-
+#ifdef IS_IN_libc /* not really need, only to keep in sync w/ libc_hidden_proto */

+ 2 - 0
libc/misc/internals/__h_errno_location.c

@@ -3,6 +3,8 @@
 #include <netdb.h>
 #undef h_errno
 
+libc_hidden_proto(h_errno)
+
 libc_hidden_proto(__h_errno_location)
 int * weak_const_function __h_errno_location (void)
 {

+ 3 - 1
libc/misc/internals/__uClibc_main.c

@@ -89,8 +89,10 @@ strong_alias (__progname_full, program_invocation_name)
  * Note: Apparently we must initialize __environ to ensure that the weak
  * environ symbol is also included.
  */
+libc_hidden_proto(__environ)
 char **__environ = 0;
-weak_alias(__environ, environ)
+libc_hidden_def(__environ)
+strong_alias(__environ,environ)
 
 /* TODO: don't export __pagesize; we cant now because libpthread uses it */
 extern size_t __pagesize;

+ 7 - 2
libc/misc/internals/errno.c

@@ -4,6 +4,9 @@
 extern int errno;
 extern int h_errno;
 
+libc_hidden_proto(errno)
+libc_hidden_proto(h_errno)
+
 #if 0
 /* Unfortunately, this doesn't work... */
 int h_errno __attribute__ ((section  (".bss"))) = 0;
@@ -13,5 +16,7 @@ int _errno = 0;
 int _h_errno = 0;
 #endif
 
-weak_alias(_errno, errno)
-weak_alias(_h_errno, h_errno)
+strong_alias(_errno,errno)
+libc_hidden_def(errno)
+strong_alias(_h_errno,h_errno)
+libc_hidden_def(h_errno)

+ 20 - 1
libc/misc/locale/locale.c

@@ -70,6 +70,7 @@ libc_hidden_proto(strcpy)
 libc_hidden_proto(strncmp)
 libc_hidden_proto(strchr)
 libc_hidden_proto(getenv)
+libc_hidden_proto(__C_ctype_toupper)
 /*libc_hidden_proto(fflush)*/
 
 #ifdef __UCLIBC_MJN3_ONLY__
@@ -149,6 +150,10 @@ extern void _locale_init_l(__locale_t base) attribute_hidden;
 #include <langinfo.h>
 #include <nl_types.h>
 
+#ifdef __UCLIBC_HAS_LOCALE__
+libc_hidden_proto(__global_locale)
+#endif
+
 /**********************************************************************/
 #ifdef L_setlocale
 
@@ -359,12 +364,23 @@ struct lconv *localeconv(void)
 /**********************************************************************/
 #if defined(L__locale_init) && !defined(__LOCALE_C_ONLY)
 
+libc_hidden_proto(__C_ctype_b)
+libc_hidden_proto(__C_ctype_tolower)
+#ifndef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b)
+libc_hidden_proto(__ctype_tolower)
+libc_hidden_proto(__ctype_toupper)
+#endif
+
 __uclibc_locale_t __global_locale_data;
 
 __locale_t __global_locale = &__global_locale_data;
+libc_hidden_def(__global_locale)
 
 #ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__curlocale_var)
 __locale_t __curlocale_var = &__global_locale_data;
+libc_hidden_def(__curlocale_var)
 #endif
 
 /*----------------------------------------------------------------------*/
@@ -1367,8 +1383,9 @@ void freelocale(__locale_t dataset)
 /**********************************************************************/
 #ifdef L_uselocale
 
-libc_hidden_proto(uselocale)
+libc_hidden_proto(__curlocale_var)
 
+libc_hidden_proto(uselocale)
 __locale_t uselocale(__locale_t dataset)
 {
 	__locale_t old;
@@ -1400,6 +1417,8 @@ libc_hidden_def(uselocale)
 
 #ifdef __UCLIBC_HAS_THREADS__
 
+libc_hidden_proto(__curlocale_var)
+
 __locale_t weak_const_function __curlocale(void)
 {
     return __curlocale_var; /* This is overriden by the thread version. */

+ 7 - 0
libc/misc/regex/regex.c

@@ -62,6 +62,13 @@ libc_hidden_proto(wctype)
 #define __tolower tolower
 #endif
 #define __mempcpy mempcpy
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b_loc)
+libc_hidden_proto(__ctype_toupper_loc)
+#else
+libc_hidden_proto(__ctype_b)
+libc_hidden_proto(__ctype_toupper)
+#endif
 libc_hidden_proto(toupper)
 libc_hidden_proto(tolower)
 libc_hidden_proto(memcmp)

+ 11 - 2
libc/misc/time/time.c

@@ -183,6 +183,9 @@ libc_hidden_proto(strncasecmp_l)
 libc_hidden_proto(strtol_l)
 libc_hidden_proto(strtoul_l)
 libc_hidden_proto(nl_langinfo_l)
+libc_hidden_proto(__ctype_b_loc)
+#else
+libc_hidden_proto(__ctype_b)
 #endif
 
 #ifndef __isleap
@@ -229,7 +232,7 @@ typedef struct {
 
 #ifdef __UCLIBC_HAS_THREADS__
 # include <pthread.h>
-extern pthread_mutex_t _time_tzlock;
+extern pthread_mutex_t _time_tzlock attribute_hidden;
 #endif
 #define TZLOCK		__pthread_mutex_lock(&_time_tzlock)
 #define TZUNLOCK	__pthread_mutex_unlock(&_time_tzlock)
@@ -1701,12 +1704,18 @@ static const char vals[] = {
 #define DEFAULT_RULES (vals + 22)
 
 /* Initialize to UTC. */
+libc_hidden_proto(daylight)
 int daylight = 0;
+libc_hidden_def(daylight)
+libc_hidden_proto(timezone)
 long timezone = 0;
+libc_hidden_def(timezone)
+libc_hidden_proto(tzname)
 char *tzname[2] = { (char *) UTC, (char *) (UTC-1) };
+libc_hidden_def(tzname)
 
 #ifdef __UCLIBC_HAS_THREADS__
-pthread_mutex_t _time_tzlock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+attribute_hidden pthread_mutex_t _time_tzlock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
 #endif
 
 rule_struct _time_tzinfo[2];

+ 5 - 0
libc/misc/ttyent/getttyent.c

@@ -50,6 +50,11 @@ libc_hidden_proto(__fgetc_unlocked)
 libc_hidden_proto(fopen)
 libc_hidden_proto(fclose)
 libc_hidden_proto(abort)
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b_loc)
+#else
+libc_hidden_proto(__ctype_b)
+#endif
 
 static char zapchar;
 static FILE *tf;

+ 6 - 0
libc/misc/wchar/wchar.c

@@ -112,6 +112,9 @@
 #include <wchar.h>
 #include <bits/uClibc_uwchar.h>
 
+#ifdef __UCLIBC_HAS_LOCALE__
+libc_hidden_proto(__global_locale)
+#endif
 /**********************************************************************/
 #ifdef __UCLIBC_HAS_LOCALE__
 #ifdef __UCLIBC_MJN3_ONLY__
@@ -1233,6 +1236,8 @@ enum {
  *
  */
 
+extern const unsigned char __iconv_codesets[];
+libc_hidden_proto(__iconv_codesets)
 const unsigned char __iconv_codesets[] =
 	"\x0a\xe0""WCHAR_T\x00"		/* superset of UCS-4 but platform-endian */
 #if __BYTE_ORDER == __BIG_ENDIAN
@@ -1265,6 +1270,7 @@ const unsigned char __iconv_codesets[] =
 	"\x08\x02""UTF-8\x00"
 	"\x0b\x01""US-ASCII\x00"
 	"\x07\x01""ASCII";			/* Must be last! (special case to save a nul) */
+libc_hidden_def(__iconv_codesets)
 
 libc_hidden_proto(strcasecmp)
 

+ 7 - 0
libc/misc/wctype/wctype.c

@@ -39,7 +39,9 @@
 #include <bits/uClibc_uwchar.h>
 
 libc_hidden_proto(strcmp)
+libc_hidden_proto(__C_ctype_tolower)
 libc_hidden_proto(tolower)
+libc_hidden_proto(__C_ctype_toupper)
 libc_hidden_proto(toupper)
 libc_hidden_proto(towlower)
 libc_hidden_proto(towupper)
@@ -56,7 +58,12 @@ libc_hidden_proto(towlower_l)
 libc_hidden_proto(towupper_l)
 libc_hidden_proto(towctrans_l)
 libc_hidden_proto(iswctype_l)
+#else
+libc_hidden_proto(__ctype_b)
 #endif /* __UCLIBC_HAS_XLOCALE__ */
+#ifdef __UCLIBC_HAS_LOCALE__
+libc_hidden_proto(__global_locale)
+#endif
 
 /* We know wide char support is enabled.  We wouldn't be here otherwise. */
 

+ 5 - 0
libc/pwd_grp/pwd_grp.c

@@ -51,6 +51,11 @@ libc_hidden_proto(sprintf)
 libc_hidden_proto(fopen)
 libc_hidden_proto(fclose)
 libc_hidden_proto(fprintf)
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b_loc)
+#else
+libc_hidden_proto(__ctype_b)
+#endif
 
 /**********************************************************************/
 /* Sizes for staticly allocated buffers. */

+ 3 - 0
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);

+ 7 - 0
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. */

+ 3 - 0
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>
 

+ 3 - 0
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. */

+ 1 - 0
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)
 {

+ 1 - 0
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)?

+ 8 - 0
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

+ 14 - 0
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!!! */

+ 2 - 2
libc/stdlib/atexit.c

@@ -66,7 +66,7 @@ typedef enum {
 } ef_type; /* exit function types */
 
 /* this is in the L_exit object */
-extern void (*__exit_cleanup) (int);
+extern void (*__exit_cleanup) (int) attribute_hidden;
 
 /* these are in the L___do_exit object */
 extern int __exit_slots attribute_hidden;
@@ -309,7 +309,7 @@ void __exit_handler(int status)
 
 #ifdef L_exit
 extern void weak_function _stdio_term(void) attribute_hidden;
-void (*__exit_cleanup) (int) = 0;
+attribute_hidden void (*__exit_cleanup) (int) = 0;
 #ifdef __UCLIBC_HAS_THREADS__
 pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
 #endif

+ 1 - 0
libc/stdlib/getenv.c

@@ -11,6 +11,7 @@
 libc_hidden_proto(getenv)
 libc_hidden_proto(memcmp)
 libc_hidden_proto(strlen)
+libc_hidden_proto(__environ)
 
 /* IEEE Std 1003.1-2001 says getenv need not be thread safe, so 
  * don't bother locking access to __environ */

+ 1 - 0
libc/stdlib/malloc-standard/mallinfo.c

@@ -17,6 +17,7 @@
 #include "malloc.h"
 
 libc_hidden_proto(fprintf)
+libc_hidden_proto(stderr)
 
 /* ------------------------------ mallinfo ------------------------------ */
 libc_hidden_proto(mallinfo)

+ 1 - 0
libc/stdlib/setenv.c

@@ -32,6 +32,7 @@ libc_hidden_proto(strlen)
 libc_hidden_proto(strncmp)
 libc_hidden_proto(strndup)
 libc_hidden_proto(unsetenv)
+libc_hidden_proto(__environ)
 
 #ifdef __UCLIBC_HAS_THREADS__
 # include <pthread.h>

+ 12 - 0
libc/stdlib/stdlib.c

@@ -86,6 +86,9 @@ libc_hidden_proto(iswspace)
 #ifdef __UCLIBC_HAS_XLOCALE__
 #include <xlocale.h>
 #endif /* __UCLIBC_HAS_XLOCALE__ */
+#ifdef __UCLIBC_HAS_LOCALE__
+libc_hidden_proto(__global_locale)
+#endif
 
 /* TODO: clean up the following... */
 
@@ -476,6 +479,12 @@ unsigned long attribute_hidden _stdlib_strto_l(register const Wchar * __restrict
 /* This is the main work fuction which handles both strtol (sflag = 1) and
  * strtoul (sflag = 0). */
 
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b_loc)
+#else
+libc_hidden_proto(__ctype_b)
+#endif
+
 unsigned long attribute_hidden __XL_NPP(_stdlib_strto_l)(register const Wchar * __restrict str,
 										Wchar ** __restrict endptr, int base,
 										int sflag   __LOCALE_PARAM )
@@ -618,6 +627,9 @@ unsigned long long attribute_hidden _stdlib_strto_ll(register const Wchar * __re
 
 #else  /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
 
+#ifndef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b)
+#endif
 /* This is the main work fuction which handles both strtoll (sflag = 1) and
  * strtoull (sflag = 0). */
 

+ 10 - 0
libc/stdlib/strtod.c

@@ -176,6 +176,16 @@ extern void __fp_range_check(__fpmax_t y, __fpmax_t x) attribute_hidden;
 /**********************************************************************/
 #if defined(L___strtofpmax) || defined(L___strtofpmax_l) || defined(L___wcstofpmax) || defined(L___wcstofpmax_l)
 
+#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)
+libc_hidden_proto(__ctype_tolower)
+#endif
+
 #if defined(L___wcstofpmax) || defined(L___wcstofpmax_l)
 
 #define __strtofpmax    __wcstofpmax

+ 2 - 0
libc/string/_collate.c

@@ -57,6 +57,8 @@ libc_hidden_proto(wcscmp)
 
 #endif /* defined(L_strxfrm) || defined(L_strxfrm_l) */
 
+libc_hidden_proto(__global_locale)
+
 #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE)
 
 libc_hidden_proto(wcscoll_l)

+ 1 - 0
libc/string/psignal.c

@@ -12,6 +12,7 @@
 
 libc_hidden_proto(fprintf)
 libc_hidden_proto(strsignal)
+libc_hidden_proto(stderr)
 
 /* TODO: make this threadsafe with a reentrant version of strsignal? */
 

+ 3 - 0
libc/string/strcasecmp.c

@@ -24,6 +24,9 @@ libc_hidden_proto(towlower)
 libc_hidden_proto(tolower_l)
 #  define TOLOWER(C) tolower_l((C), locale_arg)
 # else
+#ifndef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_tolower)
+#endif
 libc_hidden_proto(tolower)
 #  define TOLOWER(C) tolower((C))
 # endif

+ 5 - 0
libc/string/strcasestr.c

@@ -8,6 +8,11 @@
 #include "_string.h"
 #include <ctype.h>
 
+#ifndef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_tolower)
+#else
+libc_hidden_proto(__ctype_tolower_loc)
+#endif
 libc_hidden_proto(tolower)
 
 char *strcasestr(const char *s1, const char *s2)

+ 3 - 0
libc/string/strncasecmp.c

@@ -24,6 +24,9 @@ libc_hidden_proto(towlower)
 libc_hidden_proto(tolower_l)
 #  define TOLOWER(C) tolower_l((C), locale_arg)
 # else
+#ifndef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_tolower)
+#endif
 libc_hidden_proto(tolower)
 #  define TOLOWER(C) tolower((C))
 # endif

+ 3 - 0
libc/sysdeps/linux/common/bits/errno.h

@@ -38,6 +38,9 @@ extern int errno;
 extern int *__errno_location (void) __THROW __attribute__ ((__const__));
 
 # if defined _LIBC
+#ifdef IS_IN_libc
+libc_hidden_proto(__errno_location)
+#endif
 /* We wouldn't need a special macro anymore but it is history.  */
 #  define __set_errno(val) ((errno) = (val))
 # endif /* _LIBC */

+ 1 - 0
libc/unistd/exec.c

@@ -51,6 +51,7 @@ libc_hidden_proto(execve)
 libc_hidden_proto(mmap)
 libc_hidden_proto(munmap)
 libc_hidden_proto(getenv)
+libc_hidden_proto(__environ)
 
 /**********************************************************************/
 #if defined(__ARCH_HAS_MMU__) || defined(__UCLIBC_UCLINUX_BROKEN_MUNMAP__)

+ 17 - 8
libc/unistd/getopt.c

@@ -34,13 +34,6 @@
 #include <libintl.h>
 #endif
 
-libc_hidden_proto(strchr)
-libc_hidden_proto(strcmp)
-libc_hidden_proto(strlen)
-libc_hidden_proto(strncmp)
-libc_hidden_proto(getenv)
-libc_hidden_proto(fprintf)
-
 #ifdef __UCLIBC_MJN3_ONLY__
 #warning TODO: Enable gettext awareness.
 #endif /* __UCLIBC_MJN3_ONLY__ */
@@ -66,7 +59,19 @@ libc_hidden_proto(fprintf)
    GNU application programs can use a third alternative mode in which
    they can distinguish the relative order of options and other arguments.  */
 
-#include "getopt.h"
+#include <getopt.h>
+
+libc_hidden_proto(strchr)
+libc_hidden_proto(strcmp)
+libc_hidden_proto(strlen)
+libc_hidden_proto(strncmp)
+libc_hidden_proto(getenv)
+libc_hidden_proto(fprintf)
+libc_hidden_proto(optarg)
+libc_hidden_proto(opterr)
+libc_hidden_proto(optind)
+libc_hidden_proto(optopt)
+libc_hidden_proto(stderr)
 
 extern int _getopt_internal (int argc, char *const *argv, const char *optstring, 
 	const struct option *longopts, int *longind, int long_only) attribute_hidden;
@@ -79,6 +84,7 @@ extern int _getopt_internal (int argc, char *const *argv, const char *optstring,
    each non-option ARGV-element is returned here.  */
 
 char *optarg = NULL;
+libc_hidden_def(optarg)
 
 /* Index in ARGV of the next element to be scanned.
    This is used for communication to and from the caller
@@ -94,17 +100,20 @@ char *optarg = NULL;
 
 /* 1003.2 says this must be 1 before any call.  */
 int optind = 1;
+libc_hidden_def(optind)
 
 /* Callers store zero here to inhibit the error message
    for unrecognized options.  */
 
 int opterr = 1;
+libc_hidden_def(opterr)
 
 /* Set to an option character which was unrecognized.
    This must be initialized on some systems to avoid linking in the
    system's own getopt implementation.  */
 
 int optopt = '?';
+libc_hidden_def(optopt)
 
 /* The next char to be scanned in the option-element
    in which the last option character we returned was found.

+ 2 - 0
libc/unistd/getpass.c

@@ -35,6 +35,8 @@ libc_hidden_proto(fputs)
 libc_hidden_proto(fputc)
 libc_hidden_proto(putc)
 libc_hidden_proto(__fputc_unlocked)
+libc_hidden_proto(stdin)
+libc_hidden_proto(stderr)
 
 /* It is desirable to use this bit on systems that have it.
    The only bit of terminal state we want to twiddle is echoing, which is

+ 5 - 0
libc/unistd/usershell.c

@@ -47,6 +47,11 @@ libc_hidden_proto(fclose)
 libc_hidden_proto(__fsetlocking)
 libc_hidden_proto(fileno)
 libc_hidden_proto(fgets_unlocked)
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b_loc)
+#else
+libc_hidden_proto(__ctype_b)
+#endif
 
 /*
  * Local shells should NOT be added here.  They should be added in