Mailing List Archive

[PATCH] provide out-of-line strcat() for m68k
Content-Length: 788
Lines: 30

Whether we sidestep it in init/main.c or not, such situations
will arise again; compiler does generate calls of strcat()
on optimizations, so we really ought to have an out-of-line
version...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
arch/m68k/lib/string.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/m68k/lib/string.c b/arch/m68k/lib/string.c
index 891e134..4253f87 100644
--- a/arch/m68k/lib/string.c
+++ b/arch/m68k/lib/string.c
@@ -15,6 +15,12 @@ char *strcpy(char *dest, const char *src)
}
EXPORT_SYMBOL(strcpy);

+char *strcat(char *dest, const char *src)
+{
+ return __kernel_strcpy(dest + __kernel_strlen(dest), src);
+}
+EXPORT_SYMBOL(strcat);
+
void *memset(void *s, int c, size_t count)
{
void *xs = s;
--
1.5.3.GIT


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] provide out-of-line strcat() for m68k [ In reply to ]
Hi,

On Wed, 21 May 2008, Al Viro wrote:

> Whether we sidestep it in init/main.c or not, such situations
> will arise again; compiler does generate calls of strcat()
> on optimizations, so we really ought to have an out-of-line
> version...

It actually was strlen that was generated and not strcat.

bye, Roman
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] provide out-of-line strcat() for m68k [ In reply to ]
On Wed, May 21, 2008 at 05:34:58AM +0200, Roman Zippel wrote:
> Hi,
>
> On Wed, 21 May 2008, Al Viro wrote:
>
> > Whether we sidestep it in init/main.c or not, such situations
> > will arise again; compiler does generate calls of strcat()
> > on optimizations, so we really ought to have an out-of-line
> > version...
>
> It actually was strlen that was generated and not strcat.

Here it replaced strncat() with call of strcat() (gcc 4.0.1, FWIW).
And yes, I can show you init/main.s with
jbsr strcat |
in it generated on kernel in b0rken range...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] provide out-of-line strcat() for m68k [ In reply to ]
Hi,

On Wed, 21 May 2008, Al Viro wrote:

> > It actually was strlen that was generated and not strcat.
>
> Here it replaced strncat() with call of strcat() (gcc 4.0.1, FWIW).
> And yes, I can show you init/main.s with
> jbsr strcat |
> in it generated on kernel in b0rken range...

Please use a more recent compiler, 4.0 created too many problems on m68k,
which we only got under control with 4.1, so at least on m68k 4.0 is not
really supported.

bye, Roman
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] provide out-of-line strcat() for m68k [ In reply to ]
On Wed, May 21, 2008 at 12:53:34PM +0200, Roman Zippel wrote:
> Hi,
>
> On Wed, 21 May 2008, Al Viro wrote:
>
> > > It actually was strlen that was generated and not strcat.
> >
> > Here it replaced strncat() with call of strcat() (gcc 4.0.1, FWIW).
> > And yes, I can show you init/main.s with
> > jbsr strcat |
> > in it generated on kernel in b0rken range...
>
> Please use a more recent compiler, 4.0 created too many problems on m68k,
> which we only got under control with 4.1, so at least on m68k 4.0 is not
> really supported.

Then it's worth mentioning in Documentation/Changes, IMO... Anyway,
updating m68k toolchain is not a problem; I'll get around to it tonight.
I still think that out-of-line implementation is a good idea, if nothing
else it would prevent future crap of the same kind if some later version
decides that strlen(a) + strlen(b) can be proven to be less than size
argument of strncat(), etc.

Technically we _are_ in nasal daemon country with redefining str*, unless
we pass -ffreestanding; m68k doesn't, so we can't guarantee that new stuff
of that kind won't crop up. IOW, it might be a good policy to have fallback
implementations of potentially affected primitives...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/