From b25ad630be8b0f362fea44a97efbead83d1dd2ae Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" 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/misc/assert/__assert.c | 1 + libc/misc/ctype/ctype.c | 40 ++++++++++++++++++++++++++++++++ libc/misc/error/err.c | 1 + libc/misc/error/error.c | 2 ++ libc/misc/fnmatch/fnmatch.c | 7 ++++++ libc/misc/gnu/obstack.c | 5 ++++ libc/misc/internals/__errno_location.c | 4 +++- libc/misc/internals/__h_errno_location.c | 2 ++ libc/misc/internals/__uClibc_main.c | 4 +++- libc/misc/internals/errno.c | 9 +++++-- libc/misc/locale/locale.c | 21 ++++++++++++++++- libc/misc/regex/regex.c | 7 ++++++ libc/misc/time/time.c | 13 +++++++++-- libc/misc/ttyent/getttyent.c | 5 ++++ libc/misc/wchar/wchar.c | 6 +++++ libc/misc/wctype/wctype.c | 7 ++++++ 16 files changed, 127 insertions(+), 7 deletions(-) (limited to 'libc/misc') diff --git a/libc/misc/assert/__assert.c b/libc/misc/assert/__assert.c index 130bb044f..a0b215957 100644 --- a/libc/misc/assert/__assert.c +++ b/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 diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c index cb1645ef7..9a220ac63 100644 --- a/libc/misc/ctype/ctype.c +++ b/libc/misc/ctype/ctype.c @@ -36,6 +36,11 @@ #include #include #include +#ifdef __UCLIBC_HAS_XLOCALE__ +libc_hidden_proto(__ctype_b_loc) +#else +libc_hidden_proto(__ctype_b) +#endif #ifdef __UCLIBC_HAS_XLOCALE__ #include @@ -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 diff --git a/libc/misc/error/err.c b/libc/misc/error/err.c index f27a5e7e8..6c1238ff6 100644 --- a/libc/misc/error/err.c +++ b/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) { diff --git a/libc/misc/error/error.c b/libc/misc/error/error.c index 96c5dbe71..6528e28ce 100644 --- a/libc/misc/error/error.c +++ b/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; diff --git a/libc/misc/fnmatch/fnmatch.c b/libc/misc/fnmatch/fnmatch.c index ac7dbcf2b..b70cfd46e 100644 --- a/libc/misc/fnmatch/fnmatch.c +++ b/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) diff --git a/libc/misc/gnu/obstack.c b/libc/misc/gnu/obstack.c index 5fc031555..c1ae75869 100644 --- a/libc/misc/gnu/obstack.c +++ b/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. */ diff --git a/libc/misc/internals/__errno_location.c b/libc/misc/internals/__errno_location.c index 10b97753f..c0146ce68 100644 --- a/libc/misc/internals/__errno_location.c +++ b/libc/misc/internals/__errno_location.c @@ -1,8 +1,10 @@ #include #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 */ diff --git a/libc/misc/internals/__h_errno_location.c b/libc/misc/internals/__h_errno_location.c index a57478ca9..1fae93459 100644 --- a/libc/misc/internals/__h_errno_location.c +++ b/libc/misc/internals/__h_errno_location.c @@ -3,6 +3,8 @@ #include #undef h_errno +libc_hidden_proto(h_errno) + libc_hidden_proto(__h_errno_location) int * weak_const_function __h_errno_location (void) { diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 349c0e5d1..7bfe2ccc4 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/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; diff --git a/libc/misc/internals/errno.c b/libc/misc/internals/errno.c index b08478d44..ffacc8188 100644 --- a/libc/misc/internals/errno.c +++ b/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) diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index c32d09722..690e61398 100644 --- a/libc/misc/locale/locale.c +++ b/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 #include +#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. */ diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c index 864a92821..56737b7bc 100644 --- a/libc/misc/regex/regex.c +++ b/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) diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index 626e30140..24eca9e43 100644 --- a/libc/misc/time/time.c +++ b/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 -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]; diff --git a/libc/misc/ttyent/getttyent.c b/libc/misc/ttyent/getttyent.c index c11811769..4388744b2 100644 --- a/libc/misc/ttyent/getttyent.c +++ b/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; diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index 62a5af704..7beef1595 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -112,6 +112,9 @@ #include #include +#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) diff --git a/libc/misc/wctype/wctype.c b/libc/misc/wctype/wctype.c index ad52cd3e7..8f56f4556 100644 --- a/libc/misc/wctype/wctype.c +++ b/libc/misc/wctype/wctype.c @@ -39,7 +39,9 @@ #include 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. */ -- cgit v1.2.3