diff options
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/include/asm/string.h | 8 | ||||
-rw-r--r-- | arch/s390/lib/string.c | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/arch/s390/include/asm/string.h b/arch/s390/include/asm/string.h index adf079170aa6..cd0241db5a46 100644 --- a/arch/s390/include/asm/string.h +++ b/arch/s390/include/asm/string.h | |||
@@ -100,6 +100,7 @@ static inline char *strcat(char *dst, const char *src) | |||
100 | 100 | ||
101 | static inline char *strcpy(char *dst, const char *src) | 101 | static inline char *strcpy(char *dst, const char *src) |
102 | { | 102 | { |
103 | #if __GNUC__ < 4 | ||
103 | register int r0 asm("0") = 0; | 104 | register int r0 asm("0") = 0; |
104 | char *ret = dst; | 105 | char *ret = dst; |
105 | 106 | ||
@@ -109,10 +110,14 @@ static inline char *strcpy(char *dst, const char *src) | |||
109 | : "+&a" (dst), "+&a" (src) : "d" (r0) | 110 | : "+&a" (dst), "+&a" (src) : "d" (r0) |
110 | : "cc", "memory"); | 111 | : "cc", "memory"); |
111 | return ret; | 112 | return ret; |
113 | #else | ||
114 | return __builtin_strcpy(dst, src); | ||
115 | #endif | ||
112 | } | 116 | } |
113 | 117 | ||
114 | static inline size_t strlen(const char *s) | 118 | static inline size_t strlen(const char *s) |
115 | { | 119 | { |
120 | #if __GNUC__ < 4 | ||
116 | register unsigned long r0 asm("0") = 0; | 121 | register unsigned long r0 asm("0") = 0; |
117 | const char *tmp = s; | 122 | const char *tmp = s; |
118 | 123 | ||
@@ -121,6 +126,9 @@ static inline size_t strlen(const char *s) | |||
121 | " jo 0b" | 126 | " jo 0b" |
122 | : "+d" (r0), "+a" (tmp) : : "cc"); | 127 | : "+d" (r0), "+a" (tmp) : : "cc"); |
123 | return r0 - (unsigned long) s; | 128 | return r0 - (unsigned long) s; |
129 | #else | ||
130 | return __builtin_strlen(s); | ||
131 | #endif | ||
124 | } | 132 | } |
125 | 133 | ||
126 | static inline size_t strnlen(const char * s, size_t n) | 134 | static inline size_t strnlen(const char * s, size_t n) |
diff --git a/arch/s390/lib/string.c b/arch/s390/lib/string.c index ae5cf5d03d41..4143b7c19096 100644 --- a/arch/s390/lib/string.c +++ b/arch/s390/lib/string.c | |||
@@ -44,7 +44,11 @@ static inline char *__strnend(const char *s, size_t n) | |||
44 | */ | 44 | */ |
45 | size_t strlen(const char *s) | 45 | size_t strlen(const char *s) |
46 | { | 46 | { |
47 | #if __GNUC__ < 4 | ||
47 | return __strend(s) - s; | 48 | return __strend(s) - s; |
49 | #else | ||
50 | return __builtin_strlen(s); | ||
51 | #endif | ||
48 | } | 52 | } |
49 | EXPORT_SYMBOL(strlen); | 53 | EXPORT_SYMBOL(strlen); |
50 | 54 | ||
@@ -70,6 +74,7 @@ EXPORT_SYMBOL(strnlen); | |||
70 | */ | 74 | */ |
71 | char *strcpy(char *dest, const char *src) | 75 | char *strcpy(char *dest, const char *src) |
72 | { | 76 | { |
77 | #if __GNUC__ < 4 | ||
73 | register int r0 asm("0") = 0; | 78 | register int r0 asm("0") = 0; |
74 | char *ret = dest; | 79 | char *ret = dest; |
75 | 80 | ||
@@ -78,6 +83,9 @@ char *strcpy(char *dest, const char *src) | |||
78 | : "+&a" (dest), "+&a" (src) : "d" (r0) | 83 | : "+&a" (dest), "+&a" (src) : "d" (r0) |
79 | : "cc", "memory" ); | 84 | : "cc", "memory" ); |
80 | return ret; | 85 | return ret; |
86 | #else | ||
87 | return __builtin_strcpy(dest, src); | ||
88 | #endif | ||
81 | } | 89 | } |
82 | EXPORT_SYMBOL(strcpy); | 90 | EXPORT_SYMBOL(strcpy); |
83 | 91 | ||