[RFC] Proof-of-concept for netlink listener for mdev -i

Rich Felker dalias at libc.org
Sun Mar 15 00:34:45 UTC 2015


On Sun, Mar 15, 2015 at 01:22:35AM +0100, Laurent Bercot wrote:
> 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.

Yes. That's printf though, not stdio in general. printf and its
dependencies are a good 8k or so. Anyway if that was your intended
meaning then you're right.

Rich


More information about the busybox mailing list