On Tue, 2012-01-24 at 08:09 -0500, Chet Ramey wrote: > On 1/23/12 10:17 PM, Jonathan Andrews wrote: > > > 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. > > Sure, but it's the difference between all of the libc functions you use > and none of them, not what you use from libc and what you don't. gcc never fails to surprise me, at the moment not in a positive way :-(
> > > > 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 ? > > It is. Just comment out the goto as a quick fix. OK > > > > 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 > > There are a few cases like this that prevent a minimally-configured > bash from building. In this case, it's that there is a `goto pop_alias' > but the pop_alias label is protected by an #ifdef. I see bash has many tests to qualify the interpreter, could it not have a similar thing for builds, a set of the most sensible configure/make permutations that need to be passed after each patch ? I'm not familiar enough to the code to offer anything sensible or I would write some. Another one, introduced in patch5 possibly? ... 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 variables.c variables.c:4234: error: 'sv_tz' undeclared here (not in a function) make: *** [variables.o] Error 1 Also from previous builds: bash-4.2/bashline.c:2105: warning: Using 'endservent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking WTF ! Words fail me, I bet some c++ lover has made this mess for me ..... I feel so old..... take me back to 1986, a happy time .... Is it even possible to build a statically linked bash? I've done it before but that was in the land time forget, around kernel 2.4.24, when gcc started with a "3." and worked :-( ggrrrrr Thanks, Jon