Kernel Module - GCC Requires memmove

Alexander Kabaev kabaev at
Wed Jan 21 16:14:55 PST 2009

On Thu, 22 Jan 2009 00:44:23 +0100
Dimitry Andric <dimitry at> wrote:

> On 2009-01-21 13:12, Andrew Brampton wrote:
> > The .ii file (post-processed source) did NOT mention memmove at all.
> > So I found it very odd that an undefined symbol existed in the
> > object file.  So then I looked in the .s file (asm), and it was
> > clearing making a single call to memmove.
> This can (amongst others) occur if you assign structs, e.g.:
> int test(void)
> {
> 	struct foo {
> 		char bar[100];
> 	} a, b;
> 	b = a;
> }
> Compile this with gcc -O0 -S, and you'll see it generates a call to
> memcpy().
> _______________________________________________
> freebsd-hackers at mailing list
> To unsubscribe, send any mail to
> "freebsd-hackers-unsubscribe at"

From GCC's info pages:

Most of the compiler support routines used by GCC are present in
`libgcc', but there are a few exceptions.  GCC requires the
freestanding environment provide `memcpy', `memmove', `memset' and
</end quote>

We do not provide all necessary functions in kernel and mostly depend
on luck for the kernel to link. Your luck apparently ran out :(

Alexander Kabaev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-hackers mailing list