From e11c3011b10ada67c68d2d43a56fe606d35ca507 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 22 Dec 2007 06:28:23 +0000 Subject: 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 --- libc/string/bfin/memchr.S | 1 + libc/string/bfin/memcmp.S | 3 ++- libc/string/bfin/memcpy.S | 15 +++++---------- libc/string/bfin/memmove.S | 14 ++++---------- libc/string/bfin/memset.S | 14 ++++---------- libc/string/bfin/strcmp.S | 3 ++- libc/string/generic/memchr.c | 2 +- libc/string/generic/memcmp.c | 2 +- libc/string/generic/memcpy.c | 2 +- libc/string/generic/memmove.c | 2 +- libc/string/generic/mempcpy.c | 2 +- libc/string/generic/memset.c | 2 +- libc/string/generic/strchr.c | 4 ++-- libc/string/generic/strcmp.c | 2 +- libc/string/generic/strlen.c | 2 +- libc/string/generic/strrchr.c | 4 ++-- libc/string/mempcpy.c | 2 +- libc/string/strchr.c | 2 +- libc/string/strdup.c | 2 +- libc/string/strlen.c | 2 +- libc/string/strrchr.c | 4 ++-- 21 files changed, 36 insertions(+), 50 deletions(-) (limited to 'libc/string') diff --git a/libc/string/bfin/memchr.S b/libc/string/bfin/memchr.S index c264ad3d1..88e46bef6 100644 --- a/libc/string/bfin/memchr.S +++ b/libc/string/bfin/memchr.S @@ -23,6 +23,7 @@ .align 2 +.weak _memchr ENTRY(_memchr) P0 = R0; // P0 = address P2 = R2; // P2 = count diff --git a/libc/string/bfin/memcmp.S b/libc/string/bfin/memcmp.S index b5d4f1c7a..7cc76ad96 100644 --- a/libc/string/bfin/memcmp.S +++ b/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 diff --git a/libc/string/bfin/memcpy.S b/libc/string/bfin/memcpy.S index ae40cb244..bdd760691 100644 --- a/libc/string/bfin/memcpy.S +++ b/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) diff --git a/libc/string/bfin/memmove.S b/libc/string/bfin/memmove.S index da1128387..73e363820 100644 --- a/libc/string/bfin/memmove.S +++ b/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) diff --git a/libc/string/bfin/memset.S b/libc/string/bfin/memset.S index c8ee0835f..64012f783 100644 --- a/libc/string/bfin/memset.S +++ b/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) diff --git a/libc/string/bfin/strcmp.S b/libc/string/bfin/strcmp.S index c0a706d2b..12e8c53c6 100644 --- a/libc/string/bfin/strcmp.S +++ b/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 diff --git a/libc/string/generic/memchr.c b/libc/string/generic/memchr.c index 4bda5d758..4b40e4d65 100644 --- a/libc/string/generic/memchr.c +++ b/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) diff --git a/libc/string/generic/memcmp.c b/libc/string/generic/memcmp.c index b754a5195..b0d05cf8a 100644 --- a/libc/string/generic/memcmp.c +++ b/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 diff --git a/libc/string/generic/memcpy.c b/libc/string/generic/memcpy.c index 42e97a063..9d8764105 100644 --- a/libc/string/generic/memcpy.c +++ b/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) diff --git a/libc/string/generic/memmove.c b/libc/string/generic/memmove.c index 68caacd78..dca74ae74 100644 --- a/libc/string/generic/memmove.c +++ b/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) diff --git a/libc/string/generic/mempcpy.c b/libc/string/generic/mempcpy.c index 46d19024b..c80caac8f 100644 --- a/libc/string/generic/mempcpy.c +++ b/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 diff --git a/libc/string/generic/memset.c b/libc/string/generic/memset.c index 1df1a450f..50803cac5 100644 --- a/libc/string/generic/memset.c +++ b/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) diff --git a/libc/string/generic/strchr.c b/libc/string/generic/strchr.c index 8d401ec8c..985b78b5a 100644 --- a/libc/string/generic/strchr.c +++ b/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 diff --git a/libc/string/generic/strcmp.c b/libc/string/generic/strcmp.c index acfefb6dc..21c896986 100644 --- a/libc/string/generic/strcmp.c +++ b/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) diff --git a/libc/string/generic/strlen.c b/libc/string/generic/strlen.c index 3528829af..7e9b12fb9 100644 --- a/libc/string/generic/strlen.c +++ b/libc/string/generic/strlen.c @@ -149,4 +149,4 @@ size_t strlen (const char *str) } } } -libc_hidden_def(strlen) +libc_hidden_weak(strlen) diff --git a/libc/string/generic/strrchr.c b/libc/string/generic/strrchr.c index 97192da95..fe7118a49 100644 --- a/libc/string/generic/strrchr.c +++ b/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 diff --git a/libc/string/mempcpy.c b/libc/string/mempcpy.c index cf4af8d39..91896434b 100644 --- a/libc/string/mempcpy.c +++ b/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 diff --git a/libc/string/strchr.c b/libc/string/strchr.c index 0ce552438..329545e9f 100644 --- a/libc/string/strchr.c +++ b/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 diff --git a/libc/string/strdup.c b/libc/string/strdup.c index d15345d0d..fff74444c 100644 --- a/libc/string/strdup.c +++ b/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 diff --git a/libc/string/strlen.c b/libc/string/strlen.c index bcb096b97..2edb6e4e8 100644 --- a/libc/string/strlen.c +++ b/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) diff --git a/libc/string/strrchr.c b/libc/string/strrchr.c index 67cafb75a..2bf676d27 100644 --- a/libc/string/strrchr.c +++ b/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 -- cgit v1.2.3