Skip to content

Commit de6b4f9

Browse files
committed
s390/string: Remove strcpy() implementation
Remove the optimized strcpy() library implementation. This doesn't make any difference since gcc recognizes all strcpy() usages anyway and uses the builtin variant. There is not a single branch to strcpy() within the generated kernel image, which also seems to be the reason why most other architectures don't have a strcpy() implementation anymore. Reviewed-by: Mikhail Zaslonko <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent ed5eef1 commit de6b4f9

File tree

2 files changed

+0
-42
lines changed

2 files changed

+0
-42
lines changed

arch/s390/include/asm/string.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ void *memmove(void *dest, const void *src, size_t n);
2626
#define __HAVE_ARCH_MEMSCAN /* inline & arch function */
2727
#define __HAVE_ARCH_STRCAT /* inline & arch function */
2828
#define __HAVE_ARCH_STRCMP /* arch function */
29-
#define __HAVE_ARCH_STRCPY /* inline & arch function */
3029
#define __HAVE_ARCH_STRLCAT /* arch function */
3130
#define __HAVE_ARCH_STRLEN /* inline & arch function */
3231
#define __HAVE_ARCH_STRNCAT /* arch function */
@@ -153,22 +152,6 @@ static inline char *strcat(char *dst, const char *src)
153152
}
154153
#endif
155154

156-
#ifdef __HAVE_ARCH_STRCPY
157-
static inline char *strcpy(char *dst, const char *src)
158-
{
159-
char *ret = dst;
160-
161-
asm volatile(
162-
" lghi 0,0\n"
163-
"0: mvst %[dst],%[src]\n"
164-
" jo 0b"
165-
: [dst] "+&a" (dst), [src] "+&a" (src)
166-
:
167-
: "cc", "memory", "0");
168-
return ret;
169-
}
170-
#endif
171-
172155
#if defined(__HAVE_ARCH_STRLEN) || (defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__))
173156
static inline size_t __no_sanitize_prefix_strfunc(strlen)(const char *s)
174157
{
@@ -206,7 +189,6 @@ static inline size_t strnlen(const char * s, size_t n)
206189
void *memchr(const void * s, int c, size_t n);
207190
void *memscan(void *s, int c, size_t n);
208191
char *strcat(char *dst, const char *src);
209-
char *strcpy(char *dst, const char *src);
210192
size_t strlen(const char *s);
211193
size_t strnlen(const char * s, size_t n);
212194
#endif /* !IN_ARCH_STRING_C */

arch/s390/lib/string.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -77,30 +77,6 @@ size_t strnlen(const char *s, size_t n)
7777
EXPORT_SYMBOL(strnlen);
7878
#endif
7979

80-
/**
81-
* strcpy - Copy a %NUL terminated string
82-
* @dest: Where to copy the string to
83-
* @src: Where to copy the string from
84-
*
85-
* returns a pointer to @dest
86-
*/
87-
#ifdef __HAVE_ARCH_STRCPY
88-
char *strcpy(char *dest, const char *src)
89-
{
90-
char *ret = dest;
91-
92-
asm volatile(
93-
" lghi 0,0\n"
94-
"0: mvst %[dest],%[src]\n"
95-
" jo 0b\n"
96-
: [dest] "+&a" (dest), [src] "+&a" (src)
97-
:
98-
: "cc", "memory", "0");
99-
return ret;
100-
}
101-
EXPORT_SYMBOL(strcpy);
102-
#endif
103-
10480
/**
10581
* strcat - Append one %NUL-terminated string to another
10682
* @dest: The string to be appended to

0 commit comments

Comments
 (0)