summaryrefslogtreecommitdiff
path: root/libc/string
diff options
context:
space:
mode:
Diffstat (limited to 'libc/string')
-rw-r--r--libc/string/generic/memchr.c4
-rw-r--r--libc/string/generic/memcmp.c13
-rw-r--r--libc/string/generic/memcpy.c4
-rw-r--r--libc/string/generic/memmem.c4
-rw-r--r--libc/string/generic/memmove.c6
-rw-r--r--libc/string/generic/mempcpy.c6
-rw-r--r--libc/string/generic/memrchr.c4
-rw-r--r--libc/string/generic/memset.c5
-rw-r--r--libc/string/generic/rawmemchr.c4
-rw-r--r--libc/string/generic/strcat.c5
-rw-r--r--libc/string/generic/strchr.c10
-rw-r--r--libc/string/generic/strchrnul.c5
-rw-r--r--libc/string/generic/strcmp.c8
-rw-r--r--libc/string/generic/strcpy.c5
-rw-r--r--libc/string/generic/strcspn.c7
-rw-r--r--libc/string/generic/strlen.c5
-rw-r--r--libc/string/generic/strncat.c5
-rw-r--r--libc/string/generic/strncmp.c8
-rw-r--r--libc/string/generic/strncpy.c5
-rw-r--r--libc/string/generic/strnlen.c6
-rw-r--r--libc/string/generic/strrchr.c8
-rw-r--r--libc/string/generic/strsep.c4
-rw-r--r--libc/string/generic/strspn.c7
-rw-r--r--libc/string/generic/strstr.c7
-rw-r--r--libc/string/generic/strtok_r.c7
25 files changed, 83 insertions, 69 deletions
diff --git a/libc/string/generic/memchr.c b/libc/string/generic/memchr.c
index 6116b8f92..bc0623f3f 100644
--- a/libc/string/generic/memchr.c
+++ b/libc/string/generic/memchr.c
@@ -32,7 +32,7 @@
#undef memchr
/* Search no more than N bytes of S for C. */
-void * memchr (const void * s, int c_in, size_t n)
+void attribute_hidden *__memchr (const void * s, int c_in, size_t n)
{
const unsigned char *char_ptr;
const unsigned long int *longword_ptr;
@@ -173,3 +173,5 @@ void * memchr (const void * s, int c_in, size_t n)
return 0;
}
+
+strong_alias(__memchr, memchr)
diff --git a/libc/string/generic/memcmp.c b/libc/string/generic/memcmp.c
index d9c3a7cab..a3fcba036 100644
--- a/libc/string/generic/memcmp.c
+++ b/libc/string/generic/memcmp.c
@@ -275,10 +275,7 @@ memcmp_not_common_alignment (srcp1, srcp2, len)
}
int
-memcmp (s1, s2, len)
- const __ptr_t s1;
- const __ptr_t s2;
- size_t len;
+attribute_hidden __memcmp (const __ptr_t s1, const __ptr_t s2, size_t len)
{
op_t a0;
op_t b0;
@@ -334,7 +331,7 @@ memcmp (s1, s2, len)
return 0;
}
-#ifdef weak_alias
-# undef bcmp
-weak_alias (memcmp, bcmp)
-#endif
+
+strong_alias(__memcmp, memcmp)
+
+weak_alias(memcmp, bcmp)
diff --git a/libc/string/generic/memcpy.c b/libc/string/generic/memcpy.c
index 9851fdea6..2fb48ebef 100644
--- a/libc/string/generic/memcpy.c
+++ b/libc/string/generic/memcpy.c
@@ -211,7 +211,7 @@ static void _wordcopy_fwd_dest_aligned (long int dstp, long int srcp, size_t len
((op_t *) dstp)[0] = MERGE (a2, sh_1, a3, sh_2);
}
-void *memcpy (void *dstpp, const void *srcpp, size_t len)
+void attribute_hidden *__memcpy (void *dstpp, const void *srcpp, size_t len)
{
unsigned long int dstp = (long int) dstpp;
unsigned long int srcp = (long int) srcpp;
@@ -244,3 +244,5 @@ void *memcpy (void *dstpp, const void *srcpp, size_t len)
return dstpp;
}
+
+strong_alias(__memcpy, memcpy)
diff --git a/libc/string/generic/memmem.c b/libc/string/generic/memmem.c
index c0f2bd192..5f2c1e244 100644
--- a/libc/string/generic/memmem.c
+++ b/libc/string/generic/memmem.c
@@ -22,7 +22,7 @@
#undef memmem
/* Return the first occurrence of NEEDLE in HAYSTACK. */
-void *memmem (const void *haystack, size_t haystack_len,
+void attribute_hidden *__memmem (const void *haystack, size_t haystack_len,
const void *needle, size_t needle_len)
{
const char *begin;
@@ -48,3 +48,5 @@ void *memmem (const void *haystack, size_t haystack_len,
return NULL;
}
+
+strong_alias(__memmem, memmem)
diff --git a/libc/string/generic/memmove.c b/libc/string/generic/memmove.c
index 21876ce6e..ddf7c8aa4 100644
--- a/libc/string/generic/memmove.c
+++ b/libc/string/generic/memmove.c
@@ -206,7 +206,9 @@ static void _wordcopy_bwd_dest_aligned (long int dstp, long int srcp, size_t len
((op_t *) dstp)[3] = MERGE (a0, sh_1, a1, sh_2);
}
-void *memmove (void *dest, const void *src, size_t len)
+#undef memmove
+
+void attribute_hidden *__memmove (void *dest, const void *src, size_t len)
{
unsigned long int dstp = (long int) dest;
unsigned long int srcp = (long int) src;
@@ -276,3 +278,5 @@ void *memmove (void *dest, const void *src, size_t len)
return (dest);
}
+
+strong_alias(__memmove, memmove)
diff --git a/libc/string/generic/mempcpy.c b/libc/string/generic/mempcpy.c
index 46a2eaf92..cda156edf 100644
--- a/libc/string/generic/mempcpy.c
+++ b/libc/string/generic/mempcpy.c
@@ -8,11 +8,11 @@
#include <string.h>
#undef mempcpy
-#undef __mempcpy
-void *__mempcpy (void *dstpp, const void *srcpp, size_t len)
+void attribute_hidden *__mempcpy (void *dstpp, const void *srcpp, size_t len)
{
memcpy(dstpp, srcpp, len);
return (void *)(((char *)dstpp) + len);
}
-weak_alias (__mempcpy, mempcpy)
+
+strong_alias (__mempcpy, mempcpy)
diff --git a/libc/string/generic/memrchr.c b/libc/string/generic/memrchr.c
index f4d435e09..3f7583919 100644
--- a/libc/string/generic/memrchr.c
+++ b/libc/string/generic/memrchr.c
@@ -33,7 +33,7 @@
#undef memrchr
/* Search no more than N bytes of S for C. */
-void *memrchr (const void * s, int c_in, size_t n)
+void attribute_hidden *__memrchr (const void * s, int c_in, size_t n)
{
const unsigned char *char_ptr;
const unsigned long int *longword_ptr;
@@ -172,3 +172,5 @@ void *memrchr (const void * s, int c_in, size_t n)
return 0;
}
+
+strong_alias(__memrchr, memrchr)
diff --git a/libc/string/generic/memset.c b/libc/string/generic/memset.c
index 1fedb2c39..7ae69f85d 100644
--- a/libc/string/generic/memset.c
+++ b/libc/string/generic/memset.c
@@ -21,8 +21,7 @@
#undef memset
-void *
-memset (dstpp, c, len)
+void attribute_hidden *__memset (dstpp, c, len)
void *dstpp;
int c;
size_t len;
@@ -88,3 +87,5 @@ memset (dstpp, c, len)
return dstpp;
}
+
+strong_alias(__memset, memset)
diff --git a/libc/string/generic/rawmemchr.c b/libc/string/generic/rawmemchr.c
index 0e2ac1c7e..02cb8f629 100644
--- a/libc/string/generic/rawmemchr.c
+++ b/libc/string/generic/rawmemchr.c
@@ -32,7 +32,7 @@
#undef rawmemchr
/* Find the first occurrence of C in S. */
-void *rawmemchr (const void * s, int c_in)
+void attribute_hidden *__rawmemchr (const void * s, int c_in)
{
const unsigned char *char_ptr;
const unsigned long int *longword_ptr;
@@ -158,3 +158,5 @@ void *rawmemchr (const void * s, int c_in)
}
}
}
+
+strong_alias(__rawmemchr, rawmemchr)
diff --git a/libc/string/generic/strcat.c b/libc/string/generic/strcat.c
index a9ed4a442..58bf186c1 100644
--- a/libc/string/generic/strcat.c
+++ b/libc/string/generic/strcat.c
@@ -22,8 +22,7 @@
#undef strcat
/* Append SRC on the end of DEST. */
-char *
-strcat (dest, src)
+char attribute_hidden *__strcat (dest, src)
char *dest;
const char *src;
{
@@ -49,3 +48,5 @@ strcat (dest, src)
return dest;
}
+
+strong_alias(__strcat, strcat)
diff --git a/libc/string/generic/strchr.c b/libc/string/generic/strchr.c
index d0745060b..06476d448 100644
--- a/libc/string/generic/strchr.c
+++ b/libc/string/generic/strchr.c
@@ -29,8 +29,7 @@
#undef strchr
/* Find the first occurrence of C in S. */
-char *
-strchr (s, c_in)
+char attribute_hidden *__strchr (s, c_in)
const char *s;
int c_in;
{
@@ -184,7 +183,6 @@ strchr (s, c_in)
return NULL;
}
-#ifdef weak_alias
-#undef index
-weak_alias (strchr, index)
-#endif
+strong_alias(__strchr, strchr)
+
+weak_alias(strchr, index)
diff --git a/libc/string/generic/strchrnul.c b/libc/string/generic/strchrnul.c
index 908409a4c..faa0f4ff9 100644
--- a/libc/string/generic/strchrnul.c
+++ b/libc/string/generic/strchrnul.c
@@ -26,11 +26,10 @@
#include "memcopy.h"
-#undef __strchrnul
#undef strchrnul
/* Find the first occurrence of C in S or the final NUL byte. */
-char *__strchrnul (const char *s, int c_in)
+char attribute_hidden *__strchrnul (const char *s, int c_in)
{
const unsigned char *char_ptr;
const unsigned long int *longword_ptr;
@@ -165,4 +164,4 @@ char *__strchrnul (const char *s, int c_in)
return NULL;
}
-weak_alias (__strchrnul, strchrnul)
+strong_alias(__strchrnul, strchrnul)
diff --git a/libc/string/generic/strcmp.c b/libc/string/generic/strcmp.c
index c8212f04b..07e8e03da 100644
--- a/libc/string/generic/strcmp.c
+++ b/libc/string/generic/strcmp.c
@@ -26,8 +26,7 @@
/* Compare S1 and S2, returning less than, equal to or
greater than zero if S1 is lexicographically less than,
equal to or greater than S2. */
-int
-strcmp (p1, p2)
+int attribute_hidden __strcmp (p1, p2)
const char *p1;
const char *p2;
{
@@ -47,6 +46,9 @@ strcmp (p1, p2)
return c1 - c2;
}
+strong_alias(__strcmp, strcmp)
+
#ifdef __LOCALE_C_ONLY
-weak_alias(strcmp,strcoll);
+weak_alias(__strcmp, __strcoll)
+strong_alias(__strcoll, strcoll)
#endif /* __LOCALE_C_ONLY */
diff --git a/libc/string/generic/strcpy.c b/libc/string/generic/strcpy.c
index 7e40aab3f..7ecdfc9cb 100644
--- a/libc/string/generic/strcpy.c
+++ b/libc/string/generic/strcpy.c
@@ -25,8 +25,7 @@
#undef strcpy
/* Copy SRC to DEST. */
-char *
-strcpy (dest, src)
+char attribute_hidden *__strcpy (dest, src)
char *dest;
const char *src;
{
@@ -48,3 +47,5 @@ strcpy (dest, src)
return dest;
}
+
+strong_alias(__strcpy, strcpy)
diff --git a/libc/string/generic/strcspn.c b/libc/string/generic/strcspn.c
index c5d2d769d..c41132cf6 100644
--- a/libc/string/generic/strcspn.c
+++ b/libc/string/generic/strcspn.c
@@ -22,10 +22,7 @@
/* Return the length of the maximum initial segment of S
which contains no characters from REJECT. */
-size_t
-strcspn (s, reject)
- const char *s;
- const char *reject;
+size_t attribute_hidden __strcspn (const char *s, const char *reject)
{
size_t count = 0;
@@ -37,3 +34,5 @@ strcspn (s, reject)
return count;
}
+
+strong_alias(__strcspn, strcspn)
diff --git a/libc/string/generic/strlen.c b/libc/string/generic/strlen.c
index 2bbf8203f..a7a4ec20d 100644
--- a/libc/string/generic/strlen.c
+++ b/libc/string/generic/strlen.c
@@ -26,8 +26,7 @@
/* Return the length of the null-terminated string STR. Scan for
the null terminator quickly by testing four bytes at a time. */
-size_t
-strlen (str)
+size_t attribute_hidden __strlen (str)
const char *str;
{
const char *char_ptr;
@@ -150,3 +149,5 @@ strlen (str)
}
}
}
+
+strong_alias(__strlen, strlen)
diff --git a/libc/string/generic/strncat.c b/libc/string/generic/strncat.c
index a3d283bf7..0cba31d2a 100644
--- a/libc/string/generic/strncat.c
+++ b/libc/string/generic/strncat.c
@@ -22,8 +22,7 @@
#undef strncat
-char *
-strncat (s1, s2, n)
+char attribute_hidden *__strncat (s1, s2, n)
char *s1;
const char *s2;
size_t n;
@@ -79,3 +78,5 @@ strncat (s1, s2, n)
return s;
}
+
+strong_alias(__strncat, strncat)
diff --git a/libc/string/generic/strncmp.c b/libc/string/generic/strncmp.c
index d9964a883..22aa179b0 100644
--- a/libc/string/generic/strncmp.c
+++ b/libc/string/generic/strncmp.c
@@ -25,11 +25,7 @@
returning less than, equal to or greater than zero
if S1 is lexicographically less than, equal to or
greater than S2. */
-int
-strncmp (s1, s2, n)
- const char *s1;
- const char *s2;
- size_t n;
+int attribute_hidden __strncmp (const char *s1, const char *s2, size_t n)
{
unsigned reg_char c1 = '\0';
unsigned reg_char c2 = '\0';
@@ -70,3 +66,5 @@ strncmp (s1, s2, n)
return c1 - c2;
}
+
+strong_alias(__strncmp, strncmp)
diff --git a/libc/string/generic/strncpy.c b/libc/string/generic/strncpy.c
index 214f38430..f1ae63042 100644
--- a/libc/string/generic/strncpy.c
+++ b/libc/string/generic/strncpy.c
@@ -21,8 +21,7 @@
#undef strncpy
-char *
-strncpy (s1, s2, n)
+char attribute_hidden *__strncpy (s1, s2, n)
char *s1;
const char *s2;
size_t n;
@@ -84,3 +83,5 @@ strncpy (s1, s2, n)
return s;
}
+
+strong_alias(__strncpy, strncpy)
diff --git a/libc/string/generic/strnlen.c b/libc/string/generic/strnlen.c
index bdd3bb475..ff5c13739 100644
--- a/libc/string/generic/strnlen.c
+++ b/libc/string/generic/strnlen.c
@@ -24,9 +24,11 @@
#include <string.h>
#include <stdlib.h>
+#undef strnlen
+
/* Find the length of S, but scan at most MAXLEN characters. If no
'\0' terminator is found in that many characters, return MAXLEN. */
-size_t strnlen (const char *str, size_t maxlen)
+size_t attribute_hidden __strnlen (const char *str, size_t maxlen)
{
const char *char_ptr, *end_ptr = str + maxlen;
const unsigned long int *longword_ptr;
@@ -156,3 +158,5 @@ size_t strnlen (const char *str, size_t maxlen)
char_ptr = end_ptr;
return char_ptr - str;
}
+
+strong_alias(__strnlen, strnlen)
diff --git a/libc/string/generic/strrchr.c b/libc/string/generic/strrchr.c
index 8f815e9ff..bde4d4da0 100644
--- a/libc/string/generic/strrchr.c
+++ b/libc/string/generic/strrchr.c
@@ -21,8 +21,7 @@
#undef strrchr
/* Find the last occurrence of C in S. */
-char *
-strrchr (const char *s, int c)
+char attribute_hidden *__strrchr (const char *s, int c)
{
register const char *found, *p;
@@ -43,7 +42,6 @@ strrchr (const char *s, int c)
return (char *) found;
}
-#ifdef weak_alias
-#undef rindex
+strong_alias(__strrchr, strrchr)
+
weak_alias (strrchr, rindex)
-#endif
diff --git a/libc/string/generic/strsep.c b/libc/string/generic/strsep.c
index 345c722bf..77670607b 100644
--- a/libc/string/generic/strsep.c
+++ b/libc/string/generic/strsep.c
@@ -20,7 +20,7 @@
#undef strsep
-char *strsep (char **stringp, const char *delim)
+char attribute_hidden *__strsep (char **stringp, const char *delim)
{
char *begin, *end;
@@ -63,3 +63,5 @@ char *strsep (char **stringp, const char *delim)
return begin;
}
+
+strong_alias(__strsep, strsep)
diff --git a/libc/string/generic/strspn.c b/libc/string/generic/strspn.c
index dcf8b135d..1923f8afd 100644
--- a/libc/string/generic/strspn.c
+++ b/libc/string/generic/strspn.c
@@ -22,10 +22,7 @@
/* Return the length of the maximum initial segment
of S which contains only characters in ACCEPT. */
-size_t
-strspn (s, accept)
- const char *s;
- const char *accept;
+size_t attribute_hidden __strspn (const char *s, const char *accept)
{
const char *p;
const char *a;
@@ -44,3 +41,5 @@ strspn (s, accept)
return count;
}
+
+strong_alias(__strspn, strspn)
diff --git a/libc/string/generic/strstr.c b/libc/string/generic/strstr.c
index 45a64bb9b..b16261e56 100644
--- a/libc/string/generic/strstr.c
+++ b/libc/string/generic/strstr.c
@@ -32,10 +32,7 @@ typedef unsigned chartype;
#undef strstr
-char *
-strstr (phaystack, pneedle)
- const char *phaystack;
- const char *pneedle;
+char attribute_hidden *__strstr (const char *phaystack, const char *pneedle)
{
const unsigned char *haystack, *needle;
chartype b;
@@ -114,3 +111,5 @@ foundneedle:
ret0:
return 0;
}
+
+strong_alias(__strstr, strstr)
diff --git a/libc/string/generic/strtok_r.c b/libc/string/generic/strtok_r.c
index 15ca8b4ba..40d4e1a78 100644
--- a/libc/string/generic/strtok_r.c
+++ b/libc/string/generic/strtok_r.c
@@ -21,7 +21,6 @@
#include <string.h>
#undef strtok_r
-#undef __strtok_r
/* Parse S into tokens separated by characters in DELIM.
If S is NULL, the saved pointer in SAVE_PTR is used as
@@ -33,8 +32,7 @@
x = strtok_r(NULL, "=", &sp); // x = NULL
// s = "abc\0-def\0"
*/
-char *
-__strtok_r (s, delim, save_ptr)
+char attribute_hidden *__strtok_r (s, delim, save_ptr)
char *s;
const char *delim;
char **save_ptr;
@@ -66,4 +64,5 @@ __strtok_r (s, delim, save_ptr)
}
return token;
}
-weak_alias (__strtok_r, strtok_r)
+
+strong_alias(__strtok_r, strtok_r)