[BusyBox] Re: [BusyBox-cvs] svn commit: trunk/busybox: include networking

Rob Landley rob at landley.net
Wed Jul 27 11:19:40 UTC 2005


On Wednesday 27 July 2005 04:28, Erik Andersen wrote:
> On Wed Jul 27, 2005 at 12:55:38AM -0600, landley at busybox.net wrote:
> > This creates a new header file, bb_config.h, which sets the CONFIG entry
> > to 1 or 0, and lets us do:
> >
> >   if(CONFIG_THING) stuff();
> >
> > And let the compiler do dead code elimination to get rid of it.  (Note:
> > #ifdef will still work because for the 1 case it's a static const int,
> > not a #define.)
>
> Using static ints works, but has the downside of adding roughly
> 700 bytes of static ints (for the default config) to the .text
> section of each and every .o file.  These days, busybox has an
> awful lot of .o files, compounding the pain.  With make defconfig
> there are 268 .o files.  With revision 10929 therefore, compared
> to revision 10928, we see an immediate size increase of ~150k:
>
>  $ size busybox.old busybox.static_ints
>     text    data     bss     dec     hex filename
>   244599    2312   36800  283711   4543f busybox.old
>   393172    2312   36800  432284   6989c busybox.static_ints

Yeah, that's obviously unacceptable.  I thought that the "const" in there 
would tell the darn compiler that it could substitute in the constant, but 
apparently not.  And if gcc isn't getting this right I don't want to do 
anything clever that's bound to confuse other compilers.  (Relying on dead 
code elimination for if(constant) is one thing, relying on elimination of 
unused variables is a lot more of a stretch...)

Lemme think about this.  Possibly we could #define a CONF_THING to be 0 or 1 
and leave the CONFIG_THING to be #ifdef or #ifndef.  (That's a little more 
subtle than I'm quite comfortable with, but I could live with it and I can't 
think of a better prefix off the top of my head.  The makefile magic is still 
fairly simple, especially if we have bb_config.h #include config.h...)

Suggestions?

Rob



More information about the busybox mailing list