crosstool-generated toolchain produces massive ELF executable

Arno Schuring aelschuring@hotmail.com
Mon Jan 30 20:55:00 GMT 2006


Robert P. J. Day wrote:

>(...)
>  
>
>  when i use a crosstool-generated toolchain, the executable turns out
>to be almost 400K in size.  that executable is created by linking all
>of the object files with the static libs libc.a and libgcc.a, and the
>difference seems to be that the KPIT toolchain only links in those
>routines that are used, but the crosstool toolchain pulls in all kinds
>of unnecessary library routines, thus creating that overly-large final
>executable.
>
>  the entire final executable should be a single, statically-linked
>program so i've added linker options like -nostdlib and so on, and the
>two static libs are explicitly listed in the link command.  but that
>final executable is still around 400K.
>
>  any advice while i keep looking for what i did wrong?  thanks.
>  
>
have you tried running <target>-strip --strip-unneeded on your
executable? It should remove all unused code and eliminate debug
messages. However, I'm not sure if it will work on a boot loader:
--strip-unneeded breaks libraries also...

But glibc is in general quite large, in some cases uclibc-based
executable are less than half of glibc-based ones, but that depends on
how much of the library is actually used by the app.


Regards,
Arno


-- 
  np: Porcupine Tree - Radioactive Toy


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.org



More information about the crossgcc mailing list