diff options
Diffstat (limited to 'libc/string')
41 files changed, 277 insertions, 158 deletions
diff --git a/libc/string/Makefile.in b/libc/string/Makefile.in index 820baec1c..0adcaee39 100644 --- a/libc/string/Makefile.in +++ b/libc/string/Makefile.in @@ -10,32 +10,26 @@ include $(top_srcdir)libc/string/generic/Makefile.in MSRC:=wstring.c -MOBJ:= basename.o bcopy.o bzero.o dirname.o ffs.o memccpy.o memchr.o memcmp.o \ - memcpy.o memmove.o mempcpy.o memrchr.o memset.o rawmemchr.o stpcpy.o \ - stpncpy.o strcasecmp.o strcasestr.o strcat.o strchrnul.o strchr.o \ - strcmp.o strcpy.o strcspn.o strdup.o strlen.o strncasecmp.o strncat.o \ - strncmp.o strncpy.o strndup.o strnlen.o strpbrk.o strrchr.o strsep.o \ - strspn.o strstr.o strtok.o strtok_r.o strerror.o __xpg_strerror_r.o \ +MOBJ:= basename.o bcopy.o bzero.o dirname.o ffs.o memccpy.o \ + memrchr.o rawmemchr.o strcasecmp.o strcasestr.o \ + strncasecmp.o strndup.o strsep.o \ + strtok.o strerror.o __xpg_strerror_r.o \ _string_syserrmsgs.o __glibc_strerror_r.o \ _string_syssigmsgs.o sys_siglist.o strsignal.o psignal.o \ - __xpg_basename.o strlcat.o strlcpy.o sys_errlist.o memmem.o + __xpg_basename.o strlcat.o sys_errlist.o memmem.o -MOBJW= +MOBJW:= ifeq ($(UCLIBC_HAS_WCHAR),y) -MOBJW= wcscasecmp.o wcscat.o wcschrnul.o wcschr.o wcscmp.o wcscpy.o wcscspn.o \ - wcsdup.o wcslen.o wcsncasecmp.o wcsncat.o wcsncmp.o wcsncpy.o \ - wcsnlen.o wcspbrk.o wcsrchr.o wcsspn.o wcsstr.o wcstok.o wmemchr.o \ - wmemcmp.o wmemcpy.o wmemmove.o wmempcpy.o wmemset.o wcpcpy.o wcpncpy.o \ - __wcslcpy.o \ +MOBJW:= wcscasecmp.o wcsncasecmp.o \ wcsxfrm.o strxfrm.o # wcscoll strcoll.o endif -MOBJx= -MOBJWx= +MOBJx:= +MOBJWx:= ifeq ($(UCLIBC_HAS_XLOCALE),y) -MOBJx+=strcasecmp_l.o strncasecmp_l.o +MOBJx:=strcasecmp_l.o strncasecmp_l.o ifeq ($(UCLIBC_HAS_WCHAR),y) -MOBJWx+=wcscasecmp_l.o wcsncasecmp_l.o wcsxfrm_l.o strxfrm_l.o +MOBJWx:=wcscasecmp_l.o wcsncasecmp_l.o wcsxfrm_l.o strxfrm_l.o endif endif @@ -56,38 +50,71 @@ endif STRING_DIR:=$(top_srcdir)libc/string STRING_OUT:=$(top_builddir)libc/string +STRING_WSRC:=$(filter-out $(STRING_DIR)/wstring.c,$(wildcard $(STRING_DIR)/w*.c)) +STRING_CSRC:=$(filter-out $(STRING_DIR)/wstring.c $(STRING_WSRC),$(wildcard $(STRING_DIR)/*.c)) + +ifeq ($(UCLIBC_HAS_STRING_ARCH_OPT),y) +ifneq ($(strip $(STRING_ARCH_OBJS)),) +MOBJ:=$(filter-out $(notdir $(STRING_ARCH_OBJS)),$(MOBJ)) +STRING_CSRC:=$(filter-out $(patsubst %.o,$(STRING_DIR)/%.c,$(notdir $(STRING_ARCH_OBJS))),$(STRING_CSRC)) +STRING_WSRC:=$(filter-out $(patsubst %.o,$(STRING_DIR)/%.c,$(notdir $(STRING_ARCH_OBJS))),$(STRING_WSRC)) +endif +endif + +ifeq ($(UCLIBC_HAS_STRING_GENERIC_OPT),y) +ifneq ($(strip $(STRING_GENERIC_OBJS)),) +MOBJ:=$(filter-out $(notdir $(STRING_GENERIC_OBJS)),$(MOBJ)) +STRING_CSRC:=$(filter-out $(patsubst %.o,$(STRING_DIR)/%.c,$(notdir $(STRING_GENERIC_OBJS))),$(STRING_CSRC)) +STRING_WSRC:=$(filter-out $(patsubst %.o,$(STRING_DIR)/%.c,$(notdir $(STRING_GENERIC_OBJS))),$(STRING_WSRC)) +endif +endif + + +STRING_COBJ:=$(patsubst $(STRING_DIR)/%.c,$(STRING_OUT)/%.o,$(STRING_CSRC)) +ifeq ($(UCLIBC_HAS_WCHAR),y) +STRING_WOBJ:=$(patsubst $(STRING_DIR)/%.c,$(STRING_OUT)/%.o,$(STRING_WSRC)) +endif STRING_MSRC:=$(patsubst %.c,$(STRING_DIR)/%.c,$(MSRC)) STRING_MOBJ:=$(patsubst %.o,$(STRING_OUT)/%.o,$(MOBJ)) -STRING_MOBJW=$(patsubst %.o,$(STRING_OUT)/%.o,$(MOBJW)) -STRING_MOBJx=$(patsubst %.o,$(STRING_OUT)/%.o,$(MOBJx)) -STRING_MOBJWx=$(patsubst %.o,$(STRING_OUT)/%.o,$(MOBJWx)) +STRING_MOBJW:=$(patsubst %.o,$(STRING_OUT)/%.o,$(MOBJW)) +STRING_MOBJx:=$(patsubst %.o,$(STRING_OUT)/%.o,$(MOBJx)) +STRING_MOBJWx:=$(patsubst %.o,$(STRING_OUT)/%.o,$(MOBJWx)) + +STRING_DEF:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(STRING_MOBJ)))) -#STRING_DEF:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(STRING_MOBJ)))) +STRING_Wx:=$(STRING_MOBJW) $(STRING_MOBJx) $(STRING_MOBJWx) +STRING_OBJS:=$(STRING_COBJ) $(STRING_WOBJ) $(STRING_MOBJ) $(STRING_Wx) -STRING_Wx=$(STRING_MOBJW) $(STRING_MOBJx) $(STRING_MOBJWx) -STRING_OBJS:=$(STRING_MOBJ) $(STRING_Wx) +$(STRING_MOBJ): $(STRING_MSRC) + $(compile.m) -$(STRING_MOBJ) $(STRING_MOBJ:.o=.os): $(STRING_MSRC) +$(STRING_MOBJ:.o=.os): $(STRING_MSRC) $(compile.m) -$(STRING_MOBJW) $(STRING_MOBJW:.o=.os): $(STRING_MSRC) +$(STRING_MOBJW): $(STRING_MSRC) $(compile.m) -DWANT_WIDE -$(STRING_MOBJx) $(STRING_MOBJx:.o=.os): $(STRING_MSRC) +$(STRING_MOBJW:.o=.os): $(STRING_MSRC) + $(compile.m) -DWANT_WIDE + +$(STRING_MOBJx): $(STRING_MSRC) + $(compile.m) -D__UCLIBC_DO_XLOCALE + +$(STRING_MOBJx:.o=.os): $(STRING_MSRC) $(compile.m) -D__UCLIBC_DO_XLOCALE -$(STRING_MOBJWx) $(STRING_MOBJWx:.o=.os): $(STRING_MSRC) +$(STRING_MOBJWx): $(STRING_MSRC) + $(compile.m) -DWANT_WIDE -D__UCLIBC_DO_XLOCALE + +$(STRING_MOBJWx:.o=.os): $(STRING_MSRC) $(compile.m) -DWANT_WIDE -D__UCLIBC_DO_XLOCALE libc-a-y+=$(STRING_OBJS) -libc-a-pic-y+=$(STRING_OBJS:.o=.os) libc-so-y+=$(STRING_OBJS:.o=.os) -# multi does not work here, because arch/Makefile.in uses the same L_* defines -#CFLAGS-multi-y+=$(STRING_DEF) -#libc-multi-y+=$(STRING_MSRC) -#libc-nomulti-y+=$(STRING_Wx) -libc-nomulti-y+=$(STRING_OBJS) +CFLAGS-multi-y+=$(STRING_DEF) +libc-multi-y+=$(STRING_MSRC) $(STRING_CSRC) $(STRING_WSRC) +libc-nomulti-y+=$(STRING_Wx) objclean-y+=string_objclean diff --git a/libc/string/arm/Makefile.arch b/libc/string/arm/Makefile.arch index f4069d9d1..4b2550ee2 100644 --- a/libc/string/arm/Makefile.arch +++ b/libc/string/arm/Makefile.arch @@ -19,7 +19,7 @@ STRING_ARCH_OBJS:=$(STRING_ARCH_OBJ) libc-a-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS) libc-so-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS:.o=.os) -libc-multi-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_SRC) +libc-nomulti-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS) objclean-y+=string_arch_objclean diff --git a/libc/string/frv/Makefile.arch b/libc/string/frv/Makefile.arch index 5b5230088..a864e8d1a 100644 --- a/libc/string/frv/Makefile.arch +++ b/libc/string/frv/Makefile.arch @@ -19,7 +19,7 @@ STRING_ARCH_OBJS:=$(STRING_ARCH_OBJ) libc-a-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS) libc-so-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS:.o=.os) -libc-multi-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_SRC) +libc-nomulti-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS) objclean-y+=string_arch_objclean diff --git a/libc/string/generic/Makefile.in b/libc/string/generic/Makefile.in index 2273181d5..82910172a 100644 --- a/libc/string/generic/Makefile.in +++ b/libc/string/generic/Makefile.in @@ -9,23 +9,19 @@ STRING_GENERIC_DIR:=$(top_srcdir)libc/string/generic STRING_GENERIC_OUT:=$(top_builddir)libc/string/generic STRING_GENERIC_SRC:=$(wildcard $(STRING_GENERIC_DIR)/*.c) -MOBJ:=$(patsubst $(STRING_GENERIC_DIR)/%.c,%.o,$(STRING_GENERIC_SRC)) ifeq ($(UCLIBC_HAS_STRING_ARCH_OPT),y) ifneq ($(strip $(STRING_ARCH_OBJS)),) -MOBJ:=$(filter-out $(notdir $(STRING_ARCH_OBJS)),$(MOBJ)) +STRING_GENERIC_SRC:=$(filter-out $(patsubst %.o,$(STRING_GENERIC_DIR)/%.c,$(notdir $(STRING_ARCH_OBJS))),$(STRING_GENERIC_SRC)) endif endif -STRING_GENERIC_OBJ:=$(patsubst %.o,$(STRING_GENERIC_OUT)/%.o,$(MOBJ)) - -STRING_GENERIC_OBJS:=$(STRING_GENERIC_OBJ) +STRING_GENERIC_OBJS:=$(patsubst $(STRING_GENERIC_DIR)/%.c,$(STRING_GENERIC_OUT)/%.o,$(STRING_GENERIC_SRC)) libc-a-$(UCLIBC_HAS_STRING_GENERIC_OPT)+=$(STRING_GENERIC_OBJS) libc-so-$(UCLIBC_HAS_STRING_GENERIC_OPT)+=$(STRING_GENERIC_OBJS:.o=.os) -#libc-multi-$(UCLIBC_HAS_STRING_GENERIC_OPT)+=$(STRING_GENERIC_SRC) -libc-nomulti-$(UCLIBC_HAS_STRING_GENERIC_OPT)+=$(STRING_GENERIC_OBJS) +libc-multi-$(UCLIBC_HAS_STRING_GENERIC_OPT)+=$(STRING_GENERIC_SRC) objclean-y+=string_generic_objclean diff --git a/libc/string/i386/Makefile.arch b/libc/string/i386/Makefile.arch index 65f461cbb..27a29dd16 100644 --- a/libc/string/i386/Makefile.arch +++ b/libc/string/i386/Makefile.arch @@ -5,29 +5,18 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -MSRC:=string.c -MOBJ:= strcpy.o strncpy.o strcat.o strncat.o strcmp.o \ - strncmp.o strchr.o strrchr.o strlen.o strnlen.o \ - memcpy.o memmove.o memchr.o memset.o - STRING_ARCH_DIR:=$(top_srcdir)libc/string/i386 STRING_ARCH_OUT:=$(top_builddir)libc/string/i386 -STRING_ARCH_MSRC:=$(patsubst %.c,$(STRING_ARCH_DIR)/%.c,$(MSRC)) -STRING_ARCH_MOBJ:=$(patsubst %.o,$(STRING_ARCH_OUT)/%.o,$(MOBJ)) - -STRING_ARCH_OBJS:=$(STRING_ARCH_MOBJ) - -STRING_ARCH_DEF:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(STRING_ARCH_OBJS)))) +STRING_ARCH_CSRC:=$(wildcard $(STRING_ARCH_DIR)/*.c) +STRING_ARCH_COBJ:=$(patsubst $(STRING_ARCH_DIR)/%.c,$(STRING_ARCH_OUT)/%.o,$(STRING_ARCH_CSRC)) -$(STRING_ARCH_MOBJ) $(STRING_ARCH_MOBJ:.o=.os): $(STRING_ARCH_MSRC) - $(compile.m) +STRING_ARCH_OBJS:=$(STRING_ARCH_COBJ) libc-a-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS) libc-so-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS:.o=.os) -CFLAGS-multi-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_DEF) -libc-multi-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_MSRC) +libc-multi-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_CSRC) objclean-y+=string_arch_objclean diff --git a/libc/string/mips/Makefile.arch b/libc/string/mips/Makefile.arch index 8aebbe27b..a110c291e 100644 --- a/libc/string/mips/Makefile.arch +++ b/libc/string/mips/Makefile.arch @@ -18,7 +18,7 @@ STRING_ARCH_OBJS:=$(STRING_ARCH_OBJ) libc-a-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS) libc-so-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS:.o=.os) -libc-multi-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_SRC) +libc-nomulti-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS) objclean-y+=string_arch_objclean diff --git a/libc/string/powerpc/Makefile.arch b/libc/string/powerpc/Makefile.arch index 97ae14e7f..47a8dac1d 100644 --- a/libc/string/powerpc/Makefile.arch +++ b/libc/string/powerpc/Makefile.arch @@ -5,27 +5,18 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -MSRC:=string.c -MOBJ:=memcpy.o memmove.o memset.o bzero.o - STRING_ARCH_DIR:=$(top_srcdir)libc/string/powerpc STRING_ARCH_OUT:=$(top_builddir)libc/string/powerpc -STRING_ARCH_MSRC:=$(patsubst %.c,$(STRING_ARCH_DIR)/%.c,$(MSRC)) -STRING_ARCH_MOBJ:=$(patsubst %.o,$(STRING_ARCH_OUT)/%.o,$(MOBJ)) - -STRING_ARCH_OBJS:=$(STRING_ARCH_MOBJ) - -STRING_ARCH_DEF:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(STRING_ARCH_MOBJ)))) +STRING_ARCH_CSRC:=$(wildcard $(STRING_ARCH_DIR)/*.c) +STRING_ARCH_COBJ:=$(patsubst $(STRING_ARCH_DIR)/%.c,$(STRING_ARCH_OUT)/%.o,$(STRING_ARCH_CSRC)) -$(STRING_ARCH_MOBJ) $(STRING_ARCH_MOBJ:.o=.os): $(STRING_ARCH_MSRC) - $(compile.m) +STRING_ARCH_OBJS:=$(STRING_ARCH_COBJ) libc-a-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS) libc-so-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS:.o=.os) -CFLAGS-multi-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_DEF) -libc-multi-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_MSRC) +libc-multi-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_CSRC) objclean-y+=string_arch_objclean diff --git a/libc/string/sh64/Makefile.arch b/libc/string/sh64/Makefile.arch index b691ae1d7..f246864f6 100644 --- a/libc/string/sh64/Makefile.arch +++ b/libc/string/sh64/Makefile.arch @@ -19,7 +19,7 @@ STRING_ARCH_OBJS:=$(STRING_ARCH_OBJ) libc-a-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS) libc-so-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS:.o=.os) -libc-multi-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_SRC) +libc-nomulti-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS) objclean-y+=string_arch_objclean diff --git a/libc/string/sh64/memcpy.S b/libc/string/sh64/memcpy.S index 361e050db..0ee386a96 100644 --- a/libc/string/sh64/memcpy.S +++ b/libc/string/sh64/memcpy.S @@ -38,10 +38,13 @@ .section .text..SHmedia32,"ax" .globl memcpy - .type memcpy, @function + .set memcpy,__memcpy + .globl __memcpy + .hidden __memcpy + .type __memcpy, @function .align 5 -memcpy: +__memcpy: #define LDUAQ(P,O,D0,D1) ldlo.q P,O,D0; ldhi.q P,O+7,D1 #define STUAQ(P,O,D0,D1) stlo.q P,O,D0; sthi.q P,O+7,D1 @@ -198,5 +201,4 @@ Loop_ua: stlo.q r5, 8, r1 blink tr1, r63 - .size memcpy, . - memcpy - + .size __memcpy,.-__memcpy diff --git a/libc/string/sh64/memset.S b/libc/string/sh64/memset.S index 714fa3fb3..e1679230b 100644 --- a/libc/string/sh64/memset.S +++ b/libc/string/sh64/memset.S @@ -19,11 +19,14 @@ .section .text..SHmedia32,"ax" .globl memset - .type memset, @function + .set memset,__memset + .globl __memset + .hidden __memset + .type __memset, @function .align 5 -memset: +__memset: pta/l multiquad, tr0 andi r2, 7, r22 ptabs r18, tr2 @@ -88,5 +91,4 @@ loop: sthi.q r5, -1, r3 blink tr2,r63 - .size memset, . - memset - + .size __memset,.-__memset diff --git a/libc/string/sh64/strcpy.S b/libc/string/sh64/strcpy.S index 273e9147c..faa071c50 100644 --- a/libc/string/sh64/strcpy.S +++ b/libc/string/sh64/strcpy.S @@ -16,10 +16,13 @@ .section .text..SHmedia32,"ax" .globl strcpy - .type strcpy, @function + .set strcpy,__strcpy + .globl __strcpy + .hidden __strcpy + .type __strcpy, @function .align 5 -strcpy: +__strcpy: pta/l shortstring,tr1 ldlo.q r3,0,r4 @@ -94,5 +97,4 @@ loop: addi r0, 8, r0 blink tr1, r63 // shortstring - .size strcpy, . - strcpy - + .size __strcpy,.-__strcpy diff --git a/libc/string/sh64/strlen.S b/libc/string/sh64/strlen.S index 57d15a29a..0f99488d5 100644 --- a/libc/string/sh64/strlen.S +++ b/libc/string/sh64/strlen.S @@ -32,10 +32,13 @@ .section .text..SHmedia32,"ax" .globl strlen - .type strlen,@function + .set strlen,__strlen + .globl __strlen + .hidden __strlen + .type __strlen,@function .balign 16 -strlen: +__strlen: ptabs r18, tr4 /* @@ -56,5 +59,4 @@ loop: or r0, r63, r2 blink tr4, r63 - .size strlen, . - strlen - + .size __strlen,.-__strlen diff --git a/libc/string/sparc/Makefile.arch b/libc/string/sparc/Makefile.arch index 726140c1b..1acd93ad9 100644 --- a/libc/string/sparc/Makefile.arch +++ b/libc/string/sparc/Makefile.arch @@ -19,7 +19,8 @@ STRING_ARCH_OBJS:=$(STRING_ARCH_OBJ) $(STRING_ARCH_SOBJ) libc-a-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS) libc-so-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS:.o=.os) -libc-multi-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_SRC) $(STRING_ARCH_SSRC) +libc-multi-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_SRC) +libc-nomulti-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_SOBJ) objclean-y+=string_arch_objclean diff --git a/libc/string/sparc/sparc32/memchr.S b/libc/string/sparc/sparc32/memchr.S index c00df2427..e8f44f176 100644 --- a/libc/string/sparc/sparc32/memchr.S +++ b/libc/string/sparc/sparc32/memchr.S @@ -63,6 +63,9 @@ 1: retl sub %o0, 1, %o0 +.globl memchr +.set memchr,__memchr +.hidden __memchr ENTRY(__memchr) andcc %o1, 0xff, %o1 sll %o1, 8, %g6 @@ -138,7 +141,6 @@ ENTRY(__memchr) sub %o0, 4, %o0 END(__memchr) -weak_alias (__memchr, memchr) #if !__BOUNDED_POINTERS__ weak_alias (__memchr, __ubp_memchr) #endif diff --git a/libc/string/sparc/sparc32/memcpy.S b/libc/string/sparc/sparc32/memcpy.S index d0a80887b..b2a9b1602 100644 --- a/libc/string/sparc/sparc32/memcpy.S +++ b/libc/string/sparc/sparc32/memcpy.S @@ -161,12 +161,19 @@ b 3f sub %o0, 2, %o0 -ENTRY(bcopy) +.globl bcopy +.set bcopy,__bcopy +.hidden __bcopy +ENTRY(__bcopy) mov %o0, %o3 mov %o1, %o0 mov %o3, %o1 -END(bcopy) -ENTRY(memmove) +END(__bcopy) + +.globl memmove +.set memmove,__memmove +.hidden __memmove +ENTRY(__memmove) cmp %o0, %o1 st %o0, [%sp + 64] bleu 9f @@ -446,9 +453,12 @@ ENTRY(memmove) sub %o2, 2, %o2 b 3f add %o0, 2, %o0 -END(memmove) +END(__memmove) -ENTRY(memcpy) /* %o0=dst %o1=src %o2=len */ +.globl memcpy +.set memcpy,__memcpy +.hidden __memcpy +ENTRY(__memcpy) /* %o0=dst %o1=src %o2=len */ sub %o0, %o1, %o4 st %o0, [%sp + 64] 9: andcc %o4, 3, %o5 @@ -963,4 +973,4 @@ ENTRY(memcpy) /* %o0=dst %o1=src %o2=len */ sub %o7, %o4, %o5 110: retl sub %o7, %g6, %o5 -END(memcpy) +END(__memcpy) diff --git a/libc/string/sparc/sparc32/memset.S b/libc/string/sparc/sparc32/memset.S index 02cebb791..ef8a5b634 100644 --- a/libc/string/sparc/sparc32/memset.S +++ b/libc/string/sparc/sparc32/memset.S @@ -62,7 +62,10 @@ ENTRY(__bzero) sub %o0, %o2, %o0 END(__bzero) -ENTRY(memset) +.globl memset +.set memset,__memset +.hidden __memset +ENTRY(__memset) and %o1, 0xff, %g3 sll %g3, 8, %g2 or %g3, %g2, %g3 @@ -147,6 +150,6 @@ ENTRY(memset) stb %g3, [%o0 + 6] 0: retl nop -END(memset) +END(__memset) weak_alias (__bzero, bzero) diff --git a/libc/string/sparc/sparc32/stpcpy.S b/libc/string/sparc/sparc32/stpcpy.S index b7e7a00f8..97a5dce0e 100644 --- a/libc/string/sparc/sparc32/stpcpy.S +++ b/libc/string/sparc/sparc32/stpcpy.S @@ -65,6 +65,9 @@ 1: retl add %o0, -1, %o0 +.globl stpcpy +.set stpcpy,__stpcpy +.hidden __stpcpy ENTRY(__stpcpy) andcc %o1, 3, %g0 bne 10b @@ -157,5 +160,3 @@ ENTRY(__stpcpy) 19: retl nop END(__stpcpy) - -weak_alias (__stpcpy, stpcpy) diff --git a/libc/string/sparc/sparc32/strcat.S b/libc/string/sparc/sparc32/strcat.S index e4ff21d01..8efe6aebf 100644 --- a/libc/string/sparc/sparc32/strcat.S +++ b/libc/string/sparc/sparc32/strcat.S @@ -91,7 +91,10 @@ b 3f sub %o0, 1, %o0 -ENTRY(strcat) +.globl strcat +.set strcat,__strcat +.hidden __strcat +ENTRY(__strcat) mov %o0, %g2 andcc %o0, 3, %g0 bne 11b @@ -343,4 +346,4 @@ ENTRY(strcat) srl %o5, 16, %o4 retl mov %g2, %o0 -END(strcat) +END(__strcat) diff --git a/libc/string/sparc/sparc32/strchr.S b/libc/string/sparc/sparc32/strchr.S index f18a8abc7..450b4ffe6 100644 --- a/libc/string/sparc/sparc32/strchr.S +++ b/libc/string/sparc/sparc32/strchr.S @@ -67,7 +67,10 @@ 1: retl sub %o0, 1, %o0 -ENTRY(strchr) +.globl strchr +.set strchr,__strchr +.hidden __strchr +ENTRY(__strchr) andcc %o1, 0xff, %o1 be 12f sll %o1, 8, %o2 @@ -215,9 +218,12 @@ ENTRY(strchr) 1: or %o4, %lo(0x01010101), %o2 b 7f ld [%o0], %g4 -END(strchr) +END(__strchr) -ENTRY(strrchr) +.globl strrchr +.set strrchr,__strrchr +.hidden __strrchr +ENTRY(__strrchr) andcc %o1, 0xff, %o1 clr %o5 be 12b @@ -274,7 +280,7 @@ ENTRY(strrchr) ld [%o0], %g4 9: retl mov %o5, %o0 -END(strrchr) +END(__strrchr) weak_alias (strchr, index) weak_alias (strrchr, rindex) diff --git a/libc/string/sparc/sparc32/strcmp.S b/libc/string/sparc/sparc32/strcmp.S index d6cf9e7d3..2ae1b2ef4 100644 --- a/libc/string/sparc/sparc32/strcmp.S +++ b/libc/string/sparc/sparc32/strcmp.S @@ -74,7 +74,10 @@ 2: retl mov %o4, %o0 -ENTRY(strcmp) +.globl strcmp +.set strcmp,__strcmp +.hidden __strcmp +ENTRY(__strcmp) andcc %o0, 3, %g0 bne 10b sethi %hi(0x80808080), %g1 @@ -252,4 +255,4 @@ ENTRY(strcmp) ld [%i0], %i4 jmpl %i7 + 8, %g0 restore %g4, %g0, %o0 -END(strcmp) +END(__strcmp) diff --git a/libc/string/sparc/sparc32/strcpy.S b/libc/string/sparc/sparc32/strcpy.S index c368580ba..6dc3517b5 100644 --- a/libc/string/sparc/sparc32/strcpy.S +++ b/libc/string/sparc/sparc32/strcpy.S @@ -63,7 +63,10 @@ b 6f andcc %o0, 3, %g3 -ENTRY(strcpy) +.globl strcpy +.set strcpy,__strcpy +.hidden __strcpy +ENTRY(__strcpy) mov %o0, %g2 andcc %o1, 3, %g0 bne 1b @@ -269,4 +272,4 @@ ENTRY(strcpy) srl %o5, 16, %o4 retl mov %g2, %o0 -END(strcpy) +END(__strcpy) diff --git a/libc/string/sparc/sparc32/strlen.S b/libc/string/sparc/sparc32/strlen.S index cc455ac89..116700e24 100644 --- a/libc/string/sparc/sparc32/strlen.S +++ b/libc/string/sparc/sparc32/strlen.S @@ -63,7 +63,10 @@ 3: retl mov 2, %o0 -ENTRY(strlen) +.globl strlen +.set strlen,__strlen +.hidden __strlen +ENTRY(__strlen) mov %o0, %o1 andcc %o0, 3, %g0 bne 10b @@ -98,4 +101,4 @@ ENTRY(strlen) add %o4, 1, %o4 13: retl sub %o4, %o1, %o0 -END(strlen) +END(__strlen) diff --git a/libc/string/sparc/sparc64/memcpy.S b/libc/string/sparc/sparc64/memcpy.S index 660fae6b2..47f812a1e 100644 --- a/libc/string/sparc/sparc64/memcpy.S +++ b/libc/string/sparc/sparc64/memcpy.S @@ -191,7 +191,10 @@ .text .align 32 -ENTRY(bcopy) +.globl bcopy +.set bcopy,__bcopy +.hidden __bcopy +ENTRY(__bcopy) sub %o1, %o0, %o4 /* IEU0 Group */ mov %o0, %g3 /* IEU1 */ cmp %o4, %o2 /* IEU1 Group */ @@ -205,7 +208,7 @@ ENTRY(bcopy) add %o0, %o2, %o0 /* IEU0 */ retl nop -END(bcopy) +END(__bcopy) .align 32 200: be,pt %xcc, 201f /* CTI */ @@ -503,7 +506,10 @@ END(__align_cpy_16) #endif .align 32 -ENTRY(memcpy) +.globl memcpy +.set memcpy,__memcpy +.hidden __memcpy +ENTRY(__memcpy) 210: #ifndef USE_BPR srl %o2, 0, %o2 /* IEU1 Group */ @@ -694,7 +700,7 @@ ENTRY(memcpy) 214: wr %g0, FPRS_FEF, %fprs retl mov %g4, %o0 -END(memcpy) +END(__memcpy) .align 32 228: andcc %o2, 1, %g0 /* IEU1 Group */ @@ -719,7 +725,10 @@ END(memcpy) nop .align 32 -ENTRY(memmove) +.globl memmove +.set memmove,__memmove +.hidden __memmove +ENTRY(__memmove) #ifndef USE_BPR srl %o2, 0, %o2 /* IEU1 Group */ #endif @@ -910,7 +919,7 @@ ENTRY(memmove) 234: wr %g0, FPRS_FEF, %fprs retl mov %g4, %o0 -END(memmove) +END(__memmove) #ifdef USE_BPR weak_alias (memcpy, __align_cpy_1) diff --git a/libc/string/sparc/sparc64/memset.S b/libc/string/sparc/sparc64/memset.S index 2e23f92a8..5d2911451 100644 --- a/libc/string/sparc/sparc64/memset.S +++ b/libc/string/sparc/sparc64/memset.S @@ -36,7 +36,10 @@ /* Well, memset is a lot easier to get right than bcopy... */ .text .align 32 -ENTRY(memset) +.globl memset +.set memset,__memset +.hidden __memset +ENTRY(__memset) andcc %o1, 0xff, %o1 mov %o0, %o5 be,a,pt %icc, 50f @@ -176,7 +179,7 @@ ENTRY(memset) nop ba,pt %xcc, 18b ldd [%o0], %f0 -END(memset) +END(__memset) #define ZERO_BLOCKS(base, offset, source) \ stx source, [base - offset - 0x38]; \ diff --git a/libc/string/sparc/sparc64/sparcv9b/memcpy.S b/libc/string/sparc/sparc64/sparcv9b/memcpy.S index 7f36b7c2c..91e74d438 100644 --- a/libc/string/sparc/sparc64/sparcv9b/memcpy.S +++ b/libc/string/sparc/sparc64/sparcv9b/memcpy.S @@ -36,7 +36,10 @@ .text .align 32 -ENTRY(bcopy) +.globl bcopy +.set bcopy,__bcopy +.hidden __bcopy +ENTRY(__bcopy) sub %o1, %o0, %o4 mov %o0, %g4 cmp %o4, %o2 @@ -50,7 +53,7 @@ ENTRY(bcopy) add %o0, %o2, %o0 retl nop -END(bcopy) +END(__bcopy) /* Special/non-trivial issues of this code: * @@ -67,7 +70,10 @@ END(bcopy) * of up to 2.4GB per second. */ .align 32 -ENTRY(memcpy) +.globl memcpy +.set memcpy,__memcpy +.hidden __memcpy +ENTRY(__memcpy) 100: /* %o0=dst, %o1=src, %o2=len */ mov %o0, %g5 @@ -328,7 +334,7 @@ small_copy_unaligned: retl mov %g5, %o0 -END(memcpy) +END(__memcpy) #define RMOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3) \ ldx [%src - offset - 0x20], %t0; \ @@ -403,7 +409,10 @@ END(memcpy) mov %g4, %o0 .align 32 -ENTRY(memmove) +.globl memmove +.set memmove,__memmove +.hidden __memmove +ENTRY(__memmove) mov %o0, %g5 #ifndef USE_BPR srl %o2, 0, %o2 /* IEU1 Group */ @@ -595,7 +604,7 @@ ENTRY(memmove) 234: wr %g0, FPRS_FEF, %fprs retl mov %g4, %o0 -END(memmove) +END(__memmove) #ifdef USE_BPR weak_alias (memcpy, __align_cpy_1) diff --git a/libc/string/sparc/sparc64/strcat.S b/libc/string/sparc/sparc64/strcat.S index 21ff119c4..3b81e59e6 100644 --- a/libc/string/sparc/sparc64/strcat.S +++ b/libc/string/sparc/sparc64/strcat.S @@ -47,7 +47,10 @@ .text .align 32 -ENTRY(strcat) +.globl strcat +.set strcat,__strcat +.hidden __strcat +ENTRY(__strcat) sethi %hi(0x01010101), %g1 /* IEU0 Group */ ldub [%o0], %o3 /* Load */ or %g1, %lo(0x01010101), %g1 /* IEU0 Group */ @@ -335,4 +338,4 @@ ENTRY(strcat) stb %o4, [%o0 - 8] /* Store */ retl /* CTI+IEU1 Group */ mov %g6, %o0 /* IEU0 */ -END(strcat) +END(__strcat) diff --git a/libc/string/sparc/sparc64/strchr.S b/libc/string/sparc/sparc64/strchr.S index 784b7fe4d..6943e8b96 100644 --- a/libc/string/sparc/sparc64/strchr.S +++ b/libc/string/sparc/sparc64/strchr.S @@ -47,7 +47,10 @@ .text .align 32 -ENTRY(strchr) +.globl strchr +.set strchr,__strchr +.hidden __strchr +ENTRY(__strchr) andcc %o1, 0xff, %o1 /* IEU1 Group */ be,pn %icc, 17f /* CTI */ sllx %o1, 8, %g3 /* IEU0 Group */ @@ -327,10 +330,13 @@ ENTRY(strchr) lduba [%o0] ASI_PNF, %o3 /* Load */ retl /* CTI+IEU1 Group */ add %o0, -1, %o0 /* IEU0 */ -END(strchr) +END(__strchr) .align 32 -ENTRY(strrchr) +.globl strrchr +.set strrchr,__strrchr +.hidden __strrchr +ENTRY(__strrchr) andcc %o1, 0xff, %o1 /* IEU1 Group */ be,pn %icc, 17b /* CTI */ clr %g4 /* IEU0 */ @@ -474,7 +480,7 @@ ENTRY(strrchr) ba,pt %xcc, 1b /* CTI Group */ ldx [%o0], %o3 /* Load */ -END(strrchr) +END(__strrchr) weak_alias (strchr, index) weak_alias (strrchr, rindex) diff --git a/libc/string/sparc/sparc64/strcmp.S b/libc/string/sparc/sparc64/strcmp.S index 5866778d3..a4eb36632 100644 --- a/libc/string/sparc/sparc64/strcmp.S +++ b/libc/string/sparc/sparc64/strcmp.S @@ -45,7 +45,10 @@ .text .align 32 -ENTRY(strcmp) +.globl strcmp +.set strcmp,__strcmp +.hidden __strcmp +ENTRY(__strcmp) sethi %hi(0x01010101), %g1 /* IEU0 Group */ andcc %o0, 7, %g0 /* IEU1 */ bne,pn %icc, 7f /* CTI */ @@ -275,4 +278,4 @@ ENTRY(strcmp) ba,pt %xcc, 11b /* CTI Group */ ldxa [%o1 + %o0] ASI_PNF, %g6 /* Load */ -END(strcmp) +END(__strcmp) diff --git a/libc/string/sparc/sparc64/strcpy.S b/libc/string/sparc/sparc64/strcpy.S index aa5d2aee3..cc906bae7 100644 --- a/libc/string/sparc/sparc64/strcpy.S +++ b/libc/string/sparc/sparc64/strcpy.S @@ -45,7 +45,10 @@ .text .align 32 -ENTRY(strcpy) +.globl strcpy +.set strcpy,__strcpy +.hidden __strcpy +ENTRY(__strcpy) sethi %hi(0x01010101), %g1 /* IEU0 Group */ mov %o0, %g6 /* IEU1 */ or %g1, %lo(0x01010101), %g1 /* IEU0 Group */ @@ -240,4 +243,4 @@ ENTRY(strcpy) stb %o4, [%o0 - 8] /* Store */ retl /* CTI+IEU1 Group */ mov %g6, %o0 /* IEU0 */ -END(strcpy) +END(__strcpy) diff --git a/libc/string/sparc/sparc64/strlen.S b/libc/string/sparc/sparc64/strlen.S index 5167ad5ba..9f48fe6a1 100644 --- a/libc/string/sparc/sparc64/strlen.S +++ b/libc/string/sparc/sparc64/strlen.S @@ -39,7 +39,10 @@ .text .align 32 -ENTRY(strlen) +.globl strlen +.set strlen,__strlen +.hidden __strlen +ENTRY(__strlen) sethi %hi(0x01010101), %g1 /* IEU0 Group */ ldub [%o0], %o3 /* Load */ or %g1, %lo(0x01010101), %g1 /* IEU0 Group */ @@ -169,4 +172,4 @@ ENTRY(strlen) add %o0, -1, %o0 /* IEU0 Group */ retl /* CTI+IEU1 Group */ sub %o0, %o1, %o0 /* IEU0 */ -END(strlen) +END(__strlen) diff --git a/libc/string/x86_64/Makefile.arch b/libc/string/x86_64/Makefile.arch index 914eab55c..56e5a5165 100644 --- a/libc/string/x86_64/Makefile.arch +++ b/libc/string/x86_64/Makefile.arch @@ -19,7 +19,8 @@ STRING_ARCH_OBJS:=$(STRING_ARCH_OBJ) $(STRING_ARCH_SOBJ) libc-a-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS) libc-so-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_OBJS:.o=.os) -libc-multi-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_SRC) $(STRING_ARCH_SSRC) +libc-multi-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_SRC) +libc-nomulti-$(UCLIBC_HAS_STRING_ARCH_OPT)+=$(STRING_ARCH_SOBJ) objclean-y+=string_x86_64_objclean diff --git a/libc/string/x86_64/memcpy.S b/libc/string/x86_64/memcpy.S index 4fa38a640..c375bf3fb 100644 --- a/libc/string/x86_64/memcpy.S +++ b/libc/string/x86_64/memcpy.S @@ -32,7 +32,10 @@ ENTRY (__memcpy_chk) jb HIDDEN_JUMPTARGET (__chk_fail) END (__memcpy_chk) #endif -ENTRY (BP_SYM (memcpy)) +.global memcpy +.set memcpy,__memcpy +.hidden __memcpy +ENTRY (BP_SYM (__memcpy)) /* Cutoff for the big loop is a size of 32 bytes since otherwise the loop will never be entered. */ cmpq $32, %rdx @@ -92,4 +95,4 @@ ENTRY (BP_SYM (memcpy)) #endif ret -END (BP_SYM (memcpy)) +END (BP_SYM (__memcpy)) diff --git a/libc/string/x86_64/memset.S b/libc/string/x86_64/memset.S index d74ec8ccb..d66195580 100644 --- a/libc/string/x86_64/memset.S +++ b/libc/string/x86_64/memset.S @@ -35,7 +35,10 @@ ENTRY (__memset_chk) jb HIDDEN_JUMPTARGET (__chk_fail) END (__memset_chk) #endif -ENTRY (memset) +.global memset +.set memset,__memset +.hidden __memset +ENTRY (__memset) #if BZERO_P mov %rsi,%rdx /* Adjust parameter. */ xorl %esi,%esi /* Fill with 0s. */ @@ -131,7 +134,7 @@ ENTRY (memset) jne 11b jmp 4b -END (memset) +END (__memset) #if !BZERO_P && defined PIC && !defined NOT_IN_libc strong_alias (__memset_chk, __memset_zero_constant_len_parameter) diff --git a/libc/string/x86_64/strcat.S b/libc/string/x86_64/strcat.S index 1106cb4ed..9ee10b202 100644 --- a/libc/string/x86_64/strcat.S +++ b/libc/string/x86_64/strcat.S @@ -23,7 +23,10 @@ .text -ENTRY (BP_SYM (strcat)) +.global strcat +.set strcat,__strcat +.hidden __strcat +ENTRY (BP_SYM (__strcat)) movq %rdi, %rcx /* Dest. register. */ andl $7, %ecx /* mask alignment bits */ movq %rdi, %rax /* Duplicate destination pointer. */ @@ -253,4 +256,4 @@ ENTRY (BP_SYM (strcat)) 24: movq %rdi, %rax /* Source is return value. */ retq -END (BP_SYM (strcat)) +END (BP_SYM (__strcat)) diff --git a/libc/string/x86_64/strchr.S b/libc/string/x86_64/strchr.S index b84b012b2..04d365a82 100644 --- a/libc/string/x86_64/strchr.S +++ b/libc/string/x86_64/strchr.S @@ -22,7 +22,10 @@ .text -ENTRY (BP_SYM (strchr)) +.globl strchr +.set strchr,__strchr +.hidden __strchr +ENTRY (BP_SYM (__strchr)) /* Before we start with the main loop we process single bytes until the source pointer is aligned. This has two reasons: @@ -282,6 +285,6 @@ ENTRY (BP_SYM (strchr)) 6: nop retq -END (BP_SYM (strchr)) +END (BP_SYM (__strchr)) weak_alias (BP_SYM (strchr), BP_SYM (index)) diff --git a/libc/string/x86_64/strcmp.S b/libc/string/x86_64/strcmp.S index 0b401a773..f933c1156 100644 --- a/libc/string/x86_64/strcmp.S +++ b/libc/string/x86_64/strcmp.S @@ -22,7 +22,10 @@ #include "_glibc_inc.h" .text -ENTRY (BP_SYM (strcmp)) +.global strcmp +.set strcmp,__strcmp +.hidden __strcmp +ENTRY (BP_SYM (__strcmp)) L(oop): movb (%rdi), %al cmpb (%rsi), %al jne L(neq) @@ -38,4 +41,4 @@ L(neq): movl $1, %eax movl $-1, %ecx cmovbl %ecx, %eax ret -END (BP_SYM (strcmp)) +END (BP_SYM (__strcmp)) diff --git a/libc/string/x86_64/strcpy.S b/libc/string/x86_64/strcpy.S index 0847e2b7c..1a64d2745 100644 --- a/libc/string/x86_64/strcpy.S +++ b/libc/string/x86_64/strcpy.S @@ -21,7 +21,10 @@ #include "_glibc_inc.h" #ifndef USE_AS_STPCPY -# define STRCPY strcpy +# define STRCPY __strcpy +.global strcpy +.set strcpy,__strcpy +.hidden __strcpy #endif .text diff --git a/libc/string/x86_64/strcspn.S b/libc/string/x86_64/strcspn.S index e1a22e4f1..e25100bc1 100644 --- a/libc/string/x86_64/strcspn.S +++ b/libc/string/x86_64/strcspn.S @@ -26,10 +26,16 @@ #include "_glibc_inc.h" /* BEWARE: `#ifdef strcspn' means that strcspn is redefined as `strpbrk' */ -#define STRPBRK_P (defined strcspn) +#define STRPBRK_P (defined __strcspn) .text -ENTRY (strcspn) +#if STRPBRK_P +#else +.global strcspn +.set strcspn,__strcspn +.hidden __strcspn +#endif +ENTRY (__strcspn) movq %rdi, %rdx /* Save SRC. */ @@ -120,4 +126,4 @@ L(4): addq $256, %rsp /* remove skipset */ non-valid character */ #endif ret -END (strcspn) +END (__strcspn) diff --git a/libc/string/x86_64/strlen.S b/libc/string/x86_64/strlen.S index 36b63031e..ab25515f8 100644 --- a/libc/string/x86_64/strlen.S +++ b/libc/string/x86_64/strlen.S @@ -22,7 +22,10 @@ .text -ENTRY (strlen) +.global strlen +.set strlen,__strlen +.hidden __strlen +ENTRY (__strlen) movq %rdi, %rcx /* Duplicate source pointer. */ andl $7, %ecx /* mask alignment bits */ movq %rdi, %rax /* duplicate destination. */ @@ -132,4 +135,4 @@ ENTRY (strlen) 2: subq %rdi, %rax /* compute difference to string start */ ret -END (strlen) +END (__strlen) diff --git a/libc/string/x86_64/strpbrk.S b/libc/string/x86_64/strpbrk.S index c49cd2c06..c37befe72 100644 --- a/libc/string/x86_64/strpbrk.S +++ b/libc/string/x86_64/strpbrk.S @@ -1,2 +1,5 @@ -#define strcspn strpbrk +#define __strcspn __strpbrk +.global strpbrk +.set strpbrk,__strpbrk +.hidden __strpbrk #include "strcspn.S" diff --git a/libc/string/x86_64/strspn.S b/libc/string/x86_64/strspn.S index 245d8e699..8d5903c1b 100644 --- a/libc/string/x86_64/strspn.S +++ b/libc/string/x86_64/strspn.S @@ -26,7 +26,10 @@ #include "_glibc_inc.h" .text -ENTRY (strspn) +.global strspn +.set strspn,__strspn +.hidden __strspn +ENTRY (__strspn) movq %rdi, %rdx /* Save SRC. */ @@ -111,4 +114,4 @@ L(4): addq $256, %rsp /* remove stopset */ characters, so compute distance to first non-valid character */ ret -END (strspn) +END (__strspn) |
