main() static/dynamic

wmglo@dent.med.uni-muenchen.de wmglo@dent.med.uni-muenchen.de
Mon Sep 15 09:26:00 GMT 2003


Hi,

> The big cause of static bloat I am aware of is that malloc brings in all of
> stdio because of being compiling into one file instead of several.  

I have just recently worked on this, and got at least malloc_stats to
compile in a separate file.  It is a rather big (although
straightforward) patch.

However, this is not yet the complete solution, because of the
debugging hooks code, which also uses stdio.  One would have to cut
out functionality, i.e. use

#if SHARED
    s = getenv("MALLOC_CHECK_");
    if(s) {
      if(s[0]) mALLOPt(M_CHECK_ACTION, (int)(s[0] - '0'));
      __malloc_check_init();
    }
#endif

etc., if the static version was to do completely without stdio.  To
state it more clearly, debugging functionality of the shared and
static libc would differ.

Also, Uli's recent patch:
	* malloc/malloc.c (_int_free): Add cheap test for some invalid
	block sizes.
would have to be modified, too.

Personally, I dislike static linking, and am not yet convinced all
this is worth the effort.  Or is it?

Regards,
Wolfram.



More information about the Libc-alpha mailing list