diff options
36 files changed, 92 insertions, 22 deletions
diff --git a/libc/string/Makefile.in b/libc/string/Makefile.in index 376316b7e..83fb1fa76 100644 --- a/libc/string/Makefile.in +++ b/libc/string/Makefile.in @@ -20,6 +20,8 @@ STRING_ARCH_SOBJ := $(patsubst $(STRING_ARCH_DIR)/%.S,$(STRING_ARCH_OUT)/%.o,$(S STRING_ARCH_OBJS := $(STRING_ARCH_OBJ) $(STRING_ARCH_SOBJ) libc-$(UCLIBC_HAS_STRING_ARCH_OPT) += $(STRING_ARCH_OBJS) +libc-a-$(UCLIBC_HAS_STRING_ARCH_OPT) += $(STRING_ARCH_OBJS) +libc-so-$(UCLIBC_HAS_STRING_ARCH_OPT) += $(STRING_ARCH_OBJS:.o=.os) libc-nomulti-$(UCLIBC_HAS_STRING_ARCH_OPT) += $(STRING_ARCH_SOBJ) @@ -40,6 +42,8 @@ endif STRING_GENERIC_OBJS := $(patsubst $(STRING_GENERIC_DIR)/%.c,$(STRING_GENERIC_OUT)/%.o,$(STRING_GENERIC_SRC)) libc-$(UCLIBC_HAS_STRING_GENERIC_OPT) += $(STRING_GENERIC_OBJS) +libc-a-$(UCLIBC_HAS_STRING_GENERIC_OPT) += $(STRING_GENERIC_OBJS) +libc-so-$(UCLIBC_HAS_STRING_GENERIC_OPT) += $(STRING_GENERIC_OBJS:.o=.os) # # Top level string @@ -104,6 +108,8 @@ endif STRING_COBJ := $(patsubst $(STRING_DIR)/%.c,$(STRING_OUT)/%.o,$(STRING_CSRC)) libc-y += $(STRING_COBJ) +libc-a-y += $(STRING_COBJ) +libc-so-y += $(STRING_COBJ:.o=.os) libc-nomulti-$(UCLIBC_HAS_XLOCALE) += $(STRING_OUT)/wcsxfrm_l.o diff --git a/libc/string/__xpg_strerror_r.c b/libc/string/__xpg_strerror_r.c index d146d35ac..c5096a6f7 100644 --- a/libc/string/__xpg_strerror_r.c +++ b/libc/string/__xpg_strerror_r.c @@ -8,7 +8,6 @@ #include <features.h> #include <errno.h> #include <string.h> -#include <bits/uClibc_uintmaxtostr.h> #include "_syserrmsg.h" libc_hidden_proto(__xpg_strerror_r) diff --git a/libc/string/_collate.c b/libc/string/_collate.c index 42216e9e4..3009e4ebf 100644 --- a/libc/string/_collate.c +++ b/libc/string/_collate.c @@ -57,8 +57,6 @@ 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) diff --git a/libc/string/_syserrmsg.h b/libc/string/_syserrmsg.h index efb7a1d59..8bd742e70 100644 --- a/libc/string/_syserrmsg.h +++ b/libc/string/_syserrmsg.h @@ -8,6 +8,8 @@ #ifndef __SYSERRMSG_H #define __SYSERRMSG_H 1 +#include <bits/uClibc_uintmaxtostr.h> + /**********************************************************************/ /* NOTE: If we ever do internationalized syserr messages, this will * have to be changed! */ diff --git a/libc/string/basename.c b/libc/string/basename.c index 2c4937fca..739eaec56 100644 --- a/libc/string/basename.c +++ b/libc/string/basename.c @@ -7,6 +7,7 @@ #include "_string.h" +#ifdef __USE_GNU libc_hidden_proto(basename) char *basename(const char *path) @@ -25,3 +26,4 @@ char *basename(const char *path) return (char *) p; } libc_hidden_def(basename) +#endif diff --git a/libc/string/bcopy.c b/libc/string/bcopy.c index 11c3e8015..bd233cb9c 100644 --- a/libc/string/bcopy.c +++ b/libc/string/bcopy.c @@ -7,6 +7,8 @@ #include "_string.h" +#ifdef __UCLIBC_SUSV3_LEGACY__ + libc_hidden_proto(memmove) void bcopy(const void *s2, void *s1, size_t n) @@ -51,3 +53,4 @@ void bcopy(const void *s2, void *s1, size_t n) #endif #endif } +#endif diff --git a/libc/string/bzero.c b/libc/string/bzero.c index 30bdf5674..519695cab 100644 --- a/libc/string/bzero.c +++ b/libc/string/bzero.c @@ -7,6 +7,8 @@ #include "_string.h" +#ifdef __UCLIBC_SUSV3_LEGACY__ + libc_hidden_proto(memset) void bzero(void *s, size_t n) @@ -29,3 +31,4 @@ void bzero(void *s, size_t n) #endif } #undef np +#endif diff --git a/libc/string/ffs.c b/libc/string/ffs.c index d98383d4e..9a68dc302 100644 --- a/libc/string/ffs.c +++ b/libc/string/ffs.c @@ -8,6 +8,7 @@ /* ffsl,ffsll */ #include "_string.h" +#include <strings.h> libc_hidden_proto(ffs) diff --git a/libc/string/generic/memcmp.c b/libc/string/generic/memcmp.c index 41f15369d..b754a5195 100644 --- a/libc/string/generic/memcmp.c +++ b/libc/string/generic/memcmp.c @@ -331,4 +331,6 @@ memcmp (const __ptr_t s1, const __ptr_t s2, size_t len) return 0; } libc_hidden_def(memcmp) +#ifdef __UCLIBC_SUSV3_LEGACY__ strong_alias(memcmp,bcmp) +#endif diff --git a/libc/string/generic/memmem.c b/libc/string/generic/memmem.c index c2e8547be..5d4e6f151 100644 --- a/libc/string/generic/memmem.c +++ b/libc/string/generic/memmem.c @@ -19,6 +19,7 @@ #include <string.h> #include <stddef.h> +#ifdef __USE_GNU libc_hidden_proto(memmem) libc_hidden_proto(memcmp) @@ -50,3 +51,4 @@ void *memmem (const void *haystack, size_t haystack_len, return NULL; } libc_hidden_def(memmem) +#endif diff --git a/libc/string/generic/memmove.c b/libc/string/generic/memmove.c index 68caacd78..0e51ea771 100644 --- a/libc/string/generic/memmove.c +++ b/libc/string/generic/memmove.c @@ -29,7 +29,8 @@ libc_hidden_proto(memcpy) static void _wordcopy_bwd_aligned (long int dstp, long int srcp, size_t len) { - op_t a0, a1; + op_t a0 = 0; + op_t a1 = 0; switch (len % 8) { @@ -133,7 +134,10 @@ static void _wordcopy_bwd_aligned (long int dstp, long int srcp, size_t len) static void _wordcopy_bwd_dest_aligned (long int dstp, long int srcp, size_t len) { - op_t a0, a1, a2, a3; + op_t a0 = 0; + op_t a1 = 0; + op_t a2 = 0; + op_t a3 = 0; int sh_1, sh_2; /* Calculate how to shift a word read at the memory operation diff --git a/libc/string/generic/mempcpy.c b/libc/string/generic/mempcpy.c index 7c251914d..46d19024b 100644 --- a/libc/string/generic/mempcpy.c +++ b/libc/string/generic/mempcpy.c @@ -7,6 +7,7 @@ #include <string.h> +#ifdef __USE_GNU libc_hidden_proto(mempcpy) libc_hidden_proto(memcpy) @@ -16,3 +17,4 @@ void *mempcpy (void *dstpp, const void *srcpp, size_t len) return (void *)(((char *)dstpp) + len); } libc_hidden_def(mempcpy) +#endif diff --git a/libc/string/generic/memrchr.c b/libc/string/generic/memrchr.c index f63efa46b..43439d5ce 100644 --- a/libc/string/generic/memrchr.c +++ b/libc/string/generic/memrchr.c @@ -26,6 +26,7 @@ #include <stdlib.h> #include <limits.h> +#ifdef __USE_GNU libc_hidden_proto(memrchr) libc_hidden_proto(abort) @@ -174,3 +175,4 @@ void *memrchr (const void * s, int c_in, size_t n) return 0; } libc_hidden_def(memrchr) +#endif diff --git a/libc/string/generic/rawmemchr.c b/libc/string/generic/rawmemchr.c index 85fc09836..6bf245265 100644 --- a/libc/string/generic/rawmemchr.c +++ b/libc/string/generic/rawmemchr.c @@ -25,6 +25,7 @@ #include <stdlib.h> #include <limits.h> +#ifdef __USE_GNU libc_hidden_proto(rawmemchr) libc_hidden_proto(abort) @@ -160,3 +161,4 @@ void *rawmemchr (const void * s, int c_in) } } libc_hidden_def(rawmemchr) +#endif diff --git a/libc/string/generic/strchr.c b/libc/string/generic/strchr.c index b1ffc7538..8d401ec8c 100644 --- a/libc/string/generic/strchr.c +++ b/libc/string/generic/strchr.c @@ -41,8 +41,8 @@ char *strchr (const char *s, int c_in) /* Handle the first few characters by reading one character at a time. Do this until CHAR_PTR is aligned on a longword boundary. */ - for (char_ptr = s; ((unsigned long int) char_ptr - & (sizeof (longword) - 1)) != 0; + for (char_ptr = (const unsigned char *) s; + ((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0; ++char_ptr) if (*char_ptr == c) return (void *) char_ptr; @@ -182,4 +182,6 @@ char *strchr (const char *s, int c_in) return NULL; } libc_hidden_def(strchr) +#ifdef __UCLIBC_SUSV3_LEGACY__ strong_alias(strchr,index) +#endif diff --git a/libc/string/generic/strchrnul.c b/libc/string/generic/strchrnul.c index e699a6dfa..17e32ab44 100644 --- a/libc/string/generic/strchrnul.c +++ b/libc/string/generic/strchrnul.c @@ -24,6 +24,7 @@ #include <string.h> #include <stdlib.h> +#ifdef __USE_GNU libc_hidden_proto(strchrnul) libc_hidden_proto(abort) @@ -41,8 +42,8 @@ char *strchrnul (const char *s, int c_in) /* Handle the first few characters by reading one character at a time. Do this until CHAR_PTR is aligned on a longword boundary. */ - for (char_ptr = s; ((unsigned long int) char_ptr - & (sizeof (longword) - 1)) != 0; + for (char_ptr = (const unsigned char *) s; + ((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0; ++char_ptr) if (*char_ptr == c || *char_ptr == '\0') return (void *) char_ptr; @@ -165,3 +166,4 @@ char *strchrnul (const char *s, int c_in) return NULL; } libc_hidden_def(strchrnul) +#endif diff --git a/libc/string/generic/strncmp.c b/libc/string/generic/strncmp.c index 4c1978439..12e0e4d17 100644 --- a/libc/string/generic/strncmp.c +++ b/libc/string/generic/strncmp.c @@ -65,4 +65,4 @@ int strncmp (const char *s1, const char *s2, size_t n) return c1 - c2; } -libc_hidden_def(strncmp) +libc_hidden_weak(strncmp) diff --git a/libc/string/generic/strnlen.c b/libc/string/generic/strnlen.c index 31b5ba8e0..3156e469a 100644 --- a/libc/string/generic/strnlen.c +++ b/libc/string/generic/strnlen.c @@ -24,6 +24,7 @@ #include <string.h> #include <stdlib.h> +#ifdef __USE_GNU libc_hidden_proto(strnlen) libc_hidden_proto(abort) @@ -160,3 +161,4 @@ size_t strnlen (const char *str, size_t maxlen) return char_ptr - str; } libc_hidden_def(strnlen) +#endif diff --git a/libc/string/generic/strrchr.c b/libc/string/generic/strrchr.c index b67e369fd..97192da95 100644 --- a/libc/string/generic/strrchr.c +++ b/libc/string/generic/strrchr.c @@ -43,4 +43,6 @@ char *strrchr (const char *s, int c) return (char *) found; } libc_hidden_def(strrchr) +#ifdef __UCLIBC_SUSV3_LEGACY__ strong_alias(strrchr,rindex) +#endif diff --git a/libc/string/generic/strsep.c b/libc/string/generic/strsep.c index 7b34e2c16..5cb1779d2 100644 --- a/libc/string/generic/strsep.c +++ b/libc/string/generic/strsep.c @@ -18,10 +18,12 @@ #include <string.h> -libc_hidden_proto(strsep) +#ifdef __USE_BSD + libc_hidden_proto(strchr) libc_hidden_proto(strpbrk) +libc_hidden_proto(strsep) char *strsep (char **stringp, const char *delim) { char *begin, *end; @@ -66,3 +68,4 @@ char *strsep (char **stringp, const char *delim) return begin; } libc_hidden_def(strsep) +#endif diff --git a/libc/string/generic/strtok_r.c b/libc/string/generic/strtok_r.c index 0ab18b35e..bae394a80 100644 --- a/libc/string/generic/strtok_r.c +++ b/libc/string/generic/strtok_r.c @@ -22,7 +22,13 @@ libc_hidden_proto(strtok_r) libc_hidden_proto(strspn) libc_hidden_proto(strpbrk) +#ifdef __USE_GNU +# define __rawmemchr rawmemchr libc_hidden_proto(rawmemchr) +#else +# define __rawmemchr strchr +libc_hidden_proto(strchr) +#endif /* Parse S into tokens separated by characters in DELIM. If S is NULL, the saved pointer in SAVE_PTR is used as @@ -54,7 +60,7 @@ char *strtok_r (char *s, const char *delim, char **save_ptr) s = strpbrk (token, delim); if (s == NULL) /* This token finishes the string. */ - *save_ptr = rawmemchr (token, '\0'); + *save_ptr = __rawmemchr (token, '\0'); else { /* Terminate the token and make *SAVE_PTR point past it. */ diff --git a/libc/string/memcmp.c b/libc/string/memcmp.c index 9de28c234..377a8d692 100644 --- a/libc/string/memcmp.c +++ b/libc/string/memcmp.c @@ -38,5 +38,7 @@ int Wmemcmp(const Wvoid *s1, const Wvoid *s2, size_t n) #ifndef WANT_WIDE libc_hidden_def(memcmp) +# ifdef __UCLIBC_SUSV3_LEGACY__ strong_alias(memcmp,bcmp) +# endif #endif diff --git a/libc/string/memmem.c b/libc/string/memmem.c index f57733c4a..fd60f1e7b 100644 --- a/libc/string/memmem.c +++ b/libc/string/memmem.c @@ -7,6 +7,8 @@ #include "_string.h" +#ifdef __USE_GNU +libc_hidden_proto(memmem) void *memmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen) { @@ -36,3 +38,5 @@ void *memmem(const void *haystack, size_t haystacklen, return NULL; } +libc_hidden_def(memmem) +#endif diff --git a/libc/string/mempcpy.c b/libc/string/mempcpy.c index 70626f24a..cf4af8d39 100644 --- a/libc/string/mempcpy.c +++ b/libc/string/mempcpy.c @@ -7,6 +7,8 @@ #include "_string.h" +#ifdef __USE_GNU + #ifdef WANT_WIDE # define Wmempcpy wmempcpy #else @@ -35,3 +37,4 @@ Wvoid *Wmempcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n) } libc_hidden_def(Wmempcpy) +#endif diff --git a/libc/string/memrchr.c b/libc/string/memrchr.c index 0bb67b2e5..2959396b2 100644 --- a/libc/string/memrchr.c +++ b/libc/string/memrchr.c @@ -7,6 +7,8 @@ #include "_string.h" +#ifdef __USE_GNU + libc_hidden_proto(memrchr) void *memrchr(const void *s, int c, size_t n) @@ -33,3 +35,4 @@ void *memrchr(const void *s, int c, size_t n) #undef np libc_hidden_def(memrchr) +#endif diff --git a/libc/string/psignal.c b/libc/string/psignal.c index a852e6047..467e3bc37 100644 --- a/libc/string/psignal.c +++ b/libc/string/psignal.c @@ -12,7 +12,6 @@ libc_hidden_proto(fprintf) libc_hidden_proto(strsignal) -libc_hidden_proto(stderr) /* TODO: make this threadsafe with a reentrant version of strsignal? */ diff --git a/libc/string/rawmemchr.c b/libc/string/rawmemchr.c index 754a34e18..1bbcb01b5 100644 --- a/libc/string/rawmemchr.c +++ b/libc/string/rawmemchr.c @@ -7,8 +7,8 @@ #include "_string.h" +#ifdef __USE_GNU libc_hidden_proto(rawmemchr) - void *rawmemchr(const void *s, int c) { register const unsigned char *r = s; @@ -18,3 +18,4 @@ void *rawmemchr(const void *s, int c) return (void *) r; /* silence the warning */ } libc_hidden_def(rawmemchr) +#endif diff --git a/libc/string/strcasecmp.c b/libc/string/strcasecmp.c index ac3f562a7..7fa521fb7 100644 --- a/libc/string/strcasecmp.c +++ b/libc/string/strcasecmp.c @@ -6,6 +6,7 @@ */ #include "_string.h" +#include <strings.h> #include <ctype.h> #include <locale.h> @@ -24,7 +25,7 @@ libc_hidden_proto(towlower) libc_hidden_proto(tolower_l) # define TOLOWER(C) tolower_l((C), locale_arg) # else -#ifndef __UCLIBC_HAS_XLOCALE__ +#if !defined __UCLIBC_HAS_XLOCALE__ && defined __UCLIBC_HAS_CTYPE_TABLES__ libc_hidden_proto(__ctype_tolower) #endif libc_hidden_proto(tolower) diff --git a/libc/string/strcasestr.c b/libc/string/strcasestr.c index 72c1e4702..afef59985 100644 --- a/libc/string/strcasestr.c +++ b/libc/string/strcasestr.c @@ -8,10 +8,10 @@ #include "_string.h" #include <ctype.h> -#ifndef __UCLIBC_HAS_XLOCALE__ -libc_hidden_proto(__ctype_tolower) -#else +#ifdef __UCLIBC_HAS_XLOCALE__ libc_hidden_proto(__ctype_tolower_loc) +#elif __UCLIBC_HAS_CTYPE_TABLES__ +libc_hidden_proto(__ctype_tolower) #endif libc_hidden_proto(tolower) diff --git a/libc/string/strchr.c b/libc/string/strchr.c index 6bfd2077d..0ce552438 100644 --- a/libc/string/strchr.c +++ b/libc/string/strchr.c @@ -27,6 +27,6 @@ Wchar *Wstrchr(register const Wchar *s, Wint c) } libc_hidden_def(Wstrchr) -#ifndef WANT_WIDE +#if !defined WANT_WIDE && defined __UCLIBC_SUSV3_LEGACY__ strong_alias(strchr,index) #endif diff --git a/libc/string/strchrnul.c b/libc/string/strchrnul.c index cc3883402..6fe7f6c3d 100644 --- a/libc/string/strchrnul.c +++ b/libc/string/strchrnul.c @@ -7,6 +7,8 @@ #include "_string.h" +#ifdef __USE_GNU + #ifdef WANT_WIDE # define Wstrchrnul wcschrnul #else @@ -22,3 +24,4 @@ Wchar *Wstrchrnul(register const Wchar *s, Wint c) return (Wchar *) s; } libc_hidden_def(Wstrchrnul) +#endif diff --git a/libc/string/strncasecmp.c b/libc/string/strncasecmp.c index 54de1b78c..9980dd704 100644 --- a/libc/string/strncasecmp.c +++ b/libc/string/strncasecmp.c @@ -6,6 +6,7 @@ */ #include "_string.h" +#include <strings.h> #include <ctype.h> #include <locale.h> @@ -24,7 +25,7 @@ libc_hidden_proto(towlower) libc_hidden_proto(tolower_l) # define TOLOWER(C) tolower_l((C), locale_arg) # else -#ifndef __UCLIBC_HAS_XLOCALE__ +#if !defined __UCLIBC_HAS_XLOCALE__ && defined __UCLIBC_HAS_CTYPE_TABLES__ libc_hidden_proto(__ctype_tolower) #endif libc_hidden_proto(tolower) diff --git a/libc/string/strncmp.c b/libc/string/strncmp.c index 7305cbaa5..8cebaacac 100644 --- a/libc/string/strncmp.c +++ b/libc/string/strncmp.c @@ -38,5 +38,5 @@ int Wstrncmp(register const Wchar *s1, register const Wchar *s2, size_t n) #endif } #ifndef WANT_WIDE -libc_hidden_def(strncmp) +libc_hidden_weak(strncmp) #endif diff --git a/libc/string/strnlen.c b/libc/string/strnlen.c index 547dd23b2..8fbc25c11 100644 --- a/libc/string/strnlen.c +++ b/libc/string/strnlen.c @@ -7,6 +7,8 @@ #include "_string.h" +#ifdef __USE_GNU + #ifdef WANT_WIDE # define Wstrnlen wcsnlen #else @@ -35,3 +37,4 @@ size_t Wstrnlen(const Wchar *s, size_t max) #undef maxp libc_hidden_def(Wstrnlen) +#endif diff --git a/libc/string/strrchr.c b/libc/string/strrchr.c index 8a9184f9f..67cafb75a 100644 --- a/libc/string/strrchr.c +++ b/libc/string/strrchr.c @@ -29,5 +29,7 @@ Wchar *Wstrrchr(register const Wchar *s, Wint c) } #ifndef WANT_WIDE libc_hidden_def(strrchr) +# ifdef __UCLIBC_SUSV3_LEGACY__ strong_alias(strrchr,rindex) +# endif #endif diff --git a/libc/string/strsep.c b/libc/string/strsep.c index 7f421891e..2cc940def 100644 --- a/libc/string/strsep.c +++ b/libc/string/strsep.c @@ -7,10 +7,12 @@ #include "_string.h" -libc_hidden_proto(strsep) +#ifdef __USE_BSD + libc_hidden_proto(strpbrk) libc_hidden_proto(strcspn) +libc_hidden_proto(strsep) char *strsep(char ** __restrict s1, const char * __restrict s2) { register char *s = *s1; @@ -32,3 +34,4 @@ char *strsep(char ** __restrict s1, const char * __restrict s2) return s; } libc_hidden_def(strsep) +#endif |