summaryrefslogtreecommitdiff
path: root/libc/misc
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2011-04-06 15:13:59 +0200
committerCarmelo Amoroso <carmelo.amoroso@st.com>2011-04-06 15:13:59 +0200
commit3b3285b1b7c02d36c74a6ae265fdb02ca991c96b (patch)
tree0f3bf060794323ff690f6f4a86dc903c4570f540 /libc/misc
parent289d19f45d7f8af9a4079938a3426aafdd2674ba (diff)
parent85f4b028d767fc390a7b866d2f58d58be489242d (diff)
Merge remote-tracking branch 'origin/master' into prelink
* origin/master: (137 commits) utils/ldd: Check for returned pointer from strrchr not the value it holds cris: add provide arch-specific vfork implementation lutimes.c, stubs.c: fix compiling lutimes, if __NR_utimensat is not defined bump version to 0.9.32-rc3-git release 0.9.32-rc3 memalign: include sys/param.h for MAX arm/bits/atomic.h: Include common/bit/atomic.h for thumb1 wctype.h: fix libc_hidden_proto for iswupper and add it for iswspace add libc_hidden_proto for wcs[n]casecmp_l really fix missing __libc_drand48_data Revert "missing prototype of __libc_drand48_data fixed" missing prototype of __libc_drand48_data fixed time.c, time.h: remove unused hidden strftime/strptime nanosleep.c: remove duplicated libc_hidden_proto ctype.c, ctype.h: remove commented parts that were banned for removal after 0.9.31 _wctype.c, wctype.h: remove unused isw* and wctype_l hidden functions time.c, wchar.h: remove unused hidden wcsftime str[n]casecmp.c: fix hidden usage remove unused hidden functions frv/memset.S: add missing libc_hidden_def ... Conflicts: ldso/ldso/ldso.c Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'libc/misc')
-rw-r--r--libc/misc/ctype/ctype.c5
-rw-r--r--libc/misc/elf/dl-iterate-phdr.c4
-rw-r--r--libc/misc/fnmatch/fnmatch.c5
-rw-r--r--libc/misc/ftw/ftw.c4
-rw-r--r--libc/misc/internals/__uClibc_main.c32
-rw-r--r--libc/misc/internals/tempname.c5
-rw-r--r--libc/misc/locale/locale.c4
-rw-r--r--libc/misc/pthread/tsd.c1
-rw-r--r--libc/misc/regex/regcomp.c4
-rw-r--r--libc/misc/regex/regex_internal.c4
-rw-r--r--libc/misc/sysvipc/msgq.c2
-rw-r--r--libc/misc/sysvipc/sem.c2
-rw-r--r--libc/misc/sysvipc/shm.c2
-rw-r--r--libc/misc/time/time.c20
-rw-r--r--libc/misc/utmp/utent.c2
-rw-r--r--libc/misc/wctype/_wctype.c23
16 files changed, 56 insertions, 63 deletions
diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c
index e46f66b58..1c40b244a 100644
--- a/libc/misc/ctype/ctype.c
+++ b/libc/misc/ctype/ctype.c
@@ -306,8 +306,6 @@ int tolower_l(int c, __locale_t l)
return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_tolower[c] : c;
}
libc_hidden_def(tolower_l)
-/*remove after 0.9.31. See ctype.h for why.
- *weak_alias (tolower_l, __tolower_l) */
#endif
/**********************************************************************/
@@ -346,9 +344,6 @@ int toupper_l(int c, __locale_t l)
#endif
return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_toupper[c] : c;
}
-libc_hidden_def(toupper_l)
-/*remove after 0.9.31. See ctype.h for why.
- *weak_alias (toupper_l, __toupper_l) */
#endif
/**********************************************************************/
diff --git a/libc/misc/elf/dl-iterate-phdr.c b/libc/misc/elf/dl-iterate-phdr.c
index a7677f11f..f0233ca37 100644
--- a/libc/misc/elf/dl-iterate-phdr.c
+++ b/libc/misc/elf/dl-iterate-phdr.c
@@ -62,9 +62,11 @@ dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
/* This entry describes this statically-linked program itself. */
struct dl_phdr_info info;
int ret;
-#ifdef __FDPIC__
+#if defined(__FDPIC__)
info.dlpi_addr.map = NULL;
info.dlpi_addr.got_value = NULL;
+#elif defined(__DSBT__)
+ info.dlpi_addr.map = NULL;
#else
info.dlpi_addr = 0;
#endif
diff --git a/libc/misc/fnmatch/fnmatch.c b/libc/misc/fnmatch/fnmatch.c
index 0fa043bad..2874413ec 100644
--- a/libc/misc/fnmatch/fnmatch.c
+++ b/libc/misc/fnmatch/fnmatch.c
@@ -334,11 +334,6 @@ is_char_class (const wchar_t *wcs)
# include "fnmatch_loop.c"
# endif
-#ifndef __UCLIBC_HAS_WCHAR__
-# undef MB_CUR_MAX
-# define MB_CUR_MAX 1
-#endif
-
int
fnmatch (const char *pattern, const char *string, int flags)
{
diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c
index 4a62e388a..9031e3589 100644
--- a/libc/misc/ftw/ftw.c
+++ b/libc/misc/ftw/ftw.c
@@ -752,7 +752,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
/* Entry points. */
-#if __UCLIBC_HAS_FTW__
+#ifdef __UCLIBC_HAS_FTW__
int
FTW_NAME (const char *path, FTW_FUNC_T func, int descriptors)
{
@@ -760,7 +760,7 @@ FTW_NAME (const char *path, FTW_FUNC_T func, int descriptors)
}
#endif
-#if __UCLIBC_HAS_NFTW__
+#ifdef __UCLIBC_HAS_NFTW__
#ifndef _LIBC
int
NFTW_NAME (const char *path, NFTW_FUNC_T func, int descriptors, int flags)
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index 36c0c6c63..71fdbd8a7 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -45,22 +45,15 @@ void *__libc_stack_end = NULL;
# ifdef __UCLIBC_HAS_SSP__
# include <dl-osinfo.h>
+static uintptr_t stack_chk_guard;
# ifndef THREAD_SET_STACK_GUARD
/* Only exported for architectures that don't store the stack guard canary
* in thread local area. */
-# include <stdint.h>
-uintptr_t stack_chk_guard;
/* for gcc-4.1 non-TLS */
uintptr_t __stack_chk_guard attribute_relro;
+# endif
/* for gcc-3.x + Etoh ssp */
-# ifdef __UCLIBC_HAS_SSP_COMPAT__
-# ifdef __HAVE_SHARED__
-strong_alias(__stack_chk_guard,__guard)
-# else
-uintptr_t __guard attribute_relro;
-# endif
-# endif
-# elif defined __UCLIBC_HAS_SSP_COMPAT__
+# ifdef __UCLIBC_HAS_SSP_COMPAT__
uintptr_t __guard attribute_relro;
# endif
# endif
@@ -255,18 +248,14 @@ void __uClibc_init(void)
#ifndef SHARED
# ifdef __UCLIBC_HAS_SSP__
/* Set up the stack checker's canary. */
+ stack_chk_guard = _dl_setup_stack_chk_guard();
# ifdef THREAD_SET_STACK_GUARD
- uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard();
THREAD_SET_STACK_GUARD (stack_chk_guard);
-# ifdef __UCLIBC_HAS_SSP_COMPAT__
- stack_chk_guard = _dl_setup_stack_chk_guard();
- __guard = stack_chk_guard;
-# endif
# else
__stack_chk_guard = stack_chk_guard;
-# if !defined __HAVE_SHARED__ && defined __UCLIBC_HAS_SSP_COMPAT__
- __guard = stack_chk_guard;
-# endif
+# endif
+# ifdef __UCLIBC_HAS_SSP_COMPAT__
+ __guard = stack_chk_guard;
# endif
# endif
#endif
@@ -317,6 +306,11 @@ void __uClibc_fini(void)
}
libc_hidden_def(__uClibc_fini)
+#ifndef SHARED
+extern void __nptl_deallocate_tsd (void) __attribute ((weak));
+extern unsigned int __nptl_nthreads __attribute ((weak));
+#endif
+
/* __uClibc_main is the new main stub for uClibc. This function is
* called from crt1 (version 0.9.28 or newer), after ALL shared libraries
* are initialized, just before we call the application's main function.
@@ -497,7 +491,6 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc,
# ifdef SHARED
__libc_pthread_functions.ptr__nptl_deallocate_tsd ();
# else
- extern void __nptl_deallocate_tsd (void) __attribute ((weak));
__nptl_deallocate_tsd ();
# endif
@@ -507,7 +500,6 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc,
# ifdef SHARED
unsigned int *const ptr = __libc_pthread_functions.ptr_nthreads;
# else
- extern unsigned int __nptl_nthreads __attribute ((weak));
unsigned int *const ptr = &__nptl_nthreads;
# endif
diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c
index 4145c9478..0db28455b 100644
--- a/libc/misc/internals/tempname.c
+++ b/libc/misc/internals/tempname.c
@@ -62,7 +62,10 @@ int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *di
const char *pfx /*, int try_tmpdir*/)
{
/*const char *d; */
- size_t dlen, plen;
+ /* dir and pfx lengths should always fit into an int,
+ so don't bother using size_t here. Especially since
+ the printf func requires an int for precision (%*s). */
+ int dlen, plen;
if (!pfx || !pfx[0])
{
diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c
index 52055a2d2..40303ab14 100644
--- a/libc/misc/locale/locale.c
+++ b/libc/misc/locale/locale.c
@@ -1057,6 +1057,7 @@ libc_hidden_def(__XL_NPP(nl_langinfo))
/**********************************************************************/
#ifdef L_newlocale
+#warning mask defines for extra locale categories
#ifdef __UCLIBC_MJN3_ONLY__
#warning TODO: Move posix and utf8 strings.
@@ -1302,7 +1303,9 @@ __locale_t newlocale(int category_mask, const char *locale, __locale_t base)
return base;
}
+#ifdef __UCLIBC_HAS_XLOCALE__
libc_hidden_def(newlocale)
+#endif
#endif
/**********************************************************************/
@@ -1336,7 +1339,6 @@ __locale_t duplocale(__locale_t dataset)
}
return r;
}
-libc_hidden_def(duplocale)
#endif
/**********************************************************************/
diff --git a/libc/misc/pthread/tsd.c b/libc/misc/pthread/tsd.c
index 835ee22ce..0c222e8e9 100644
--- a/libc/misc/pthread/tsd.c
+++ b/libc/misc/pthread/tsd.c
@@ -2,6 +2,7 @@
We define it here instead of in libpthread so t here instead of in libpthread so that it doesn't
need to have a TLS segment of its own just for this one pointer. */
+void **__libc_dl_error_tsd(void) __attribute__ ((const));
void ** __attribute__ ((const))
__libc_dl_error_tsd (void)
{
diff --git a/libc/misc/regex/regcomp.c b/libc/misc/regex/regcomp.c
index 8f2e18ce4..b25850ccd 100644
--- a/libc/misc/regex/regcomp.c
+++ b/libc/misc/regex/regcomp.c
@@ -819,11 +819,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size);
dfa->state_hash_mask = table_size - 1;
-#ifdef __UCLIBC_HAS_WCHAR__
dfa->mb_cur_max = MB_CUR_MAX;
-#else
- dfa->mb_cur_max = 1;
-#endif
#if 0
if (dfa->mb_cur_max == 6
&& strcmp (_NL_CURRENT (LC_CTYPE, _NL_CTYPE_CODESET_NAME), "UTF-8") == 0)
diff --git a/libc/misc/regex/regex_internal.c b/libc/misc/regex/regex_internal.c
index de640e08d..c6ac8dda1 100644
--- a/libc/misc/regex/regex_internal.c
+++ b/libc/misc/regex/regex_internal.c
@@ -627,7 +627,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
if (pstr->is_utf8)
{
- const unsigned char *raw, *p, *q, *end;
+ const unsigned char *raw, *p, *end;
/* Special case UTF-8. Multi-byte chars start with any
byte other than 0x80 - 0xbf. */
@@ -654,13 +654,11 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
unsigned char buf[6];
size_t mbclen;
- q = p;
if (BE (pstr->trans != NULL, 0))
{
int i = mlen < 6 ? mlen : 6;
while (--i >= 0)
buf[i] = pstr->trans[p[i]];
- q = buf;
}
/* XXX Don't use mbrtowc, we know which conversion
to use (UTF-8 -> UCS4). */
diff --git a/libc/misc/sysvipc/msgq.c b/libc/misc/sysvipc/msgq.c
index 27eb1ff92..185cd268b 100644
--- a/libc/misc/sysvipc/msgq.c
+++ b/libc/misc/sysvipc/msgq.c
@@ -12,7 +12,7 @@
#ifdef __NR_msgctl
#define __NR___libc_msgctl __NR_msgctl
-static __inline__ _syscall3(int, __libc_msgctl, int, msqid, int, cmd, struct msqid_ds *, buf);
+static __inline__ _syscall3(int, __libc_msgctl, int, msqid, int, cmd, struct msqid_ds *, buf)
#endif
/* Message queue control operation. */
int msgctl(int msqid, int cmd, struct msqid_ds *buf)
diff --git a/libc/misc/sysvipc/sem.c b/libc/misc/sysvipc/sem.c
index e340216e9..cca4cdfcc 100644
--- a/libc/misc/sysvipc/sem.c
+++ b/libc/misc/sysvipc/sem.c
@@ -41,7 +41,7 @@ union semun {
#ifdef __NR_semctl
#define __NR___semctl __NR_semctl
-static __inline__ _syscall4(int, __semctl, int, semid, int, semnum, int, cmd, void *, arg);
+static __inline__ _syscall4(int, __semctl, int, semid, int, semnum, int, cmd, void *, arg)
#endif
int semctl(int semid, int semnum, int cmd, ...)
diff --git a/libc/misc/sysvipc/shm.c b/libc/misc/sysvipc/shm.c
index 4b7ea0753..27e871f27 100644
--- a/libc/misc/sysvipc/shm.c
+++ b/libc/misc/sysvipc/shm.c
@@ -55,7 +55,7 @@ void * shmat (int shmid, const void *shmaddr, int shmflg)
/* Provide operations to control over shared memory segments. */
#ifdef __NR_shmctl
#define __NR___libc_shmctl __NR_shmctl
-static __inline__ _syscall3(int, __libc_shmctl, int, shmid, int, cmd, struct shmid_ds *, buf);
+static __inline__ _syscall3(int, __libc_shmctl, int, shmid, int, cmd, struct shmid_ds *, buf)
#endif
int shmctl(int shmid, int cmd, struct shmid_ds *buf)
{
diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c
index ff44892a8..19d68e105 100644
--- a/libc/misc/time/time.c
+++ b/libc/misc/time/time.c
@@ -799,7 +799,6 @@ size_t strftime(char *__restrict s, size_t maxsize,
{
return strftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE);
}
-libc_hidden_def(strftime)
#else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
@@ -999,7 +998,6 @@ static int load_field(int k, const struct tm *__restrict timeptr)
#warning TODO: Check multibyte format string validity.
#endif
-libc_hidden_proto(__XL_NPP(strftime))
size_t __XL_NPP(strftime)(char *__restrict s, size_t maxsize,
const char *__restrict format,
const struct tm *__restrict timeptr __LOCALE_PARAM )
@@ -1013,7 +1011,7 @@ size_t __XL_NPP(strftime)(char *__restrict s, size_t maxsize,
const char *stack[MAX_PUSH];
size_t count;
size_t o_count;
- int field_val, i, j, lvl;
+ int field_val = 0, i = 0, j, lvl;
int x[3]; /* wday, yday, year */
int isofm, days;
char buf[__UIM_BUFLEN_LONG];
@@ -1291,7 +1289,9 @@ OUTPUT:
}
goto LOOP;
}
-libc_hidden_def(__XL_NPP(strftime))
+# ifdef L_strftime_l
+libc_hidden_def(strftime_l)
+# endif
#endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
@@ -1314,7 +1314,6 @@ char *strptime(const char *__restrict buf, const char *__restrict format,
{
return strptime_l(buf, format, tm, __UCLIBC_CURLOCALE);
}
-libc_hidden_def(strptime)
#else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
@@ -1460,7 +1459,6 @@ static const unsigned char spec[] = {
#define MAX_PUSH 4
-libc_hidden_proto(__XL_NPP(strptime))
char *__XL_NPP(strptime)(const char *__restrict buf, const char *__restrict format,
struct tm *__restrict tm __LOCALE_PARAM)
{
@@ -1671,7 +1669,9 @@ LOOP:
}
return NULL;
}
-libc_hidden_def(__XL_NPP(strptime))
+# ifdef L_strptime_l
+libc_hidden_def(strptime_l)
+# endif
#endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
@@ -2455,11 +2455,9 @@ size_t wcsftime(wchar_t *__restrict s, size_t maxsize,
{
return wcsftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE);
}
-libc_hidden_def(wcsftime)
#else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
-libc_hidden_proto(__XL_NPP(wcsftime))
size_t __XL_NPP(wcsftime)(wchar_t *__restrict s, size_t maxsize,
const wchar_t *__restrict format,
const struct tm *__restrict timeptr __LOCALE_PARAM )
@@ -2467,7 +2465,9 @@ size_t __XL_NPP(wcsftime)(wchar_t *__restrict s, size_t maxsize,
#warning wcsftime always fails
return 0; /* always fail */
}
-libc_hidden_def(__XL_NPP(wcsftime))
+#ifdef L_wcsftime_l
+libc_hidden_def(wcsftime_l)
+#endif
#endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c
index bf265c2a3..11d615437 100644
--- a/libc/misc/utmp/utent.c
+++ b/libc/misc/utmp/utent.c
@@ -98,8 +98,8 @@ struct utmp *getutent(void)
__UCLIBC_MUTEX_UNLOCK(utmplock);
return ret;
}
-libc_hidden_def(getutent)
#endif
+libc_hidden_def(getutent)
void endutent(void)
{
diff --git a/libc/misc/wctype/_wctype.c b/libc/misc/wctype/_wctype.c
index 296293ff3..89269f45e 100644
--- a/libc/misc/wctype/_wctype.c
+++ b/libc/misc/wctype/_wctype.c
@@ -140,28 +140,27 @@ enum {
#ifdef __UCLIBC_DO_XLOCALE
#define ISW_FUNC_BODY(NAME) \
-libc_hidden_proto(__PASTE3(isw,NAME,_l)) \
int __PASTE3(isw,NAME,_l) (wint_t wc, __locale_t l) \
{ \
return iswctype_l(wc, __PASTE2(_CTYPE_is,NAME), l); \
-} \
-libc_hidden_def(__PASTE3(isw,NAME,_l))
+}
#else /* __UCLIBC_DO_XLOCALE */
#define ISW_FUNC_BODY(NAME) \
-libc_hidden_proto(__PASTE2(isw,NAME)) \
int __PASTE2(isw,NAME) (wint_t wc) \
{ \
return iswctype(wc, __PASTE2(_CTYPE_is,NAME)); \
-} \
-libc_hidden_def(__PASTE2(isw,NAME))
+}
#endif /* __UCLIBC_DO_XLOCALE */
/**********************************************************************/
#if defined(L_iswalnum) || defined(L_iswalnum_l)
ISW_FUNC_BODY(alnum);
+# ifdef L_iswalnum
+libc_hidden_def(iswalnum)
+# endif
#endif
/**********************************************************************/
@@ -198,6 +197,9 @@ ISW_FUNC_BODY(graph);
#if defined(L_iswlower) || defined(L_iswlower_l)
ISW_FUNC_BODY(lower);
+# ifdef L_iswlower
+libc_hidden_def(iswlower)
+# endif
#endif
/**********************************************************************/
@@ -216,12 +218,20 @@ ISW_FUNC_BODY(punct);
#if defined(L_iswspace) || defined(L_iswspace_l)
ISW_FUNC_BODY(space);
+# ifdef L_iswspace
+libc_hidden_def(iswspace)
+# else
+libc_hidden_def(iswspace_l)
+# endif
#endif
/**********************************************************************/
#if defined(L_iswupper) || defined(L_iswupper_l)
ISW_FUNC_BODY(upper);
+# ifdef L_iswupper
+libc_hidden_def(iswupper)
+# endif
#endif
/**********************************************************************/
@@ -461,7 +471,6 @@ wctype_t wctype_l (const char *property, __locale_t locale)
{
return wctype(property);
}
-libc_hidden_def(wctype_l)
#endif
/**********************************************************************/