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

From: Richard Henderson (rth@cygnus.com)
Date: Fri Jun 16 2000 - 20:36:27 EST


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.

#define __KERNEL__
#define EXPORT_SYMTAB

#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);

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~

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



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