This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: --with-sysroot=/ linker search path


On Wed, 4 Sep 2013, Alan Modra wrote:
> I was looking at some --with-sysroot=/ default linker scripts
> recently, and wondered why we don't generate the same search paths as
> a non-sysroot linker.  I think we should, so this patch sets about
> making them the same.
>
> To do that, both sysroot and non-sysroot linkers must change whether
> $tooldir/lib, ie. $prefix/$target/lib, appears in the search path.
> When the sysroot support was added, that particular path was removed
> from all sysroot linkers.  I think that went a little too far.  It
> makes perfect sense to me for a powerpc64-linux linker to search
> /usr/powerpc64-linux-gnu/lib when linking powerpc64-linux objects, the
> native case, and when the same linker is linking 32-bit powerpc
> objects to search /usr/powerpc-linux-gnu/lib.  The latter directory is
> derived from tdir vars set by configure.tgt and is generally the
> tooldir value you'd get if configuring a native ld for the given
> emulation.  However, you don't want a powerpc64-linux ld configured
> with --enable-targets=all, searching /usr/powerpc64-linux-gnu/lib when
> linking x86_64-linux objects..  (It would be nice if such a linker
> searched /usr/x86_64-linux-gnu/lib when linking x86_64 objects, but
> that is outside the scope of this patch.)
>
> So this patch chooses a middle-ground for both sysroot and non-sysroot
> linkers.  sysroot adds $tooldir/lib when native and when given an
> emulation tdir, and non-sysroot loses $tooldir/lib for all other cases.

So cross targets lose $tooldir/lib?  I'm not totally sure under
what conditions this "tdir" is set but grepping configure.tgt it
seems like not set by default.  If so, what you're doing removes
the only usable path cross targets that *don't* use sysroot can
use, so...

> I also fix one sysroot path that lacked a '=' prefix, and sort the
> paths a little more consistently.
>
> Does anyone have violent objections to this change?

...well, yes, but conditionally.  $tooldir/lib is where all
libraries and objects are installed for my non-sysrooted cross
builds (actually, that's what I hoped we could make the default
for builds without --with-sysroot some time in the future), so
with your change, they won't be found ...  except gcc still adds
it as a search path through '-L', while your change "only"
affects the SEARCH_DIR directive in the default linker script
(like a default -L).  If "only" plain ld calls are broken, I
don't care.  Just don't push the same change at gcc, please.

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]