瀏覽代碼

mark a bunch of public mem/str functions as weak so that people who insist on their own local copies while static linking dont hit link failures when other uClibc code force the libc.a objects to be pulled in via the hidden alias symbols

Mike Frysinger 16 年之前
父節點
當前提交
e11c3011b1

+ 1 - 0
libc/string/bfin/memchr.S

@@ -23,6 +23,7 @@
 
 .align 2
 
+.weak _memchr
 ENTRY(_memchr)
 	P0 = R0;             // P0 = address
 	P2 = R2;             // P2 = count

+ 2 - 1
libc/string/bfin/memcmp.S

@@ -23,6 +23,7 @@
 
 .align 2
 
+.weak _memcmp
 ENTRY(_memcmp)
 	I1 = P3;
 	P0 = R0;			/* P0 = s1 address */
@@ -99,5 +100,5 @@ ENTRY(_memcmp)
 libc_hidden_def (memcmp)
 
 #ifdef __UCLIBC_SUSV3_LEGACY__
-strong_alias (memcmp,bcmp)
+weak_alias (memcmp,bcmp)
 #endif

+ 5 - 10
libc/string/bfin/memcpy.S

@@ -23,12 +23,8 @@
 
 .align 2
 
-/* We have to bypass the libc-symbols.h machinery to make sure we get
- * a weak symbol for memcpy (some crummy gcc tests want to redefine it).
- */
-.global ___GI_memcpy
-.type ___GI_memcpy, STT_FUNC
-___GI_memcpy:
+.weak _memcpy
+ENTRY(_memcpy)
 	[--SP] = P3;
 	P0 = R0;              /* P0 = To address */
 	P3 = R1;              /* P3 = From Address */
@@ -75,8 +71,7 @@ ___GI_memcpy:
 	P3 = [SP++];
 
 	RTS;
-.size ___GI_memcpy,.-___GI_memcpy
 
-.hidden ___GI_memcpy
-.weak _memcpy
-.set _memcpy,___GI_memcpy
+.size _memcpy,.-_memcpy
+
+libc_hidden_def (memcpy)

+ 4 - 10
libc/string/bfin/memmove.S

@@ -23,12 +23,8 @@
 
 .align 2
 
-	/* We have to bypass the libc-symbols.h machinery to make sure we get
-	   a weak symbol for memcpy (some crummy gcc tests want to redefine
-	   it).  */
-.global ___GI_memmove
-.type ___GI_memmove, STT_FUNC
-___GI_memmove:
+.weak _memmove
+ENTRY(_memmove)
 	I1 = P3;
 	P0 = R0;                  /* P0 = To address */
 	P3 = R1;                  /* P3 = From Address */
@@ -99,8 +95,6 @@ ___GI_memmove:
 	P3 = I1;
 	RTS;
 
-.size ___GI_memmove,.-___GI_memmove
+.size _memmove,.-_memmove
 
-.hidden ___GI_memmove
-.weak _memmove
-.set _memmove,___GI_memmove
+libc_hidden_def (memmove)

+ 4 - 10
libc/string/bfin/memset.S

@@ -23,12 +23,8 @@
 
 .align 2
 
-/* We have to bypass the libc-symbols.h machinery to make sure we get
- * a weak symbol for memcpy (some crummy gcc tests want to redefine it).
- */
-.global ___GI_memset
-.type ___GI_memset, STT_FUNC
-___GI_memset:
+.weak _memset
+ENTRY(_memset)
 	P0 = R0 ;              /* P0 = address */
 	P2 = R2 ;              /* P2 = count   */
 	R3 = R0 + R2;          /* end          */
@@ -89,8 +85,6 @@ ___GI_memset:
 	B[P0++] = R1;
 	JUMP .Laligned;
 
-.size ___GI_memset,.-___GI_memset
+.size _memset,.-_memset
 
-.hidden ___GI_memset
-.weak _memset
-.set _memset,___GI_memset
+libc_hidden_def (memset)

+ 2 - 1
libc/string/bfin/strcmp.S

@@ -23,6 +23,7 @@
 
 .align 2
 
+.weak _strcmp
 ENTRY(_strcmp)
 	[--sp] = (R7:4);
 	p1 = r0;
@@ -116,6 +117,6 @@ ENTRY(_strcmp)
 libc_hidden_def (strcmp)
 
 #ifndef __UCLIBC_HAS_LOCALE__
-strong_alias (strcmp,strcoll)
+weak_alias (strcmp,strcoll)
 libc_hidden_def (strcoll)
 #endif

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

@@ -174,4 +174,4 @@ void *memchr (const void * s, int c_in, size_t n)
 
   return 0;
 }
-libc_hidden_def(memchr)
+libc_hidden_weak(memchr)

+ 1 - 1
libc/string/generic/memcmp.c

@@ -330,7 +330,7 @@ memcmp (const __ptr_t s1, const __ptr_t s2, size_t len)
 
   return 0;
 }
-libc_hidden_def(memcmp)
+libc_hidden_weak(memcmp)
 #ifdef __UCLIBC_SUSV3_LEGACY__
 strong_alias(memcmp,bcmp)
 #endif

+ 1 - 1
libc/string/generic/memcpy.c

@@ -244,4 +244,4 @@ void *memcpy (void *dstpp, const void *srcpp, size_t len)
 
   return dstpp;
 }
-libc_hidden_def(memcpy)
+libc_hidden_weak(memcpy)

+ 1 - 1
libc/string/generic/memmove.c

@@ -279,4 +279,4 @@ void *memmove (void *dest, const void *src, size_t len)
 
   return (dest);
 }
-libc_hidden_def(memmove)
+libc_hidden_weak(memmove)

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

@@ -16,5 +16,5 @@ void *mempcpy (void *dstpp, const void *srcpp, size_t len)
   memcpy(dstpp, srcpp, len);
   return (void *)(((char *)dstpp) + len);
 }
-libc_hidden_def(mempcpy)
+libc_hidden_weak(mempcpy)
 #endif

+ 1 - 1
libc/string/generic/memset.c

@@ -83,4 +83,4 @@ void *memset (void *dstpp, int c, size_t len)
 
   return dstpp;
 }
-libc_hidden_def(memset)
+libc_hidden_weak(memset)

+ 2 - 2
libc/string/generic/strchr.c

@@ -181,7 +181,7 @@ char *strchr (const char *s, int c_in)
 
   return NULL;
 }
-libc_hidden_def(strchr)
+libc_hidden_weak(strchr)
 #ifdef __UCLIBC_SUSV3_LEGACY__
-strong_alias(strchr,index)
+weak_alias(strchr,index)
 #endif

+ 1 - 1
libc/string/generic/strcmp.c

@@ -41,7 +41,7 @@ int strcmp (const char *p1, const char *p2)
 
   return c1 - c2;
 }
-libc_hidden_def(strcmp)
+libc_hidden_weak(strcmp)
 
 #ifndef __UCLIBC_HAS_LOCALE__
 libc_hidden_proto(strcoll)

+ 1 - 1
libc/string/generic/strlen.c

@@ -149,4 +149,4 @@ size_t strlen (const char *str)
 	}
     }
 }
-libc_hidden_def(strlen)
+libc_hidden_weak(strlen)

+ 2 - 2
libc/string/generic/strrchr.c

@@ -42,7 +42,7 @@ char *strrchr (const char *s, int c)
 
   return (char *) found;
 }
-libc_hidden_def(strrchr)
+libc_hidden_weak(strrchr)
 #ifdef __UCLIBC_SUSV3_LEGACY__
-strong_alias(strrchr,rindex)
+weak_alias(strrchr,rindex)
 #endif

+ 1 - 1
libc/string/mempcpy.c

@@ -36,5 +36,5 @@ Wvoid *Wmempcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n)
 	return r1;
 }
 
-libc_hidden_def(Wmempcpy)
+libc_hidden_weak(Wmempcpy)
 #endif

+ 1 - 1
libc/string/strchr.c

@@ -28,5 +28,5 @@ Wchar *Wstrchr(register const Wchar *s, Wint c)
 libc_hidden_def(Wstrchr)
 
 #if !defined WANT_WIDE && defined __UCLIBC_SUSV3_LEGACY__
-strong_alias(strchr,index)
+weak_alias(strchr,index)
 #endif

+ 1 - 1
libc/string/strdup.c

@@ -33,5 +33,5 @@ Wchar *Wstrdup(register const Wchar *s1)
 }
 
 #ifndef WANT_WIDE
-libc_hidden_def(strdup)
+libc_hidden_weak(strdup)
 #endif

+ 1 - 1
libc/string/strlen.c

@@ -23,4 +23,4 @@ size_t Wstrlen(const Wchar *s)
 
 	return p - s;
 }
-libc_hidden_def(Wstrlen)
+libc_hidden_weak(Wstrlen)

+ 2 - 2
libc/string/strrchr.c

@@ -28,8 +28,8 @@ Wchar *Wstrrchr(register const  Wchar *s, Wint c)
 	return (Wchar *) p;			/* silence the warning */
 }
 #ifndef WANT_WIDE
-libc_hidden_def(strrchr)
+libc_hidden_weak(strrchr)
 # ifdef __UCLIBC_SUSV3_LEGACY__
-strong_alias(strrchr,rindex)
+weak_alias(strrchr,rindex)
 # endif
 #endif