Re: Undefined references to 'memcpy' when compiling Linux Kernel

From: Tom Leete (
Date: Sat Jun 17 2000 - 01:13:59 EST

Richard Henderson wrote:
> On Fri, Jun 16, 2000 at 09:09:10PM -0400, Tom Leete wrote:
> > In current i386 memcpy is a macro.
> [...]
> > fails to provide an addressable copy.
> Yawn.

If you fall asleep in the first paragraph and wake in the
last, thats the noise you make.

> #define __KERNEL__
> #include <linux/types.h>
> #include <asm/string.h>
> #include <linux/module.h>
> void *(memcpy)(void *d, const void *s, size_t n)
> {
> return memcpy(d,s,n);
> }
> #undef memcpy
> EXPORT_SYMBOL(memcpy);

That works too, but I bet it will be rejected for a lack of
explicit inlining. If you can get this accepted please adopt
my Athlon-SMP patch.

> Know that gcc 2.96 *does* inline memcpy. But only when it thinks that
> it's a win. If the two pointers are not known to be suitably aligned,
> it takes about 150 bytes of code to coerce them to be aligned. At
> which point you might as well have called an out-of-line function and
> saved yourself the icache space.
> r~

Agreed. Optimizing compilers do this. I'm inclined to go
with it.

If you see memcpy called by name, though, it's the wrong


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:14 EST