On Mon, 2012-01-23 at 20:30 -0500, Chet Ramey wrote: > On 1/23/12 1:12 AM, Jonathan Andrews wrote: > > > I needed a statically linked bash for testing an arm board. I did not > > expect it to be nearly 3MB though ! It surprises me that a statically > > linked bash is bigger than the entire busybox binary i've compiled, or > > my kernel image for that matter. Is this bloat gcc, some failing of the > > linker or bash itself? > > That's probably the size of the C library on your machine. The only > difference between a static bash and a `normal' bash is that the system > libraries are linked in instead of being dynamically linked at run time. Im not a gcc expect, I thought the idea of the linker was also to drop unused code but this seems not to be true with gcc as default.
http://www.google.com/url?sa=t&rct=j&q=gcc%20linker%20unused%20code&source=web&cd=5&ved=0CEYQFjAE&url=http%3A%2F%2Felinux.org%2Fimages%2F2%2F2d%2FELC2010-gc-sections_Denys_Vlasenko.pdf&ei=Tx8eT5mUGczRswaZju3eDA&usg=AFQjCNF3miTnzqYNsiiyei_SQDlDxG10TQ&cad=rja http://gcc.gnu.org/ml/gcc-help/2003-08/msg00128.html I've been trying to compile bash static with the extra parameters, no joy so far - finger trouble on my part I expect. > I built a minimal bash (--enable-minimal-config) on my machine (Mac OS X, > where static linking isn't possible), and it ended up being about half > as big as a bash-4.2.20 build. I had to fix a few things to do it. Maybe this is one of the things ? I've applied the patches, tried this : (script) export CC=arm-softfloat-linux-gnu-gcc ./configure --build=i386-linux --host=arm-linux --enable-static-link --without-bash-malloc --enable-minimal-config make Get this : arm-softfloat-linux-gnu-gcc -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"arm"' -DCONF_OSTYPE='"linux-gnu"' -DCONF_MACHTYPE='"arm-unknown-linux-gnu"' -DCONF_VENDOR='"unknown"' -DLOCALEDIR='"/usr/local/share/locale"' -DPACKAGE='"bash"' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -g -O2 -c y.tab.c ./parse.y: In function 'shell_getc': ./parse.y:2399: error: label 'pop_alias' used but not defined make: *** [y.tab.o] Error 1 Any ideas ? Thanks, Jon