Commit e00c73ee authored by Michal Marek's avatar Michal Marek Committed by Geert Uytterhoeven

m68k: Remove inline strlen() implementation

GCC can replace a strncat() call with constant second argument into a
strlen + store, which results in a link error:

ERROR: "strlen" [net/ipv4/ip_tunnel.ko] undefined!

The inline function is a simple for loop in C. Other architectures
either use an asm optimized variant, or use the generic function from
lib/string.c.
Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent 01a18d16
...@@ -4,15 +4,6 @@ ...@@ -4,15 +4,6 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/compiler.h> #include <linux/compiler.h>
static inline size_t __kernel_strlen(const char *s)
{
const char *sc;
for (sc = s; *sc++; )
;
return sc - s - 1;
}
static inline char *__kernel_strcpy(char *dest, const char *src) static inline char *__kernel_strcpy(char *dest, const char *src)
{ {
char *xdest = dest; char *xdest = dest;
...@@ -27,11 +18,6 @@ static inline char *__kernel_strcpy(char *dest, const char *src) ...@@ -27,11 +18,6 @@ static inline char *__kernel_strcpy(char *dest, const char *src)
#ifndef __IN_STRING_C #ifndef __IN_STRING_C
#define __HAVE_ARCH_STRLEN
#define strlen(s) (__builtin_constant_p(s) ? \
__builtin_strlen(s) : \
__kernel_strlen(s))
#define __HAVE_ARCH_STRNLEN #define __HAVE_ARCH_STRNLEN
static inline size_t strnlen(const char *s, size_t count) static inline size_t strnlen(const char *s, size_t count)
{ {
......
...@@ -17,6 +17,6 @@ EXPORT_SYMBOL(strcpy); ...@@ -17,6 +17,6 @@ EXPORT_SYMBOL(strcpy);
char *strcat(char *dest, const char *src) char *strcat(char *dest, const char *src)
{ {
return __kernel_strcpy(dest + __kernel_strlen(dest), src); return __kernel_strcpy(dest + strlen(dest), src);
} }
EXPORT_SYMBOL(strcat); EXPORT_SYMBOL(strcat);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment