glibc
Posted Nov 3, 2005 11:44 UTC (Thu) by
nix (subscriber, #2304)
In reply to:
glibc by chant
Parent article:
All hail the speed demons (O'Reillynet)
Here's the start of what happens with an empty file, simplifying where things start to explode.
A object file like
int main (void) { return 0; }
obviously pulls in nothing. But it gets linked with crtn.o, and then this happens (every object file except for crtn.o herein is in libc.a; things which do not lead to a size explosion omitted for clarity):
crtn.o:
__libc_start_main
libc-start.o:
__cxa_atexit
cxa_atexit.o:
malloc
malloc.o:
fprintf, abort...
[pulls in stdio, which pulls in libio, which pulls in i18n code, &c]
(There are other paths inside malloc() which also pull in stdio code, too).
The situation is basically unchanged since Zack Weinberg posted this post in 1999, except that changes in glibc since then mean that his solution won't quite work (you need to redefine __cxa_atexit()...)
Fixing it is difficult, and since everyone in the glibc team hates wasting time on static linking-related stuff that doesn't affect the common case of dynamically linked programs, it's not likely to happen soon.
(
Log in to post comments)