No need to include namespace.h; no other assembly code does.

This commit is contained in:
christos 2017-01-13 13:14:54 +00:00
parent c0614acad2
commit 7602642e76
4 changed files with 19 additions and 26 deletions

View File

@ -29,21 +29,17 @@
#include <machine/asm.h>
RCSID("$NetBSD: strcpy_arm.S,v 1.3 2013/08/11 04:56:32 matt Exp $")
RCSID("$NetBSD: strcpy_arm.S,v 1.4 2017/01/13 13:14:54 christos Exp $")
#ifdef STRLCPY
#ifdef _LIBC
WEAK_ALIAS(strlcpy, _strlcpy)
#endif
#define FUNCNAME strlcpy
#define FUNCNAME _strlcpy
#elif defined(STRNCPY)
#define FUNCNAME strncpy
#define FUNCNAME _strncpy
#else
#define FUNCNAME strcpy
#endif
#ifdef _LIBC
#include "namespace.h"
#define FUNCNAME _strcpy
#endif
#ifdef __ARMEL__

View File

@ -28,13 +28,12 @@
*/
#include <machine/asm.h>
RCSID("$NetBSD: strcpy_naive.S,v 1.4 2013/08/20 21:37:39 matt Exp $")
RCSID("$NetBSD: strcpy_naive.S,v 1.5 2017/01/13 13:14:54 christos Exp $")
#ifdef _LIBC
#ifdef STRLCPY
WEAK_ALIAS(strlcpy, _strlcpy)
#endif
#include "namespace.h"
#endif
/*
@ -44,7 +43,7 @@ WEAK_ALIAS(strlcpy, _strlcpy)
#if defined(STRLCPY)
/* LINTSTUB: size_t strlcpy(char *, const char *, size_t) */
ENTRY(strlcpy)
ENTRY(_strlcpy)
add ip, 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 */
@ -63,10 +62,10 @@ ENTRY(strlcpy)
bne 3b /* no, get next byte */
4: sub r0, r1, ip /* 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 */
add r2, r2, r0 /* get end of dst buffer */
1: cmp ip, r2 /* are at the end of dst already? */
@ -79,15 +78,15 @@ ENTRY(strncpy)
strblt r3, [ip], #1 /* no, write a NUL */
blt 2b /* until dst is filled */
3: RET /* return dst pointer */
END(strncpy)
END(_strncpy)
#else
/* LINTSTUB: char * strcpy(char *, const char *) */
ENTRY(strcpy)
ENTRY(_strcpy)
mov ip, r0 /* we want to preserve r0 */
1: ldrb r3, [r1], #1 /* read a byte */
strb r3, [ip], #1 /* write a byte */
teq r3, #0 /* was it a NUL? */
bne 1b /* no, try next byte */
RET /* return dst pointer */
END(strcpy)
END(_strcpy)
#endif

View File

@ -28,13 +28,12 @@
*/
#include <machine/asm.h>
RCSID("$NetBSD: strcpy_thumb.S,v 1.1 2013/08/20 21:32:50 matt Exp $")
RCSID("$NetBSD: strcpy_thumb.S,v 1.2 2017/01/13 13:14:54 christos Exp $")
#ifdef _LIBC
#ifdef STRLCPY
WEAK_ALIAS(strlcpy, _strlcpy)
#endif
#include "namespace.h"
#endif
/*
@ -44,7 +43,7 @@ WEAK_ALIAS(strlcpy, _strlcpy)
#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 */
@ -66,10 +65,10 @@ ENTRY(strlcpy)
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 */
@ -87,10 +86,10 @@ ENTRY(strncpy)
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 */
@ -98,5 +97,5 @@ ENTRY(strcpy)
cmp r3, #0 /* was it a NUL? */
bne 1b /* no, try next byte */
RET /* return dst pointer */
END(strcpy)
END(_strcpy)
#endif

View File

@ -1,10 +1,9 @@
/* $NetBSD: strlcat.S,v 1.2 2013/08/20 21:08:54 matt Exp $ */
/* $NetBSD: strlcat.S,v 1.3 2017/01/13 13:14:54 christos Exp $ */
#include <machine/asm.h>
#ifdef _LIBC
WEAK_ALIAS(strlcat, _strlcat)
#include "namespace.h"
#endif
#if defined(_STANDALONE) && 0 /* arm version is always smaller */