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

Shaun Jackman sjackman at gmail.com
Sat May 27 17:06:03 UTC 2006


On 7/27/05, Rob Landley <rob at landley.net> wrote:
> On Wednesday 27 July 2005 04:28, Erik Andersen wrote:
> > 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
...
> Suggestions?

For whatever reason it didn't occur to me at the time, but using an
enum instead of a const int would've eliminated the binary size hit,
and would have allowed all three use cases:

#ifdef CONFIG_FEATURE_xxx
#if CONFIG_FEATURE_xxx
if (CONFIG_FEATURE_xxx)

* Enabled
#undef CONFIG_FEATURE_xxx
#define CONFIG_FEATURE_xxx 1

* Disabled
#undef CONFIG_FEATURE_xxx
enum { CONFIG_FEATURE_xxx = 0 };

Cheers,
Shaun



More information about the busybox mailing list