[rfc] using --with-sysroot for native builds

Goswin von Brederlow goswin-v-b@web.de
Fri Oct 29 11:11:00 GMT 2010


Alan Modra <amodra@gmail.com> writes:

> On Thu, Oct 28, 2010 at 05:23:23PM +0200, Matthias Klose wrote:
>> currently the --sysroot option for ld is only available if binutils
>> is configured --with-sysroot=<...>.  My use case for using sysroots
>> for native builds is having multiple chroots for different releases
>> of an OS available for testing, and not having to install a new
>> compiler/linker in the chroot itself. This basically works when
>> configuring --with-sysroot=/, but then libraries are searched in //
>> instead of /.
>> 
>> The following patch makes the --sysroot option available to ld
>> independently of the configure option (making ld.bfd and ld.gold
>> consistent), and avoids the extra slash prefix.
>
> I think this should only be made available when native.  That's even
> what you said above and in $subject, but your patch makes a cross
> linker accept --sysroot.  Cross-linkers configured without a sysroot
> will not search the usual directories.

Except that it should.

One aspect of the multiarch project in Debian is to unify the places
where libraries are and where the compiler and linker look for
libraries. The native and cross-compilers for an architecture should use
the same search paths.  That way the same "$arch-$kernel-$libc-$tool
..." command will work regardless wether it is run native or cross with
sysroot or chroot.

Getting rid of the different behaviour of the linker when compiled with
and without --sysroot is a step in the right direction.

Also note that the linker is usualy smart enough to ignore libraries
from the wrong architecture. So having the cross-compiler search /lib
and /usr/lib does not make it link amd64 libs into armel binaries for
example.

MfG
        Goswin



More information about the Binutils mailing list