[rfc] the 'dc' applet

Denys Vlasenko vda.linux at googlemail.com
Thu Jul 29 23:19:28 UTC 2010


On Thursday 29 July 2010 23:35, Cristian Ionescu-Idbohrn wrote:
> On Thu, 29 Jul 2010, Denys Vlasenko wrote:
> 
> > Try attached patch.
> >
> > # ./busybox dc 18014398509481982 4503599627370496 mod p
> > 4503599627370494
> > # ./busybox dc 18014398509481982 9007199254740992 mod p
> > 9007199254740990
> >
> >
> > function                                             old     new   delta
> > print_base                                           176     238     +62
> > or                                                    91     103     +12
> > eor                                                   91     103     +12
> > and                                                   91     103     +12
> > not                                                   60      64      +4
> > mod                                                  103     105      +2
> > ------------------------------------------------------------------------------
> > (add/remove: 0/0 grow/shrink: 6/0 up/down: 104/0)             Total: 104 bytes
> 
> Thanks.  That seems to work much better.  Still.
> 
> My gcc:
> 
> $ gcc -v
> Using built-in specs.
> Target: i486-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.4-7'
> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
> --enable-shared --enable-multiarch --enable-linker-build-id
> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
> --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
> --enable-libstdcxx-debug --enable-objc-gc --enable-targets=all
> --with-arch-32=i586 --with-tune=generic --enable-checking=release
> --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
> Thread model: posix
> gcc version 4.4.4 (Debian 4.4.4-7)
> 
> generates bigger code:
> 
> Final link with: crypt m
> function                                             old     new   delta
> print_base                                           219     498    +279
> mod                                                  123     321    +198
> or                                                   120     315    +195
> eor                                                  120     315    +195
> and                                                  120     315    +195
> not                                                   79     198    +119
> .rodata                                           105913  105957     +44
> ------------------------------------------------------------------------------
> (add/remove: 0/0 grow/shrink: 7/0 up/down: 1225/0)           Total: 1225 bytes
>    text    data     bss     dec     hex filename
>  849424    2106    9020  860550   d2186 busybox_old
>  850649    2106    9020  861775   d264f busybox_unstripped
> 
> There's also the warnings (the gcc odd option -Wbad-function-cast picks
> up):
> 
> editors/awk.c: In function 'handle_special':
> editors/awk.c:1699: warning: cast from function call of type 'double' to
> non-matching type 'int'
> editors/awk.c: In function 'awk_printf':
> editors/awk.c:1965: warning: cast from function call of type 'double' to
> non-matching type 'char'
> editors/awk.c: In function 'evaluate':
> editors/awk.c:2627: warning: cast from function call of type 'int' to
> non-matching type 'double'
> editors/awk.c:2747: warning: cast from function call of type 'double' to
> non-matching type 'int'

I think you messed up CFLAGS. Most likely you lost -Os while adding -W<everything>.
-- 
vda


More information about the busybox mailing list