Skip to content

Commit

Permalink
m68k: Uninline strchr()
Browse files Browse the repository at this point in the history
Some versions of gcc replace calls to strstr() with single-character
"needle" string parameters by calls to strchr() behind our back.

If strchr() is defined as an inline function, this causes linking errors
like

	ERROR: "strchr" [drivers/target/target_core_mod.ko] undefined!

As m68k is the only architecture that has an inline strchr() and this
inline version is not an optimized asm version, uninline strchr() and use
the standard out-of-line C version in lib/string.c instead.

This also decreases the defconfig/allmodconfig kernel image sizes by a few
hundred bytes.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
  • Loading branch information
Geert Uytterhoeven committed Jan 22, 2011
1 parent 1bae4ce commit f9b0789
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions arch/m68k/include/asm/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,6 @@ static inline char *strncpy(char *dest, const char *src, size_t n)
strcpy(__d + strlen(__d), (s)); \
})

#define __HAVE_ARCH_STRCHR
static inline char *strchr(const char *s, int c)
{
char sc, ch = c;

for (; (sc = *s++) != ch; ) {
if (!sc)
return NULL;
}
return (char *)s - 1;
}

#ifndef CONFIG_COLDFIRE
#define __HAVE_ARCH_STRCMP
static inline int strcmp(const char *cs, const char *ct)
Expand Down

0 comments on commit f9b0789

Please sign in to comment.