Explorar o código

Move to use attribute_hidden

Peter S. Mazinger %!s(int64=20) %!d(string=hai) anos
pai
achega
f8703c6453

+ 3 - 1
libc/string/generic/memchr.c

@@ -32,7 +32,7 @@
 #undef memchr
 #undef memchr
 
 
 /* Search no more than N bytes of S for C.  */
 /* 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 char *char_ptr;
   const unsigned long int *longword_ptr;
   const unsigned long int *longword_ptr;
@@ -173,3 +173,5 @@ void * memchr (const void * s, int c_in, size_t n)
 
 
   return 0;
   return 0;
 }
 }
+
+strong_alias(__memchr, memchr)

+ 5 - 8
libc/string/generic/memcmp.c

@@ -275,10 +275,7 @@ memcmp_not_common_alignment (srcp1, srcp2, len)
 }
 }
 
 
 int
 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 a0;
   op_t b0;
   op_t b0;
@@ -334,7 +331,7 @@ memcmp (s1, s2, len)
 
 
   return 0;
   return 0;
 }
 }
-#ifdef weak_alias
-# undef bcmp
-weak_alias (memcmp, bcmp)
-#endif
+
+strong_alias(__memcmp, memcmp)
+
+weak_alias(memcmp, bcmp)

+ 3 - 1
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);
   ((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 dstp = (long int) dstpp;
   unsigned long int srcp = (long int) srcpp;
   unsigned long int srcp = (long int) srcpp;
@@ -244,3 +244,5 @@ void *memcpy (void *dstpp, const void *srcpp, size_t len)
 
 
   return dstpp;
   return dstpp;
 }
 }
+
+strong_alias(__memcpy, memcpy)

+ 3 - 1
libc/string/generic/memmem.c

@@ -22,7 +22,7 @@
 #undef memmem
 #undef memmem
 
 
 /* Return the first occurrence of NEEDLE in HAYSTACK.  */
 /* 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 void *needle,  size_t needle_len)
 {
 {
   const char *begin;
   const char *begin;
@@ -48,3 +48,5 @@ void *memmem (const void *haystack, size_t haystack_len,
 
 
   return NULL;
   return NULL;
 }
 }
+
+strong_alias(__memmem, memmem)

+ 5 - 1
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);
   ((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 dstp = (long int) dest;
   unsigned long int srcp = (long int) src;
   unsigned long int srcp = (long int) src;
@@ -276,3 +278,5 @@ void *memmove (void *dest, const void *src, size_t len)
 
 
   return (dest);
   return (dest);
 }
 }
+
+strong_alias(__memmove, memmove)

+ 3 - 3
libc/string/generic/mempcpy.c

@@ -8,11 +8,11 @@
 #include <string.h>
 #include <string.h>
 
 
 #undef mempcpy
 #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);
   memcpy(dstpp, srcpp, len);
   return (void *)(((char *)dstpp) + len);
   return (void *)(((char *)dstpp) + len);
 }
 }
-weak_alias (__mempcpy, mempcpy)
+
+strong_alias (__mempcpy, mempcpy)

+ 3 - 1
libc/string/generic/memrchr.c

@@ -33,7 +33,7 @@
 #undef memrchr
 #undef memrchr
 
 
 /* Search no more than N bytes of S for C.  */
 /* 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 char *char_ptr;
   const unsigned long int *longword_ptr;
   const unsigned long int *longword_ptr;
@@ -172,3 +172,5 @@ void *memrchr (const void * s, int c_in, size_t n)
 
 
   return 0;
   return 0;
 }
 }
+
+strong_alias(__memrchr, memrchr)

+ 3 - 2
libc/string/generic/memset.c

@@ -21,8 +21,7 @@
 
 
 #undef memset
 #undef memset
 
 
-void *
-memset (dstpp, c, len)
+void attribute_hidden *__memset (dstpp, c, len)
      void *dstpp;
      void *dstpp;
      int c;
      int c;
      size_t len;
      size_t len;
@@ -88,3 +87,5 @@ memset (dstpp, c, len)
 
 
   return dstpp;
   return dstpp;
 }
 }
+
+strong_alias(__memset, memset)

+ 3 - 1
libc/string/generic/rawmemchr.c

@@ -32,7 +32,7 @@
 #undef rawmemchr
 #undef rawmemchr
 
 
 /* Find the first occurrence of C in S.  */
 /* 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 char *char_ptr;
   const unsigned long int *longword_ptr;
   const unsigned long int *longword_ptr;
@@ -158,3 +158,5 @@ void *rawmemchr (const void * s, int c_in)
 	}
 	}
     }
     }
 }
 }
+
+strong_alias(__rawmemchr, rawmemchr)

+ 3 - 2
libc/string/generic/strcat.c

@@ -22,8 +22,7 @@
 #undef strcat
 #undef strcat
 
 
 /* Append SRC on the end of DEST.  */
 /* Append SRC on the end of DEST.  */
-char *
-strcat (dest, src)
+char attribute_hidden *__strcat (dest, src)
      char *dest;
      char *dest;
      const char *src;
      const char *src;
 {
 {
@@ -49,3 +48,5 @@ strcat (dest, src)
 
 
   return dest;
   return dest;
 }
 }
+
+strong_alias(__strcat, strcat)

+ 4 - 6
libc/string/generic/strchr.c

@@ -29,8 +29,7 @@
 #undef strchr
 #undef strchr
 
 
 /* Find the first occurrence of C in S.  */
 /* Find the first occurrence of C in S.  */
-char *
-strchr (s, c_in)
+char attribute_hidden *__strchr (s, c_in)
      const char *s;
      const char *s;
      int c_in;
      int c_in;
 {
 {
@@ -184,7 +183,6 @@ strchr (s, c_in)
   return NULL;
   return NULL;
 }
 }
 
 
-#ifdef weak_alias
-#undef index
-weak_alias (strchr, index)
-#endif
+strong_alias(__strchr, strchr)
+
+weak_alias(strchr, index)

+ 2 - 3
libc/string/generic/strchrnul.c

@@ -26,11 +26,10 @@
 
 
 #include "memcopy.h"
 #include "memcopy.h"
 
 
-#undef __strchrnul
 #undef strchrnul
 #undef strchrnul
 
 
 /* Find the first occurrence of C in S or the final NUL byte.  */
 /* 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 char *char_ptr;
   const unsigned long int *longword_ptr;
   const unsigned long int *longword_ptr;
@@ -165,4 +164,4 @@ char *__strchrnul (const char *s, int c_in)
   return NULL;
   return NULL;
 }
 }
 
 
-weak_alias (__strchrnul, strchrnul)
+strong_alias(__strchrnul, strchrnul)

+ 5 - 3
libc/string/generic/strcmp.c

@@ -26,8 +26,7 @@
 /* Compare S1 and S2, returning less than, equal to or
 /* Compare S1 and S2, returning less than, equal to or
    greater than zero if S1 is lexicographically less than,
    greater than zero if S1 is lexicographically less than,
    equal to or greater than S2.  */
    equal to or greater than S2.  */
-int
-strcmp (p1, p2)
+int attribute_hidden __strcmp (p1, p2)
      const char *p1;
      const char *p1;
      const char *p2;
      const char *p2;
 {
 {
@@ -47,6 +46,9 @@ strcmp (p1, p2)
   return c1 - c2;
   return c1 - c2;
 }
 }
 
 
+strong_alias(__strcmp, strcmp)
+
 #ifdef __LOCALE_C_ONLY
 #ifdef __LOCALE_C_ONLY
-weak_alias(strcmp,strcoll);
+weak_alias(__strcmp, __strcoll)
+strong_alias(__strcoll, strcoll)
 #endif /* __LOCALE_C_ONLY */
 #endif /* __LOCALE_C_ONLY */

+ 3 - 2
libc/string/generic/strcpy.c

@@ -25,8 +25,7 @@
 #undef strcpy
 #undef strcpy
 
 
 /* Copy SRC to DEST.  */
 /* Copy SRC to DEST.  */
-char *
-strcpy (dest, src)
+char attribute_hidden *__strcpy (dest, src)
      char *dest;
      char *dest;
      const char *src;
      const char *src;
 {
 {
@@ -48,3 +47,5 @@ strcpy (dest, src)
 
 
   return dest;
   return dest;
 }
 }
+
+strong_alias(__strcpy, strcpy)

+ 3 - 4
libc/string/generic/strcspn.c

@@ -22,10 +22,7 @@
 
 
 /* Return the length of the maximum initial segment of S
 /* Return the length of the maximum initial segment of S
    which contains no characters from REJECT.  */
    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;
   size_t count = 0;
 
 
@@ -37,3 +34,5 @@ strcspn (s, reject)
 
 
   return count;
   return count;
 }
 }
+
+strong_alias(__strcspn, strcspn)

+ 3 - 2
libc/string/generic/strlen.c

@@ -26,8 +26,7 @@
 
 
 /* Return the length of the null-terminated string STR.  Scan for
 /* Return the length of the null-terminated string STR.  Scan for
    the null terminator quickly by testing four bytes at a time.  */
    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 *str;
 {
 {
   const char *char_ptr;
   const char *char_ptr;
@@ -150,3 +149,5 @@ strlen (str)
 	}
 	}
     }
     }
 }
 }
+
+strong_alias(__strlen, strlen)

+ 3 - 2
libc/string/generic/strncat.c

@@ -22,8 +22,7 @@
 
 
 #undef strncat
 #undef strncat
 
 
-char *
-strncat (s1, s2, n)
+char attribute_hidden *__strncat (s1, s2, n)
      char *s1;
      char *s1;
      const char *s2;
      const char *s2;
      size_t n;
      size_t n;
@@ -79,3 +78,5 @@ strncat (s1, s2, n)
 
 
   return s;
   return s;
 }
 }
+
+strong_alias(__strncat, strncat)

+ 3 - 5
libc/string/generic/strncmp.c

@@ -25,11 +25,7 @@
    returning less than, equal to or greater than zero
    returning less than, equal to or greater than zero
    if S1 is lexicographically less than, equal to or
    if S1 is lexicographically less than, equal to or
    greater than S2.  */
    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 c1 = '\0';
   unsigned reg_char c2 = '\0';
   unsigned reg_char c2 = '\0';
@@ -70,3 +66,5 @@ strncmp (s1, s2, n)
 
 
   return c1 - c2;
   return c1 - c2;
 }
 }
+
+strong_alias(__strncmp, strncmp)

+ 3 - 2
libc/string/generic/strncpy.c

@@ -21,8 +21,7 @@
 
 
 #undef strncpy
 #undef strncpy
 
 
-char *
-strncpy (s1, s2, n)
+char attribute_hidden *__strncpy (s1, s2, n)
      char *s1;
      char *s1;
      const char *s2;
      const char *s2;
      size_t n;
      size_t n;
@@ -84,3 +83,5 @@ strncpy (s1, s2, n)
 
 
   return s;
   return s;
 }
 }
+
+strong_alias(__strncpy, strncpy)

+ 5 - 1
libc/string/generic/strnlen.c

@@ -24,9 +24,11 @@
 #include <string.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdlib.h>
 
 
+#undef strnlen
+
 /* Find the length of S, but scan at most MAXLEN characters.  If no
 /* Find the length of S, but scan at most MAXLEN characters.  If no
    '\0' terminator is found in that many characters, return MAXLEN.  */
    '\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 char *char_ptr, *end_ptr = str + maxlen;
   const unsigned long int *longword_ptr;
   const unsigned long int *longword_ptr;
@@ -156,3 +158,5 @@ size_t strnlen (const char *str, size_t maxlen)
     char_ptr = end_ptr;
     char_ptr = end_ptr;
   return char_ptr - str;
   return char_ptr - str;
 }
 }
+
+strong_alias(__strnlen, strnlen)

+ 3 - 5
libc/string/generic/strrchr.c

@@ -21,8 +21,7 @@
 #undef strrchr
 #undef strrchr
 
 
 /* Find the last occurrence of C in S.  */
 /* 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;
   register const char *found, *p;
 
 
@@ -43,7 +42,6 @@ strrchr (const char *s, int c)
   return (char *) found;
   return (char *) found;
 }
 }
 
 
-#ifdef weak_alias
-#undef rindex
+strong_alias(__strrchr, strrchr)
+
 weak_alias (strrchr, rindex)
 weak_alias (strrchr, rindex)
-#endif

+ 3 - 1
libc/string/generic/strsep.c

@@ -20,7 +20,7 @@
 
 
 #undef strsep
 #undef strsep
 
 
-char *strsep (char **stringp, const char *delim)
+char attribute_hidden *__strsep (char **stringp, const char *delim)
 {
 {
   char *begin, *end;
   char *begin, *end;
 
 
@@ -63,3 +63,5 @@ char *strsep (char **stringp, const char *delim)
 
 
   return begin;
   return begin;
 }
 }
+
+strong_alias(__strsep, strsep)

+ 3 - 4
libc/string/generic/strspn.c

@@ -22,10 +22,7 @@
 
 
 /* Return the length of the maximum initial segment
 /* Return the length of the maximum initial segment
    of S which contains only characters in ACCEPT.  */
    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 *p;
   const char *a;
   const char *a;
@@ -44,3 +41,5 @@ strspn (s, accept)
 
 
   return count;
   return count;
 }
 }
+
+strong_alias(__strspn, strspn)

+ 3 - 4
libc/string/generic/strstr.c

@@ -32,10 +32,7 @@ typedef unsigned chartype;
 
 
 #undef strstr
 #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;
   const unsigned char *haystack, *needle;
   chartype b;
   chartype b;
@@ -114,3 +111,5 @@ foundneedle:
 ret0:
 ret0:
   return 0;
   return 0;
 }
 }
+
+strong_alias(__strstr, strstr)

+ 3 - 4
libc/string/generic/strtok_r.c

@@ -21,7 +21,6 @@
 #include <string.h>
 #include <string.h>
 
 
 #undef strtok_r
 #undef strtok_r
-#undef __strtok_r
 
 
 /* Parse S into tokens separated by characters in DELIM.
 /* Parse S into tokens separated by characters in DELIM.
    If S is NULL, the saved pointer in SAVE_PTR is used as
    If S is NULL, the saved pointer in SAVE_PTR is used as
@@ -33,8 +32,7 @@
 	x = strtok_r(NULL, "=", &sp);	// x = NULL
 	x = strtok_r(NULL, "=", &sp);	// x = NULL
 		// s = "abc\0-def\0"
 		// s = "abc\0-def\0"
 */
 */
-char *
-__strtok_r (s, delim, save_ptr)
+char attribute_hidden *__strtok_r (s, delim, save_ptr)
      char *s;
      char *s;
      const char *delim;
      const char *delim;
      char **save_ptr;
      char **save_ptr;
@@ -66,4 +64,5 @@ __strtok_r (s, delim, save_ptr)
     }
     }
   return token;
   return token;
 }
 }
-weak_alias (__strtok_r, strtok_r)
+
+strong_alias(__strtok_r, strtok_r)