Ignore:
Timestamp:
Feb 25, 2011, 9:26:54 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi-busybox/docs/keep_data_small.txt

    r1765 r2725  
    6060
    6161One example how to reduce global data usage is in
    62 archival/libunarchive/decompress_unzip.c:
     62archival/libarchive/decompress_unzip.c:
    6363
    6464/* This is somewhat complex-looking arrangement, but it allows
     
    100100ptr_to_globals is declared as constant pointer.
    101101This helps gcc understand that it won't change, resulting in noticeably
    102 smaller code. In order to assign it, use PTR_TO_GLOBALS macro:
    103 
    104     PTR_TO_GLOBALS = xzalloc(sizeof(G));
     102smaller code. In order to assign it, use SET_PTR_TO_GLOBALS macro:
     103
     104    SET_PTR_TO_GLOBALS(xzalloc(sizeof(G)));
    105105
    106106Typically it is done in <applet>_main().
     
    144144one of above methods is not worth the resulting code obfuscation.
    145145If you have less than ~300 bytes of global data - don't bother.
     146
     147
     148        Finding non-shared duplicated strings
     149
     150strings busybox | sort | uniq -c | sort -nr
    146151
    147152
     
    215220 634416    2736   23856  661008   a1610 busybox
    216221 632580    2672   22944  658196   a0b14 busybox_noalign
     222
     223
     224
     225        Keeping code small
     226
     227Set CONFIG_EXTRA_CFLAGS="-fno-inline-functions-called-once",
     228produce "make bloatcheck", see the biggest auto-inlined functions.
     229Now, set CONFIG_EXTRA_CFLAGS back to "", but add NOINLINE
     230to some of these functions. In 1.16.x timeframe, the results were
     231(annotated "make bloatcheck" output):
     232
     233function             old     new   delta
     234expand_vars_to_list    -    1712   +1712 win
     235lzo1x_optimize         -    1429   +1429 win
     236arith_apply            -    1326   +1326 win
     237read_interfaces        -    1163   +1163 loss, leave w/o NOINLINE
     238logdir_open            -    1148   +1148 win
     239check_deps             -    1148   +1148 loss
     240rewrite                -    1039   +1039 win
     241run_pipe             358    1396   +1038 win
     242write_status_file      -    1029   +1029 almost the same, leave w/o NOINLINE
     243dump_identity          -     987    +987 win
     244mainQSort3             -     921    +921 win
     245parse_one_line         -     916    +916 loss
     246summarize              -     897    +897 almost the same
     247do_shm                 -     884    +884 win
     248cpio_o                 -     863    +863 win
     249subCommand             -     841    +841 loss
     250receive                -     834    +834 loss
     251
     252855 bytes saved in total.
     253
     254scripts/mkdiff_obj_bloat may be useful to automate this process: run
     255"scripts/mkdiff_obj_bloat NORMALLY_BUILT_TREE FORCED_NOINLINE_TREE"
     256and select modules which shrank.
Note: See TracChangeset for help on using the changeset viewer.