This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Statically linked binary way way too big


On Wed, Oct 16, 2002 at 10:25:08AM -0200, Denis Vlasenko wrote:
> On 16 October 2002 05:24, Kaz Kylheku wrote:
> > > > > int main() {
> > > > >         return 0;
> > > > > }
> > > > >
> > > > > Based on release announcements ("we don't want
> > > > > to hear about size") and discussions with Linus
> > > > > seen in archive I know that glibc does not try
> > > > > to minimize library size, but nearly half a megabyte
> > > > > can never be right.
> > > >
> > > > Why do you say this? How do you determine which size would be
> > > > right, and which would not?
> > >
> > > Say that again? It's ok for this program to occupy 400k?
> >
> > Based on the relative frequency of static versus dynamic linking,
> > I'd say that it's irrelevant how big or small a static binary is.
> 
> I don't ask is it relevant or not. I'm asking *why* is it so big?

The time you bring in *printf/*scanf you bring the whole
libio/locale/iconv/mpn stuff.
In the empty main program, this is brought in through init_code -> malloc
where malloc.c (malloc_stats) calls fprintf.
Another big chunk comes from libc-start.c -> _dl_aux_init -> _dl_init_paths
which brings in the whole static dlopen support (well, iconv uses dlopen
too, so already getting *printf in would suck that in too.
locale stuff brings in sysconf which brings in timezone handling.
Etc.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]