You are right , In fact my main is linked with two stacks that were linked 
statically with libstdc++ and I forgot to rebuild and link them with the 
shared libstdc++ . I only linked my main with the shared libstdc++ .
That 's why the size remained almost the same.  

I rebuilt everything and now I really see the difference .Thank you Harris

Dan

Le Mardi 4 D�cembre 2001 13:46, Harris Landgarten a �crit :
> Dan,
>
> If you are really linking with the .so your file size should fall alot.
> Small c++ test programs go from 250k with .a to 14k with .so
>
> Run arm-linux-readelf -d on you executable. If you really linked with
> the .so, libstdc++-libc6.1-2.so.3 with be listed as a NEEDED Shared
> library. If only libm.so.6 and libc.so.6 are listed as NEEDED then you
> linked with the .a
>
> Harris
>
> On Tue, 2001-12-04 at 04:58, Dan ABITBOL wrote:
> > Thank you a lot
> >
> > It seems it has work. but it hasn't decreased the size of (my main +
> > libstdc++.so ) compared to (my main + libstdc++.a)
> >
> > As to the strip instruction, it was great , it helped me decrease the
> > size very much. Thank you a lot. I just don't understand what strip
> > really does=> are there any risks that my main run not well after that ?
> >
> > I did: arm-linux-strip -s mymain
> >
> > Thank you Harris, have a good day
> > Dan
> >
> > Le Lundi 3 D�cembre 2001 16:22, Harris Landgarten a �crit :
> > > Dan,
> > >
> > > I am doing the same as you. You have to have the gcc-295.3 source to
> > > build the shared library. Follow the instructions in Chris Rutters'
> > > toolchain faq under building the toolchain. All of these steps were
> > > already done in the cross tar you installed but you need the gcc source
> > > so you can recompile for g++ with shared libraries. Assuming you have
> > > the source installed you have to cd to gcc-2.95.3 directory and
> > >
> > > ./configure --target=arm-linux --prefix=/usr/local/arm/2.95.3
> > > --with-headers=<path to /linux/include> --enable-shared=yes
> > > --enable-languages=c++
> > >
> > > make
> > > make install
> > >
> > > When you are done you should have a libstdc++-3-libc6.1-2-2.10.0.so
> > > file in /usr/local/arm/2.95.3/arm-linux/lib
> > >
> > > Once you do this you normal cross compiles should use the shared
> > > library. BTW make sure you strip you program of symbols. You will save
> > > alot of space. You have to put the main .so lib on you embedded device
> > > in /lib and run ldconfig for your new smaller program to run.
> > >
> > > On Mon, 2001-12-03 at 03:32, Dan ABITBOL wrote:
> > > > Hello Philip, Hello Harris
> > > >
> > > > In fact , I m cross compiling and cross linking my main programm for
> > > > an arm-linux proceessor.
> > > > the arm-linux linker links my main with the the static libstdc++ of
> > > > the arm-toolchain. its size averages 2.5 Mb
> > > >
> > > > My work is to downsize my main. So I wanted to link it with the
> > > > dynamic version of lthe libstdc++ against the static one .
> > > >
> > > > So as I had only the static one , I made all I described in my former
> > > > emails to have the dynamic one .
> > > > So was it the right way ? I dont have ./configure tools ...
> > > > How can  I make out ? what shoul  i do to built the dynamic library
> > > > from the static one and what do I have to write in my makefile to
> > > > link my main with it against the static one that the linker
> > > > automatically calls ?
> > > >
> > > > PS: what PDC means ?
> > > >
> > > > Thank you both for your help and advice .
> > > > Dan
> > > >
> > > > Le Vendredi 30 Novembre 2001 20:36, Philip Blundell a �crit :
> > > > > In message <[EMAIL PROTECTED]>, Dan
> > > > > ABITBOL
> > > >
> > > > writes:
> > > > > >4/ then juste make
> > > > > >arm-linux-g++ -shared -fpic -ldl -o libstdc++.x.x.x.so *.o
> > > > > >the you ll have the shared one ....whic is libstdc++.x.x.x.so
> > > > >
> > > > > That doesn't create a shared library.  You get a dynamic object,
> > > > > but using -fpic during final link doesn't stop everything inside
> > > > > the library being PDC.
> > > > >
> > > > > Incidentally, it isn't necessary to manually unpack the archive. 
> > > > > You can just do "gcc -Wl,--whole-archive libxx.a ...".
> > > > >
> > > > > >Could you also help me? once we have our shared library, how I do
> > > > > > to link my main with the dynamic one and prevent the
> > > > > > arm-linux-linker from linking with the static one ?
> > > > >
> > > > > GNU ld should always prefer a shared object if you have one.
> > > > >
> > > > > p.
> > > > >
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
> > > > > Please visit the above address for information on this list.
> > >
> > > _______________________________________________
> > > http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
> > > Please visit the above address for information on this list.

_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
Please visit the above address for information on this list.

Reply via email to