How to build a cross-ld that behaves like a native ld?

Daniel Jacobowitz drow@false.org
Sat Jan 28 17:37:00 GMT 2006


On Fri, Jan 27, 2006 at 05:29:47PM -0500, Jon Ringle wrote:
> The toolchain runs on the host and targets a foreign cpu (armv5b in my case), 
> but the toolchain is executed inside of the scratchbox. Because scratchbox 

... x86->arm compiler inside an arm chroot, with arm libraries in /lib? 
No wonder you're having trouble with this configuration.

> provides a mechanism to execute the target binaries from the host, configure 
> scripts also believe that they are running in a native environment. 
> scratchbox also initially has /lib and /usr/lib unpopulated so that I can 
> populate them with target libs that I build with the toolchain. The toolchain 
> provides a set of target libs for "bootstrapping" purposes 
> in /scratchbox/compilers/mytoolchain/mytarget/lib/ which is derived from 
> --with-sysroot.

The normal reason for starting with an empty library directory is to
make sure you don't inherit anything from the previous build.  If
you're going to do that then having pre-existing target libraries
defeats the point.  They should just live in /lib and then you make
sure they all get overwritten.

Whatever.  I realize you didn't design scratchbox.  Whoever did ought
to figure out what they need to make binutils work in this bizarre
setup.

> I really need my ld to search both. And also obey all the 
> rules that a native ld would do in regards to LD_LIBRARY_PATH 
> and /etc/ld.so.conf as well.

You will have to patch ld.  Figure out why NATIVE and USE_LIBPATH
aren't getting set for you in elf32.em.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Binutils mailing list