On 14/03/2015 20:23, Rich Felker wrote:
Could you elaborate on how you measure that? With musl only the parts
of stdio you actually use will be linked, and use of exit does not
result in linking of any additional code, since the startup code has
to call exit(main(...)) anyway. In any case exit and its dependencies
are tiny.
The die(), edie() and dbg() functions/macros in the example use printf
format strings and variable arguments, I assumed they are built around
a function of the printf family.
gcc 4.8.1, musl from 2014-12-23, Linux 3.10, x86_64.
$ cat nostdio.c
#include <unistd.h>
int main (void)
{
write(1, "Hello World!\n", 13) ;
return 0 ;
}
$ gcc -O2 -static -o nostdio nostdio.c && strip nostdio
$ wc -c nostdio
2952 nostdio
$ cat stdio.c
#include <stdio.h>
int main (void)
{
printf("%s!\n", "Hello World") ; /* avoids gcc magic */
return 0 ;
}
$ gcc -O2 -static -o stdio stdio.c && strip stdio
$ wc -c stdio
15224 stdio
That's almost 3 pages.
--
Laurent
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox