[PATCH] misc size-shrinkage; merges

Bernhard Fischer rep.nop at aon.at
Sun Aug 20 12:31:19 UTC 2006


On Fri, Aug 18, 2006 at 11:49:01PM -0400, Rob Landley wrote:
>On Friday 18 August 2006 11:53 am, Bernhard Fischer wrote:
>> Hello,
>> 
>> Just a heads up..
>> I plan to push the below patchset (split-up, of course) into my
>
>Yes please.  (Reviewing 4000 lines at once ain't fun.)
>
>> 'busybox_scratch' branch soonish, then merge that branch back into
>> trunk.

[snip if anything else then i-want-git]

>> The majority of the patch -- i.e. the libunarchival changes -- were
>> provoked by a bug introduced by Rob when he added a function to xfuncs.c
>> into an improper place and i managed to miss this simple fact early
>> enough. Still these changes are ok to have, so i will not back them out.
>
>What did I break?  (Any details on which function, and which bug?  With the 

xcalloc when dmalloc is configured.

>> The rest (about 20 or 30 k) are simplifications of some coreutils
>> applets and the ipc* applets, as can be seen in the diffstat below.
>
>Woot.
>
>> The current branch contains additional changes that saved (IIRC) a few
>> hundred bytes, refer to svn for details.
>
>Always a plus.

I looked and it was s/few/several/

I'm done with applying that biggish patch onto my branch, so i'll look
into merging all these changes back into trunk now..

Attached is the history so far (scratch.log.r15463__to__r15850.txt).
It should boild down to a more than 2k saving with several fixes.

cheerio,
Bernhard
-------------- next part --------------
------------------------------------------------------------------------
r15463 | aldot | 2006-06-21 20:28:58 +0200 (Wed, 21 Jun 2006) | 3 lines

- create a scratch branch to hold temporary stuff which is too intrusive for
  the currently frozen trunk. This branch is intended to hold experimental stuff

------------------------------------------------------------------------
r15464 | aldot | 2006-06-21 20:43:53 +0200 (Wed, 21 Jun 2006) | 10 lines

- shrink lash a bit
function                                             old     new   delta
builtin_help                                         190     176     -14
builtin_source                                       229     199     -30
lash_main                                            604     513     -91
busy_loop                                           3846    3726    -120
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-255)           Total: -255 bytes


------------------------------------------------------------------------
r15465 | aldot | 2006-06-21 20:48:06 +0200 (Wed, 21 Jun 2006) | 3 lines

- use CONFIG_BUSYBOX_EXEC_PATH as before it one was broken by a recent revert.
- use xchdir() since all is invain if it fails there anyways, supposedly

------------------------------------------------------------------------
r15466 | aldot | 2006-06-21 20:55:16 +0200 (Wed, 21 Jun 2006) | 2 lines

- adjust docs to take CONFIG_BUSYBOX_EXEC_PATH into account.

------------------------------------------------------------------------
r15467 | aldot | 2006-06-21 21:31:24 +0200 (Wed, 21 Jun 2006) | 18 lines

- partial fallout of my TREE_USED touchup against gcc-4.2: rip unused vars, saves 144 bytes
   text	   data	    bss	    dec	    hex	filename
 862434	  10156	 645924	1518514	 172bb2	busybox.old
 862322	  10156	 645892	1518370	 172b22	busybox
function                                             old     new   delta
z_len                                                  4       -      -4
textend                                                4       -      -4
part_nb                                                4       -      -4
insize                                                 4       -      -4
ifile_size                                             4       -      -4
do_link                                                4       -      -4
new_text                                              70      60     -10
ipaddr_list_link                                      33      23     -10
gzip_main                                            898     822     -76
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 0/3 up/down: 0/-120)           Total: -120 bytes


------------------------------------------------------------------------
r15468 | aldot | 2006-06-21 21:43:05 +0200 (Wed, 21 Jun 2006) | 19 lines

- remove useless global exports
function                                             old     new   delta
rpm_main                                             940    1601    +661
rpm_getstring                                        107     112      +5
rpm_getint                                           148     153      +5
loop_through_files                                   103     106      +3
fileaction_dobackup                                  115     113      -2
fileaction_list                                        5       -      -5
rpm_getcount                                          42       -     -42
extract_cpio_gz                                      161       -    -161
rpm_gettags                                          504       -    -504
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/1 up/down: 674/-714)          Total: -40 bytes

   text	   data	    bss	    dec	    hex	filename
 862322	  10156	 645892	1518370	 172b22	busybox.old
 862290	  10156	 645892	1518338	 172b02	busybox


------------------------------------------------------------------------
r15555 | aldot | 2006-06-30 14:10:11 +0200 (Fri, 30 Jun 2006) | 22 lines

- shrink syslog a little bit, move a big buffer (for 'line') off the bss, fold semaphore stuff into single caller manually.
  stats:
function                                             old     new   delta
logMessage                                           395     427     +32
message                                             1245    1257     +12
opts                                                   -       4      +4
small                                                  1       -      -1
local_logging                                          4       -      -4
doRemoteLog                                            4       -      -4
circular_logging                                       4       -      -4
syslogd_main                                        1299    1285     -14
static.res                                            36      16     -20
.rodata                                           186650  186586     -64
static.line                                         1025       -   -1025
------------------------------------------------------------------------------
(add/remove: 1/5 grow/shrink: 2/3 up/down: 48/-1136)        Total: -1088 bytes
cow at s37:~/src/busybox_scratch$ size sysklogd/syslogd.o{.orig,}
   text    data     bss     dec     hex filename
   3723     348    5242    9313    2461 sysklogd/syslogd.o.orig
   3697     348    4188    8233    2029 sysklogd/syslogd.o


------------------------------------------------------------------------
r15565 | aldot | 2006-07-01 12:41:47 +0200 (Sat, 01 Jul 2006) | 2 lines

- merge from trunk. Pull parts of 15464:15564 that made sense.

------------------------------------------------------------------------
r15566 | aldot | 2006-07-01 12:57:57 +0200 (Sat, 01 Jul 2006) | 7 lines

2006-06-30  Shaun Jackman  <sjackman at gmail.com>

	* shell/lash.c (pseudo_exec): Revert svn r15378.
	(run_command): Allow setting an environment
	variable without an explicit `export'.


------------------------------------------------------------------------
r15574 | aldot | 2006-07-01 17:48:34 +0200 (Sat, 01 Jul 2006) | 4 lines

- add config option CONFIG_FEATURE_TASKSET_FANCY
    498	      0	      0	    498	    1f2	miscutils/taskset.o.non-fancy
    635	      0	      0	    635	    27b	miscutils/taskset.o.fancy

------------------------------------------------------------------------
r15576 | aldot | 2006-07-01 20:58:40 +0200 (Sat, 01 Jul 2006) | 2 lines

- remove unused function.

------------------------------------------------------------------------
r15578 | aldot | 2006-07-02 17:07:32 +0200 (Sun, 02 Jul 2006) | 6 lines

- fix bug where it would behave wrong if ./nohup.out was not writable.
- debloat and make it readable while at it.
   text	   data	    bss	    dec	    hex	filename
    320	      0	      0	    320	    140	coreutils/nohup.o.oorig
    304	      0	      0	    304	    130	coreutils/nohup.o

------------------------------------------------------------------------
r15579 | aldot | 2006-07-02 20:27:23 +0200 (Sun, 02 Jul 2006) | 9 lines

- improve readability and reduce the size a tiny bit.
   text	   data	    bss	    dec	    hex	filename
   1045	      0	      0	   1045	    415	coreutils/od.o.gcc-3.4.orig
   1040	      0	      0	   1040	    410	coreutils/od.o.gcc-3.4
   1020	      0	      0	   1020	    3fc	coreutils/od.o.gcc-4.0.orig
   1018	      0	      0	   1018	    3fa	coreutils/od.o.gcc-4.0
   1009	      0	      0	   1009	    3f1	coreutils/od.o.gcc-4.1.orig
   1008	      0	      0	   1008	    3f0	coreutils/od.o.gcc-4.1

------------------------------------------------------------------------
r15586 | aldot | 2006-07-03 14:59:00 +0200 (Mon, 03 Jul 2006) | 3 lines

- add dir_flags; e.g. e2fsprogs_CFLAGS=-fblah is passed to all files there.
- remove indirection from pretty-printing make-output; show actual compile commands.

------------------------------------------------------------------------
r15588 | aldot | 2006-07-03 20:29:24 +0200 (Mon, 03 Jul 2006) | 5 lines

- shrink printf a bit; Could need some more love..
   text	   data	    bss	    dec	    hex	filename
   1225	      0	      0	   1225	    4c9	coreutils/printf.o.orig
   1189	      0	      0	   1189	    4a5	coreutils/printf.o

------------------------------------------------------------------------
r15589 | aldot | 2006-07-03 20:51:49 +0200 (Mon, 03 Jul 2006) | 5 lines

- don't pull in optind since we already know about args via flags.
   text	   data	    bss	    dec	    hex	filename
    144	      0	      0	    144	     90	coreutils/rmdir.o.oorig
    139	      0	      0	    139	     8b	coreutils/rmdir.o

------------------------------------------------------------------------
r15593 | aldot | 2006-07-04 10:24:42 +0200 (Tue, 04 Jul 2006) | 2 lines

- Rename to CROSS_COMPILE and move its configuration to .config.mak. (Shaun Jackman)

------------------------------------------------------------------------
r15596 | aldot | 2006-07-04 13:06:01 +0200 (Tue, 04 Jul 2006) | 5 lines

- rewrite dmesg so it doesn't segfault left and right and is smaller too.
   text    data     bss     dec     hex filename
    207       0       0     207      cf util-linux/dmesg.o.orig
    203       0       0     203      cb util-linux/dmesg.o

------------------------------------------------------------------------
r15600 | aldot | 2006-07-04 16:56:20 +0200 (Tue, 04 Jul 2006) | 2 lines

- fix typo

------------------------------------------------------------------------
r15827 | aldot | 2006-08-20 12:38:28 +0200 (Sun, 20 Aug 2006) | 2 lines

- cleanup includes and use shorter boilerplate. No objcode changes.

------------------------------------------------------------------------
r15828 | aldot | 2006-08-20 12:40:48 +0200 (Sun, 20 Aug 2006) | 2 lines

- simplify ver_disp_*. They really just have to be empty.

------------------------------------------------------------------------
r15829 | aldot | 2006-08-20 12:42:20 +0200 (Sun, 20 Aug 2006) | 3 lines

- for legacy compiles (i.e. non-IMA), make sure that APPLET_SRC is empty.
  Otherwise we did pass applets/*.c in twice.

------------------------------------------------------------------------
r15830 | aldot | 2006-08-20 12:42:56 +0200 (Sun, 20 Aug 2006) | 2 lines

- add typo "acomadate"

------------------------------------------------------------------------
r15831 | aldot | 2006-08-20 12:44:02 +0200 (Sun, 20 Aug 2006) | 2 lines

- dmalloc.h needs to be last!

------------------------------------------------------------------------
r15832 | aldot | 2006-08-20 12:44:35 +0200 (Sun, 20 Aug 2006) | 2 lines

- remove duplicate includes

------------------------------------------------------------------------
r15833 | aldot | 2006-08-20 12:46:04 +0200 (Sun, 20 Aug 2006) | 2 lines

- xzalloc was incorrectly placed in #ifndef DMALLOC which led to compile-failures

------------------------------------------------------------------------
r15834 | aldot | 2006-08-20 12:51:49 +0200 (Sun, 20 Aug 2006) | 6 lines

- shrink cksum a bit: use bb_common_bufsiz1
   text	   data	    bss	    dec	    hex	filename
    288	      0	      0	    288	    120	coreutils/cksum.o.orig
    273	      0	      0	    273	    111	coreutils/cksum.o


------------------------------------------------------------------------
r15835 | aldot | 2006-08-20 12:54:31 +0200 (Sun, 20 Aug 2006) | 6 lines

- shrink cmp a little bit: It's smaller to use bitsmasks than the enum
   text	   data	    bss	    dec	    hex	filename
    493	      0	      0	    493	    1ed	coreutils/cmp.o.orig
    486	      0	      0	    486	    1e6	coreutils/cmp.o


------------------------------------------------------------------------
r15836 | aldot | 2006-08-20 13:14:15 +0200 (Sun, 20 Aug 2006) | 7 lines

- shrink and cleanup dd: merge ints "sync_flag", "noerror", "trunc_flag", "twobufs_flag"
  into one int flags.
   text	   data	    bss	    dec	    hex	filename
   2159	      0	     16	   2175	    87f	coreutils/dd.o.orig
   2123	      0	     16	   2139	    85b	coreutils/dd.o.01b


------------------------------------------------------------------------
r15837 | aldot | 2006-08-20 13:17:22 +0200 (Sun, 20 Aug 2006) | 7 lines

- shrink and cleanup dd: Help optimizers by using explicit gotos for
  outfile errors.
   text	   data	    bss	    dec	    hex	filename
   2123	      0	     16	   2139	    85b	coreutils/dd.o.01b
   1793	      0	     16	   1809	    711	coreutils/dd.o.01c


------------------------------------------------------------------------
r15838 | aldot | 2006-08-20 13:20:06 +0200 (Sun, 20 Aug 2006) | 2 lines

- cleanup dd: make some warnings go away. No objcode changes.

------------------------------------------------------------------------
r15839 | aldot | 2006-08-20 13:21:32 +0200 (Sun, 20 Aug 2006) | 2 lines

- remove redundant headers.

------------------------------------------------------------------------
r15840 | aldot | 2006-08-20 13:23:18 +0200 (Sun, 20 Aug 2006) | 2 lines

- cleanup includes and use shorter boilerplate

------------------------------------------------------------------------
r15841 | aldot | 2006-08-20 13:27:08 +0200 (Sun, 20 Aug 2006) | 7 lines

- shrink sum: For me, inc is smaller than an assign; cleanups

   text	   data	    bss	    dec	    hex	filename
    750	      0	      4	    754	    2f2	coreutils/sum.o.oorig
    746	      0	      4	    750	    2ee	coreutils/sum.o


------------------------------------------------------------------------
r15842 | aldot | 2006-08-20 13:33:09 +0200 (Sun, 20 Aug 2006) | 3 lines

- make the use of dprintf optional
  (I admit that I *think* that this gave me some kind of error, somewhere, but I don't remember the details, unfortunately. Whatever)

------------------------------------------------------------------------
r15843 | aldot | 2006-08-20 13:37:04 +0200 (Sun, 20 Aug 2006) | 6 lines

- shrink watch and add optional cleanup code: 
   text	   data	    bss	    dec	    hex	filename
    301	      0	      0	    301	    12d	coreutils/watch.o.orig
    293	      0	      0	    293	    125	coreutils/watch.o


------------------------------------------------------------------------
r15844 | aldot | 2006-08-20 13:42:44 +0200 (Sun, 20 Aug 2006) | 6 lines

- shrink and cleanup expr: expand switch statements manually.
   text	   data	    bss	    dec	    hex	filename
   2614	      0	      4	   2618	    a3a	coreutils/expr.o.orig
   2602	      0	      4	   2606	    a2e	coreutils/expr.o


------------------------------------------------------------------------
r15845 | aldot | 2006-08-20 13:57:47 +0200 (Sun, 20 Aug 2006) | 22 lines

- debloat cut by alot. Too lazy to list the individual steps in the RCS..
  The individual attempts looked like this:
   text	   data	    bss	    dec	    hex	filename
   1766	      5	     17	   1788	    6fc	coreutils/cut.o.oorig
   1704	      1	     13	   1718	    6b6	coreutils/cut.o.01a
   1697	      1	     13	   1711	    6af	coreutils/cut.o.01b
   1690	      1	     13	   1704	    6a8	coreutils/cut.o.01c
   1700	      1	     13	   1714	    6b2	coreutils/cut.o.01d
   1698	      1	     13	   1712	    6b0	coreutils/cut.o.01e
   1673	      1	     12	   1686	    696	coreutils/cut.o.01f
   1658	      1	     12	   1671	    687	coreutils/cut.o.01g
   1658	      1	     12	   1671	    687	coreutils/cut.o.01h
   1643	      1	     12	   1656	    678	coreutils/cut.o.01i
   1613	      1	     12	   1626	    65a	coreutils/cut.o.01j
   1604	      1	     12	   1617	    651	coreutils/cut.o.01k
   1604	      1	     12	   1617	    651	coreutils/cut.o.01l
   1582	      1	     12	   1595	    63b	coreutils/cut.o.01m
   1564	      1	     12	   1577	    629	coreutils/cut.o.01n
   1561	      1	     12	   1574	    626	coreutils/cut.o.01o
   1529	      1	     12	   1542	    606	coreutils/cut.o.01p


------------------------------------------------------------------------
r15846 | aldot | 2006-08-20 14:06:41 +0200 (Sun, 20 Aug 2006) | 6 lines

- fix, cleanup and shrink date. -I was completely broken, use bitmasks for flags, introduce maybe_set_utc to cut size down, redo output handling to reduce size
   text	   data	    bss	    dec	    hex	filename
   1783	      0	      0	   1783	    6f7	coreutils/date.o.orig
   1622	      0	      0	   1622	    656	coreutils/date.o.01k


------------------------------------------------------------------------
r15847 | aldot | 2006-08-20 14:10:00 +0200 (Sun, 20 Aug 2006) | 6 lines

- shrink date: fold date_conv_time and date_conv_ftime into single caller to help optimizers.
   text	   data	    bss	    dec	    hex	filename
   1622	      0	      0	   1622	    656	coreutils/date.o.01k
   1441	      0	      0	   1441	    5a1	coreutils/date.o


------------------------------------------------------------------------
r15848 | aldot | 2006-08-20 14:15:30 +0200 (Sun, 20 Aug 2006) | 7 lines

- fix and shrink ipcs: man ctime suggests to use separate calls to it to avoid
  reentrancy problems. Misc. shrinkage to accomodate the increased size imposed by that fix. Turned into an overall shrinkage in the end.
   text	   data	    bss	    dec	    hex	filename
   6509	      0	      0	   6509	   196d	util-linux/ipcs.o.01a
   6450	      0	      1	   6451	   1933	util-linux/ipcs.o


------------------------------------------------------------------------
r15849 | aldot | 2006-08-20 14:18:30 +0200 (Sun, 20 Aug 2006) | 6 lines

- shrink ipcrm. This want's a CONFIG_FEATURE_IPCRM_LEGACY for the old-style applet -- it really is a separate applet for the old way.
   text	   data	    bss	    dec	    hex	filename
   1194	      0	      0	   1194	    4aa	util-linux/ipcrm.o.orig
    959	      0	      0	    959	    3bf	util-linux/ipcrm.o


------------------------------------------------------------------------
r15850 | aldot | 2006-08-20 14:21:51 +0200 (Sun, 20 Aug 2006) | 2 lines

- make catv readable; no objcode changes.

------------------------------------------------------------------------


More information about the busybox mailing list