RFH: libgcc_s.so being unnecessarily linked for mipsel-linux crosscompiler...

David Daney ddaney@avtrex.com
Fri Jul 29 02:40:00 GMT 2005


dank@kegel.com wrote:
> ddaney wrote:
> 
>>I have a a mipsel-linux cross compiler (gcc-3.4.3/binutils-2.16.1)
>>and whenever I compile even the simplest hello-world.c libgcc_s.so is
> 
> linked.
> 
> 
> Just curious -- how did you build your cross-compiler?

I have a bunch of rpm build scripts, but they pretty much just do a 
standard configure and make.

I never do a clean build of glibc and gcc in the same pass so I don't 
have the chicken and egg glibc header file problem.

> Do toolchains built by crosstool have this problem?

I have not checked, but I suspect so.

The problem is in the linker.  I am trying to fix it, but ld is an ugly 
beast.

It seems that the linker thinks that any shared object that references 
the magic _gp_disp symbol actually provides it.  Since all mips objects 
reference _gp_disp, ld thinks that all shared objects are required to 
resolve all the other _gp_disp references.  This causes all shared 
objects specified with --as-needed to be deemed needed and get a 
DT_NEEDED entry.

The linker automagically resolves _gp_disp so this symbol should not 
cause a shared library to be needed.

I hope that makes at least a little sense.

I suspect that the problem is mips specific as _gp_disp handling is mips 
specific.

David Daney



More information about the Binutils mailing list