On Sun, Jan 09, 2000 at 08:58:05PM +0000, Philip Blundell wrote:
> >Of course, calling printf makes it big again, but that's no real surprise
> >(and it's still not as big as before).
>
> Yes. That would be a far harder problem to solve - the problem is just that
> the stdio implementation in glibc is based on GNU libio, which is pretty
> large. For space-critical applications you might want to build a library
> containing an alternative stdio (maybe the one from newlib) and link with
> that.
>
> >It seems prudent to call _exit() in exit() and abort() rather than do
> >absolutely nothing, though; this avoids a segfault at shutdown if you
> >actually do any work in main().
>
> Good point.
Hrmm...It might be interesting to note that the following simple program
becomes smaller on a libc5 system with -static and larger on a glibc2.1
system with -static:
---void abort() { _exit(); }; void exit() { _exit(); }; void atexit() { }; void *__libc_stack_end;
int main(){ write(1,"Hello world\n",12); }
---
glibc2.1:
[sroot@oof:/root]# gcc -O1 -o test test.c && ls -l test -rwxr-xr-x 1 root root 4316 Jan 9 20:56 test* [sroot@oof:/root]# gcc -O1 -static -o test test.c && ls -l test -rwxr-xr-x 1 root root 6699 Jan 9 20:56 test*
libc5:
[sroot@foo:/root]# gcc -O1 -o test test.c && ls -l test -rwxr-xr-x 1 root root 4143 Jan 9 20:56 test* [sroot@foo:/root]# gcc -O1 -static -o test test.c && ls -l test -rwxr-xr-x 1 root root 3278 Jan 9 20:56 test*
(GCC 2.7.2.3 on both machines.)
Simon-
[ Stormix Technologies Inc. ][ NetNation Communcations Inc. ] [ sim@stormix.com ][ sim@netnation.com ] [ Opinions expressed are not necessarily those of my employers. ]
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:15 EST