This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See crosstool-NG for lots more information.


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

uClibc vs. eglibc size on ARM


Hi,

a bit off-topic but maybe usefule:

I tried to build a minimal eglibc to see if it would
shrink the size of a statically linked, empty main() compared
to regular glibc or full eglibc:  No, it doesn't.


The minimal eglibc config for eglibc-1.16 (libm needed by gcc,
the other options to un-break eglibc build):

OPTION_EGLIBC_INET = y
OPTION_EGLIBC_LIBM = y
OPTION_EGLIBC_NSSWITCH = y
OPTION_EGLIBC_RTLD_DEBUG = y
OPTION_POSIX_C_LANG_WIDE_CHAR = y
OPTION_POSIX_WIDE_CHAR_DEVICE_IO = y

$ cat t2.c
int main(int argc, char *argv[])
{
        return 0;
}

$ arm-linux-gcc -Wall -Os -o t2 t2.c -static
$ arm-linux-size t2
   text    data     bss     dec     hex filename
 367113    3144    5052  375309   5ba0d t2

arm-unknown-linux-gnueabi/sysroot/lib$ arm-linux-size *.so
   text    data     bss     dec     hex filename
 116063    2864     224  119151   1d16f ld-2.16.so
   6070     380       8    6458    193a libSegFault.so
 788206    8472    8292  804970   c486a libc-2.16.so
   5782     412      48    6242    1862 libdl-2.16.so
arm-linux-size: libgcc_s.so: File format not recognized
 145987     404       8  146399   23bdf libm-2.16.so
   3283     356     112    3751     ea7 libnss_db-2.16.so
  13509     440       4   13953    3681 libnss_dns-2.16.so
  35776     744     488   37008    9090 libnss_files-2.16.so
  11144     452       4   11600    2d50 libnss_hesiod-2.16.so
   1984     324      12    2320     910 libpcprofile.so
  77054     912    8328   86294   15116 libpthread-2.16.so
  63790    1732    9788   75310   1262e libresolv-2.16.so
  22198     656     180   23034    59fa librt-2.16.so
   3806     384       8    4198    1066 libssp.so
 620042   18172   27180  665394   a2732 libstdc++.so
  20259     600      16   20875    518b libthread_db-1.0.so


Full eglibc (all config options enabled):


rm-linux-size t2
   text    data     bss     dec     hex filename
 448861    3156    5264  457281   6fa41 t2

arm-unknown-linux-gnueabi/lib$ arm-linux-size *.so
   text    data     bss     dec     hex filename
 116063    2864     224  119151   1d16f ld-2.16.so
   1034     308       4    1346     542 libBrokenLocale-2.16.so
   6352     388       8    6748    1a5c libSegFault.so
   6454     444      88    6986    1b4a libanl-2.16.so
1096105   10124   10120 1116349  1108bd libc-2.16.so
  27005     396  159956  187357   2dbdd libcrypt-2.16.so
   5782     412      48    6242    1862 libdl-2.16.so
arm-linux-size: libgcc_s.so: File format not recognized
 414989     396       8  415393   656a1 libm-2.16.so
  13808     420 1589500 1603728  187890 libmemusage.so
  61646     780    9460   71886   118ce libnsl-2.16.so
  22753     692     200   23645    5c5d libnss_compat-2.16.so
   3283     356     112    3751     ea7 libnss_db-2.16.so
  13509     440       4   13953    3681 libnss_dns-2.16.so
  38605     760     532   39897    9bd9 libnss_files-2.16.so
  11144     452       4   11600    2d50 libnss_hesiod-2.16.so
  33295     536     360   34191    858f libnss_nis-2.16.so
  40137     516     520   41173    a0d5 libnss_nisplus-2.16.so
   1984     324      12    2320     910 libpcprofile.so
  77054     912    8328   86294   15116 libpthread-2.16.so
  63790    1732    9788   75310   1262e libresolv-2.16.so
  22198     656     180   23034    59fa librt-2.16.so
   3806     384       8    4198    1066 libssp.so
 620042   18172   27180  665394   a2732 libstdc++.so
  20259     600      16   20875    518b libthread_db-1.0.so
   4773     432       4    5209    1459 libutil-2.16.so


For comparison, uClibc:

$ arm-linux-size t2
   text    data     bss     dec     hex filename
  92216     464   21912  114592   1bfa0 t2

arm-unknown-linux-uclibcgnueabi/sysroot/lib$ arm-linux-size *.so
   text    data     bss     dec     hex filename
  43386    1400     256   45042    aff2 ld-uClibc-0.9.33.2.so
   9753     232   70248   80233   13969 libcrypt-0.9.33.2.so
  11991     436       4   12431    308f libdl-0.9.33.2.so
arm-linux-size: libgcc_s.so: File format not recognized
  42438     264       4   42706    a6d2 libm-0.9.33.2.so
    553     204       0     757     2f5 libnsl-0.9.33.2.so
  81372     880    8392   90644   16214 libpthread-0.9.33.2.so
    556     204       0     760     2f8 libresolv-0.9.33.2.so
   9492     368      72    9932    26cc librt-0.9.33.2.so
   3853     376      32    4261    10a5 libssp.so
 608952   18112   27172  654236   9fb9c libstdc++.so
  19407     500      12   19919    4dcf libthread_db-0.9.33.2.so
 413081    1956   31048  446085   6ce85 libuClibc-0.9.33.2.so
   3152     304       0    3456     d80 libutil-0.9.33.2.so

And an older uClibc toolchain:

$ arm-linux-size t2
   text    data     bss     dec     hex filename
   9300     104      72    9476    2504 t2

$ arm-linux-size *.so
   text    data     bss     dec     hex filename
  17161     256      88   17505    4461 ld-uClibc-0.9.29.so
   8855     196   70864   79915   1382b libcrypt-0.9.29.so
 229784   32312    1488  263584   405a0 libcurses.so
   5564     360       0    5924    1724 libdl-0.9.29.so
  39738    1748       8   41494    a216 libform.so
  66699     284       4   66987   105ab libm-0.9.29.so
  20368     696       4   21068    524c libmenu.so
 229784   32312    1488  263584   405a0 libncurses.so
    459     132       0     591     24f libnsl-0.9.29.so
   6468     288       4    6760    1a68 libpanel.so
  42082   18432    8640   69154   10e22 libpthread-0.9.29.so
    462     132       0     594     252 libresolv-0.9.29.so
   2213     180       0    2393     959 librt-0.9.29.so
   9223     304      12    9539    2543 libthread_db-0.9.29.so
 579542    3020   20616  603178   9342a libuClibc-0.9.29.so
   2938     260       0    3198     c7e libutil-0.9.29.so
 715729   17848   22992  756569   b8b59 libstdc++.so


It seems uClibc-0.9.33 has regressed quite a bit wrt static link size :-(
It might be that this is due to UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT,
as crt1.S calls abort() and this seems to pull in all of stdio...
Will need to check my uClibc config.


Johannes

--
For unsubscribe information see http://sourceware.org/lists.html#faq


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