Removing dependency to libgcc_s.so

David Daney ddaney at avtrex.com
Fri Jul 21 15:26:38 UTC 2006


Michael Hunold wrote:
> Hi,
> 
> I'm building busybox using a MIPS toolchain created by buildroot.
> 
> When building busybox as a dynamically linked application (which I want
> to do), there will be a dependency to libgcc_s.so.1, which is 274843
> bytes big. Not exactly what I call a leightweight.
> 
> busybox with my configuration is 187572 bytes.
> 
> I added "-nodefaultlibs -lm -lc" to the Makefile and ended up with
> unresolved symbols to __udivdi3 and friends.
> 
> I found out that these provide 64bit divison and modulo operations and
> are part of libgcc. Apparently they are used when the processor has no
> native 64bit division in hardware.
> 
> I added a straight-forward implementation to libbb and ended up with a
> busybox that is now 179204 bytes, so I saved 8368 bytes for the binary
> plus the complete libgcc that I don't need anymore.
> 
> Is removing the dependency to libgcc a good thing to do?
> 
> If so, I can provide a patch. But I'm not sure how to handle the case
> where busybox is built with a toolchain for a processor that has 64bit
> divison in hardware.
> 

The proper way to fix this is to fix the toolchain.  The implementation 
of the functions in libgcc are tightly coupled with the compiler and 
should be left where they belong (in libgcc).

All you are doing is papering over a bug in ld.  Best to fix it there. 
I would refer you to this e-mail thread which discusses the problem a bit:

http://www.uclibc.org/lists/uclibc/2006-June/015630.html

David Daney



More information about the busybox mailing list