[uClibc] Binaries size is too big...

Erik Andersen andersen at codepoet.org
Mon Feb 16 23:00:33 UTC 2004


On Mon Feb 16, 2004 at 07:15:23PM +0100, Simon Posnjak wrote:
> Hi all,
> 
> I am trying to use uClibc on Axis cris system, with static linking and I found 
> that when I compile a simple hello_world example, I get a binary which is 
> even bigger then the glibc binary (uclibc striped: 276K - glibc striped: 
> 259K). Is there any explanation for this? Thank you.

Dunno.  That is certainly not typical.  Perhaps you can
add "-Wl,--print-map" to your gcc command line, i.e.

    gcc -Wall -Os -s -static -Wl,--print-map hello.c -o hello

and check what is being included...  Using 100% stock buildroot
on x86, I get a 5k staticly linked executable.  By disabling
things such as threads, ctor/dtor support, pic, etc it should be
possible to shrink that down a fair bit further.


# cat hello.c 
#include<stdio.h>
#include <stdlib.h>

int main(void)
{
    printf("hello world\n");
    exit(42);
}

# gcc -Wall -Os -s -static hello.c -o hello
# ls -la ./hello
-rwxr-xr-x    1 root     root         5368 Feb 16 15:57 ./hello*
# ./hello
hello world

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the uClibc mailing list