[uClibc]Re: sudden data bloat

Manuel Novoa III mjn3 at codepoet.org
Fri Mar 22 15:23:45 UTC 2002


Miles and Erik,

On Fri, Mar 22, 2002 at 05:42:18PM +0900, Miles Bader wrote:
> Erik Andersen <andersen at codepoet.org> writes:
> > Are you now building uClibc with DODEBUG enabled?  Otherwise the
> > assert messages should all disappear...
> 
> Yes, but I was using DODEBUG on monday too... :-/
> 
> The reason I'm using DODEBUG is because I want compiler debugging info
> to be generated, which doesn't effect executable size because it's all
> stripped out by elf2flt anyway (but remains in the .elf file that gets
> fed as input to elf2flt, which I can load with gdb).
> 
> I'd rather _not_ enable things like assertions, because the obviously
> do have an effect on executable size.
> 
> I think there should be multiple variables in Options, with one meaning
> strictly `use -g so that object files have debugging info', and the
> other being a more vague `turn on lots of debugging crap even if it
> bloats executables'.

I know one of the things on Erik's list is a better configuration
system.  Until then, adding -DNDEBUG to CFLAGS in the DODEBUG case
in Rules.mak would work.

> > The error messages are getting pulled in by Manuel's new printf
> > code, which now seems to have "%m" enabled by defalt, when then
> > calls strerror(), which pulls in all the error messages.  In the
> > previous printf implementation, support for "%m" was disabled by
> > default...
> 
> I see.  Ah, printf's always such a pain because of things like that...
> 
> I guess the question is how many real-world programs use *printf but
> don't pull in the error strings otherwise...
> 
> > $ size hello_glibc hello.with_m.with_float hello.with_m.no_float hello.no_m.no_float 
> >    text    data     bss     dec     hex filename
> >  359469   10716    3976  374161   5b591 hello_glibc
> 
> Wow.  That's absurd.

When I announced the new stdio, I went into this reasons for the size
increases in printf...  see

http://uclibc.org/lists/uclibc/2002-March/005162.html

but in a nutshell, a little over 3k for the system error messages (%m) and
about 1.8k more (on i386) for the custom printf specifier and positional
arg handling code.  If you want to use the smaller older printf
implementation, see the Makefile in libc/stdio.

Also, in my message there was an example helloworld app (at the end)
with some defines showing how to eliminate most of the size hit from
floating point and %m in printf without modifying the lib.

There are a number of options with the new stdio (build-wise) that
won't be easily accessible until uClibc gets a new build system.
There are others that are planned... options for tuning positional
arg handling, custom printf specifiers, %m, etc... which will be
implemented when wide char and wide string support are implemented
in the next few weeks.

Manuel




More information about the uClibc mailing list