Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/common/lib/libc/arch/arm/string fix weak symbols. More work ...
details: https://anonhg.NetBSD.org/src/rev/232b557ec7dc
branches: trunk
changeset: 350593:232b557ec7dc
user: christos <christos%NetBSD.org@localhost>
date: Sat Jan 14 03:00:13 2017 +0000
description:
fix weak symbols. More work needs to be done for memcpy/strlen etc.
diffstat:
common/lib/libc/arch/arm/string/strcpy_arm.S | 4 +++-
common/lib/libc/arch/arm/string/strcpy_thumb.S | 25 +++++++++++++++++--------
common/lib/libc/arch/arm/string/strlcat.S | 3 ++-
3 files changed, 22 insertions(+), 10 deletions(-)
diffs (106 lines):
diff -r 94cd7ae5f882 -r 232b557ec7dc common/lib/libc/arch/arm/string/strcpy_arm.S
--- a/common/lib/libc/arch/arm/string/strcpy_arm.S Sat Jan 14 01:44:13 2017 +0000
+++ b/common/lib/libc/arch/arm/string/strcpy_arm.S Sat Jan 14 03:00:13 2017 +0000
@@ -29,7 +29,7 @@
#include <machine/asm.h>
-RCSID("$NetBSD: strcpy_arm.S,v 1.4 2017/01/13 13:14:54 christos Exp $")
+RCSID("$NetBSD: strcpy_arm.S,v 1.5 2017/01/14 03:00:13 christos Exp $")
#ifdef STRLCPY
#ifdef _LIBC
@@ -37,8 +37,10 @@
#endif
#define FUNCNAME _strlcpy
#elif defined(STRNCPY)
+WEAK_ALIAS(strncpy, _strncpy)
#define FUNCNAME _strncpy
#else
+WEAK_ALIAS(strcpy, _strcpy)
#define FUNCNAME _strcpy
#endif
diff -r 94cd7ae5f882 -r 232b557ec7dc common/lib/libc/arch/arm/string/strcpy_thumb.S
--- a/common/lib/libc/arch/arm/string/strcpy_thumb.S Sat Jan 14 01:44:13 2017 +0000
+++ b/common/lib/libc/arch/arm/string/strcpy_thumb.S Sat Jan 14 03:00:13 2017 +0000
@@ -28,11 +28,20 @@
*/
#include <machine/asm.h>
-RCSID("$NetBSD: strcpy_thumb.S,v 1.2 2017/01/13 13:14:54 christos Exp $")
+RCSID("$NetBSD: strcpy_thumb.S,v 1.3 2017/01/14 03:00:13 christos Exp $")
#ifdef _LIBC
#ifdef STRLCPY
-WEAK_ALIAS(strlcpy, _strlcpy)
+WEAK_ALIAS(strlcpy, _strlcpy)
+#define strlcpy _strlcpy
+#endif
+#ifdef STRNCPY
+WEAK_ALIAS(strncpy, _strncpy)
+#define strncpy _strncpy
+#endif
+#ifdef STRCPY
+WEAK_ALIAS(strcpy, _strcpy)
+#define strcpy _strcpy
#endif
#endif
@@ -43,7 +52,7 @@
#if defined(STRLCPY)
/* LINTSTUB: size_t strlcpy(char *, const char *, size_t) */
-ENTRY(_strlcpy)
+ENTRY(strlcpy)
adds r3, r1, #1 /* save src pointer (+ NUL) */
subs r2, r2, #1 /* make sure there's room for a NUL */
blt 3f /* no room, do the strlen */
@@ -65,10 +74,10 @@
bne 3b /* no, get next byte */
4: subs r0, r1, r3 /* return length of src string */
RET
-END(_strlcpy)
+END(strlcpy)
#elif defined(STRNCPY)
/* LINTSTUB: char * strncpy(char *, const char *, size_t) */
-ENTRY(_strncpy)
+ENTRY(strncpy)
mov ip, r0 /* we want to preserve r0 */
adds r2, r2, r0 /* get end of dst buffer */
subs r1, r1, r0 /* allows to only increment once */
@@ -86,10 +95,10 @@
b 2b /* until dst is filled */
3: mov r0, ip /* return dst pointer */
RET
-END(_strncpy)
+END(strncpy)
#else
/* LINTSTUB: char * strcpy(char *, const char *) */
-ENTRY(_strcpy)
+ENTRY(strcpy)
subs r2, r0, r1 /* we want to preserve r0 */
1: ldrb r3, [r1] /* read a byte */
strb r3, [r2, r1] /* write a byte */
@@ -97,5 +106,5 @@
cmp r3, #0 /* was it a NUL? */
bne 1b /* no, try next byte */
RET /* return dst pointer */
-END(_strcpy)
+END(strcpy)
#endif
diff -r 94cd7ae5f882 -r 232b557ec7dc common/lib/libc/arch/arm/string/strlcat.S
--- a/common/lib/libc/arch/arm/string/strlcat.S Sat Jan 14 01:44:13 2017 +0000
+++ b/common/lib/libc/arch/arm/string/strlcat.S Sat Jan 14 03:00:13 2017 +0000
@@ -1,9 +1,10 @@
-/* $NetBSD: strlcat.S,v 1.3 2017/01/13 13:14:54 christos Exp $ */
+/* $NetBSD: strlcat.S,v 1.4 2017/01/14 03:00:13 christos Exp $ */
#include <machine/asm.h>
#ifdef _LIBC
WEAK_ALIAS(strlcat, _strlcat)
+#define strlcat _strlcat
#endif
#if defined(_STANDALONE) && 0 /* arm version is always smaller */
Home |
Main Index |
Thread Index |
Old Index