Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jan 2009 18:52:45 -0500
From:      Alexander Kabaev <kabaev@gmail.com>
To:        Dimitry Andric <dimitry@andric.com>
Cc:        freebsd-hackers@freebsd.org, Andrew Brampton <brampton+freebsd-hackers@gmail.com>
Subject:   Re: Kernel Module - GCC Requires memmove
Message-ID:  <20090121185245.00739316@kan.dnsalias.net>
In-Reply-To: <4977B357.2080500@andric.com>
References:  <d41814900901210412h4a1aaec6l6945dd79d07d13be@mail.gmail.com> <4977B357.2080500@andric.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_/7TM59FX/r37fSNZHRWdH19J
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Thu, 22 Jan 2009 00:44:23 +0100
Dimitry Andric <dimitry@andric.com> 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.
>=20
> This can (amongst others) occur if you assign structs, e.g.:
>=20
> int test(void)
> {
> 	struct foo {
> 		char bar[100];
> 	} a, b;
>=20
> 	b =3D a;
> }
>=20
> Compile this with gcc -O0 -S, and you'll see it generates a call to
> memcpy().
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to
> "freebsd-hackers-unsubscribe@freebsd.org"

=46rom 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
`memcmp'.=20
</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 :(

--=20
Alexander Kabaev

--Sig_/7TM59FX/r37fSNZHRWdH19J
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iD8DBQFJd7VNQ6z1jMm+XZYRAk0pAKCZEn45WIWw1uGOJ7vxIrN/gNEA4wCgtlXb
oMe7pMEfENFjjxujEjSUSQw=
=MX+Y
-----END PGP SIGNATURE-----

--Sig_/7TM59FX/r37fSNZHRWdH19J--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090121185245.00739316>