s390/string: provide asm lib functions for memcpy and memcmp
Our memcpy and memcmp variants were implemented by calling the corresponding gcc builtin variants. However gcc is free to replace a call to __builtin_memcmp with a call to memcmp which, when called, will result in an endless recursion within memcmp. So let's provide asm variants and also fix the variants that are used for uncompressing the kernel image. In addition remove all other occurences of builtin function calls. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:

committed by
Martin Schwidefsky

parent
68d9884dbc
commit
535c611ddd
@@ -96,7 +96,6 @@ static inline char *strcat(char *dst, const char *src)
|
||||
|
||||
static inline char *strcpy(char *dst, const char *src)
|
||||
{
|
||||
#if __GNUC__ < 4
|
||||
register int r0 asm("0") = 0;
|
||||
char *ret = dst;
|
||||
|
||||
@@ -106,14 +105,10 @@ static inline char *strcpy(char *dst, const char *src)
|
||||
: "+&a" (dst), "+&a" (src) : "d" (r0)
|
||||
: "cc", "memory");
|
||||
return ret;
|
||||
#else
|
||||
return __builtin_strcpy(dst, src);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline size_t strlen(const char *s)
|
||||
{
|
||||
#if __GNUC__ < 4
|
||||
register unsigned long r0 asm("0") = 0;
|
||||
const char *tmp = s;
|
||||
|
||||
@@ -122,9 +117,6 @@ static inline size_t strlen(const char *s)
|
||||
" jo 0b"
|
||||
: "+d" (r0), "+a" (tmp) : : "cc");
|
||||
return r0 - (unsigned long) s;
|
||||
#else
|
||||
return __builtin_strlen(s);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline size_t strnlen(const char * s, size_t n)
|
||||
|
Reference in New Issue
Block a user