proposal to start merging some source files in libbb/

Denis Vlasenko vda at ilport.com.ua
Fri May 19 07:30:19 UTC 2006


On Thursday 18 May 2006 22:39, Paul Fox wrote:
>  > 
>  > you're right, i was thinking only in terms of a busybox that was built
>  > with a shared libbusybox.so (which, i'm pretty sure, *would* contain
>  > all of the compiled routines, right?)
> 
> yes, i believe that's right.  which implies one shouldn't do that
> unless you're really going to share it between two executables.

The fact that linker pulls in ALL functions from a .c file is
a long-standing deficiency in traditional linkers.

It's so old that people think that it is normal linker behaviour.

But gladly, recent GNU gcc and ld added support for improving that.

This is wht I wrote a few months ago:

=====================================

This patch passes -ffunction-sections -fdata-sections to gcc
and --gc-sections to ld. Result:

# size busybox.org.tst/busybox busybox.sections.tst/busybox
   text    data     bss     dec     hex filename
 920143   12268 1047076 1979487  1e345f busybox.org.tst/busybox
 915759   10616 1045572 1971947  1e16eb busybox.sections.tst/busybox

"make sizes" diff:
        ...
        @@ -3445,7 +3371,6 @@
         00000102 t getcell
         00000102 t process_inodes
         00000103 T cp_main
        -00000103 T rtnl_from_file
         00000104 T ar_main
         00000104 T cpio_main
         00000104 T env_main
        @@ -3591,7 +3516,6 @@
         0000015c t subevalvar
         00000160 t fill_package_struct
         00000160 T rtnl_rtntype_a2n
        -00000163 T rtnl_listen
         00000166 t remove_package
         00000167 t check_dep
         00000168 t parse_stream_outer
        @@ -3884,9 +3808,7 @@
         00000400 b root_block
         00000400 d rtnl_rtdsfield_tab
         00000400 d rtnl_rtprot_tab
        -00000400 d rtnl_rtrealm_tab
         00000400 d rtnl_rtscope_tab
        -00000400 d rtnl_rttable_tab
         00000400 b super_block_buffer
         00000400 b super_block_buffer
         00000401 b line.1

Available at http://195.66.192.167/linux/bbox/sections.patch
--
vda



More information about the busybox mailing list