[PATCH] RFC: garbage collect unused code/data?

Denis Vlasenko vda at ilport.com.ua
Wed Apr 5 06:54:29 UTC 2006


With gcc -ffunction-sections -fdata-sections
and ld --gc-sections, we can shave off a few kb:

# size busybox.org.t/busybox busybox.sections.t/busybox
   text    data     bss     dec     hex filename
 763887   10800 1196128 1970815  1e127f busybox.org.t/busybox
 761839   10124 1194688 1966651  1e023b busybox.sections.t/busybox

Please comment on the attached patch.

It was said that older toolchain versions have bugs with
these -xxx-sections options. We can add checks for bad
versions of gcc/ld when someone will report breakage.

BTW, most of this unused stuff is coming from networking/libiproute:

@@ -2111,7 +2097,6 @@
 00000043 t free_memory
 00000043 t fuser_file_to_dev_inode
 00000043 T get_integer
-00000043 T get_u32
 00000043 T get_unsigned
 00000043 t pipe_putc
 00000043 t showpipe
@@ -2165,15 +2150,12 @@
 0000004a t static_up6
 0000004b t fileAction
 0000004b t freeconfig
-0000004b T get_u8
 0000004b T init_handle
-0000004b t setConMode
 0000004b t synexpect
 0000004c t add_cmd_block
 0000004c T bb_vperror_msg
 0000004c t daytime_stream
 0000004c t flush_outbuf
-0000004c T get_u16
 0000004c t msg_logger
 0000004c r name_types
 0000004c r sgi_sys_types
@@ -2188,7 +2170,6 @@
 0000004d T data_align
 0000004d t echo_stream
 0000004d t get_previous_history
-0000004d T get_s8
 0000004d t onint
 0000004d T putpwent
 0000004d t text_hole_make
@@ -2220,13 +2201,13 @@
 00000050 t kw_lookup
 00000050 t printlim
 00000050 b regmatch
-00000050 T rtnl_rtprot_n2a
 00000050 T rtnl_rtscope_n2a
 00000050 r speeds
 00000050 T xregcomp
 00000051 t extract_filename
 00000051 T is_directory
 00000051 t new_screen
+00000051 t setConMode
 00000052 t cmdedit_reset_term
 00000052 t onintr
 00000052 t psbs
@@ -2242,7 +2223,6 @@
 00000053 t xconnect_ftpdata
 00000054 b fsplitter
 00000054 t get_ctl_fd
-00000054 T get_s16
 00000054 t getvar_s
 00000054 t popstackmark
 00000054 b rsplitter
@@ -2288,7 +2268,6 @@
 00000058 T mkfifo_main
 00000058 t ncv_symbol_hash
 00000058 t parse_speeds
-00000058 T rta_addattr_l
 00000058 T rtnl_dsfield_n2a
 00000058 t search_backwards
 00000058 t t_lex
@@ -2470,7 +2449,6 @@
 00000071 t add_logical
 00000071 t aexpr
 00000071 T get_header_tar_gz
-00000071 T get_rt_realms
 00000071 t oexpr
 00000071 T stat_main
 00000072 t deleteConn
@@ -2634,7 +2612,6 @@
 00000090 t thenpart
 00000091 t already_loaded
 00000091 t buffer_init
-00000091 t calcsize
 00000091 t setvarsafe
 00000091 t tless_getch
 00000091 T touch_main
@@ -2643,6 +2620,7 @@
 00000093 T __log
 00000093 t obj_gpl_license
 00000093 t read_hex
+00000094 t calcsize
 00000094 T check_header_gzip
 00000094 t DeleteFile
 00000094 T openvt_main
@@ -2740,7 +2718,6 @@
 000000b1 t print_perms
 000000b2 t dodot
 000000b2 t if_readconf
-000000b2 T rtnl_dump_request
 000000b3 t list_types
 000000b3 t unaliascmd
 000000b4 t evalloop
@@ -2785,7 +2762,6 @@
 000000c5 T get_prefix_1
 000000c5 t reread_partition_table
 000000c5 T rtnl_open
-000000c5 T rtnl_rtrealm_a2n
 000000c6 T mknod_main
 000000c7 T bb_xgetularg_bnd_sfx
 000000c7 t builtin_read
@@ -2892,7 +2868,6 @@
 000000fd t xargs_exec
 000000ff t buffer_line
 000000ff b hostname.0
-000000ff b sbuf.1
 00000100 b buf.3
 00000100 b buffer.0
 00000100 b buffer.0
@@ -3296,7 +3271,6 @@
 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 b super_block_buffer
 00000400 b super_block_buffer
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sections.patch
Type: text/x-diff
Size: 1153 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20060405/467e9611/attachment.bin 


More information about the busybox mailing list