s390/string: Remove strcpy() implementation
authorHeiko Carstens <hca@linux.ibm.com>
Thu, 24 Apr 2025 09:27:11 +0000 (11:27 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Wed, 30 Apr 2025 09:41:28 +0000 (11:41 +0200)
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 <zaslonko@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/string.h
arch/s390/lib/string.c

index d1559963125b3c2eb512602b4286d341727b6c9a..f8f68f4ef255d182185a677442e38a34945d60e8 100644 (file)
@@ -26,7 +26,6 @@ void *memmove(void *dest, const void *src, size_t n);
 #define __HAVE_ARCH_MEMSCAN    /* inline & arch function */
 #define __HAVE_ARCH_STRCAT     /* inline & arch function */
 #define __HAVE_ARCH_STRCMP     /* arch function */
-#define __HAVE_ARCH_STRCPY     /* inline & arch function */
 #define __HAVE_ARCH_STRLCAT    /* arch function */
 #define __HAVE_ARCH_STRLEN     /* inline & arch function */
 #define __HAVE_ARCH_STRNCAT    /* arch function */
@@ -153,22 +152,6 @@ static inline char *strcat(char *dst, const char *src)
 }
 #endif
 
-#ifdef __HAVE_ARCH_STRCPY
-static inline char *strcpy(char *dst, const char *src)
-{
-       char *ret = dst;
-
-       asm volatile(
-               "       lghi    0,0\n"
-               "0:     mvst    %[dst],%[src]\n"
-               "       jo      0b"
-               : [dst] "+&a" (dst), [src] "+&a" (src)
-               :
-               : "cc", "memory", "0");
-       return ret;
-}
-#endif
-
 #if defined(__HAVE_ARCH_STRLEN) || (defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__))
 static inline size_t __no_sanitize_prefix_strfunc(strlen)(const char *s)
 {
@@ -206,7 +189,6 @@ static inline size_t strnlen(const char * s, size_t n)
 void *memchr(const void * s, int c, size_t n);
 void *memscan(void *s, int c, size_t n);
 char *strcat(char *dst, const char *src);
-char *strcpy(char *dst, const char *src);
 size_t strlen(const char *s);
 size_t strnlen(const char * s, size_t n);
 #endif /* !IN_ARCH_STRING_C */
index cc00804c6dacad8c0daa7f449655c39b9da49ab9..099de76e8b1ab3b3b16ba6337cfc6b36ee8f9bca 100644 (file)
@@ -77,30 +77,6 @@ size_t strnlen(const char *s, size_t n)
 EXPORT_SYMBOL(strnlen);
 #endif
 
-/**
- * strcpy - Copy a %NUL terminated string
- * @dest: Where to copy the string to
- * @src: Where to copy the string from
- *
- * returns a pointer to @dest
- */
-#ifdef __HAVE_ARCH_STRCPY
-char *strcpy(char *dest, const char *src)
-{
-       char *ret = dest;
-
-       asm volatile(
-               "       lghi    0,0\n"
-               "0:     mvst    %[dest],%[src]\n"
-               "       jo      0b\n"
-               : [dest] "+&a" (dest), [src] "+&a" (src)
-               :
-               : "cc", "memory", "0");
-       return ret;
-}
-EXPORT_SYMBOL(strcpy);
-#endif
-
 /**
  * strcat - Append one %NUL-terminated string to another
  * @dest: The string to be appended to