Avoid using libm in rootfs

Wolfgang Denk wd at denx.de
Fri Mar 30 05:29:32 EST 2007


In message <F1F6EC0C8B75034F9E3A79FC85122E8E71CD4A at aquib01a> you wrote:
> 
> Is it possible to avoid using libm in my roofs? Why a simple application

Yes, this is possible.

> always need it? Is it needed by libc or libstdc++?

Simple applications don't need no libm. Neither  libc  nor  libstdc++
per se require libm.

It is your code and the library functions you call which causes such
dependencies. Note that you have to be aware that even innocent
looking calls like a

	printf ("Hello World\n");

may be the culprits

Example:

-> cat foo.c
#include <unistd.h>

int main (void)
{
        (void)write (1, "Hello World\n", 12);
        return 0;
}
-> export CROSS_COMPILE=ppc_6xx-
-> ppc_6xx-gcc -Wall -pedantic -o foo foo.c
-> ppc_6xx-ldd foo
        libc.so.6 => /opt/eldk/ppc_6xx/lib/libc.so.6
        ld.so.1 => /opt/eldk/ppc_6xx/lib/ld.so.1

You see: no libm needed.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office:  Kirchenstr. 5,       D-82194 Groebenzell,            Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Too much of anything, even love, isn't necessarily a good thing.
	-- Kirk, "The Trouble with Tribbles", stardate 4525.6



More information about the Linuxppc-embedded mailing list