* [PATCH/RFC] m68k: Uninline strchr()
@ 2011-01-09 18:42 Geert Uytterhoeven
2011-01-09 20:52 ` Nicholas A. Bellinger
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2011-01-09 18:42 UTC (permalink / raw)
To: Linux/m68k, Linux Kernel Development
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>
diff --git a/arch/m68k/include/asm/string.h b/arch/m68k/include/asm/string.h
index 2936dda..65b1312 100644
--- a/arch/m68k/include/asm/string.h
+++ b/arch/m68k/include/asm/string.h
@@ -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)
--
1.7.0.4
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH/RFC] m68k: Uninline strchr()
2011-01-09 18:42 [PATCH/RFC] m68k: Uninline strchr() Geert Uytterhoeven
@ 2011-01-09 20:52 ` Nicholas A. Bellinger
0 siblings, 0 replies; 2+ messages in thread
From: Nicholas A. Bellinger @ 2011-01-09 20:52 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Linux/m68k, Linux Kernel Development, linux-scsi
On Sun, 2011-01-09 at 19:42 +0100, Geert Uytterhoeven wrote:
> 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>
Hi Geert,
Thanks for taking the time to fix this up in m68k code. As m68k is one
of the last architectures that target code has yet to run on, I am
excited to see this finally happen. ;)
Best Regards,
Reviewed-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
>
> diff --git a/arch/m68k/include/asm/string.h b/arch/m68k/include/asm/string.h
> index 2936dda..65b1312 100644
> --- a/arch/m68k/include/asm/string.h
> +++ b/arch/m68k/include/asm/string.h
> @@ -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)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-09 20:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-09 18:42 [PATCH/RFC] m68k: Uninline strchr() Geert Uytterhoeven
2011-01-09 20:52 ` Nicholas A. Bellinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®