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: [RFC] sysroot and dynamic libraries


Alan Modra wrote:
How do people feel about restricting a sysrooted ld to only search for
dynamic libraries inside the sysroot?  Reason: ld effectively searches
for any DT_NEEDED libs inside the sysroot.  Thus if you find a dynamic
library outside the sysroot (due to passing a -L outside the sysroot)
you may find an incompatible version of a DT_NEEDED dependency inside
the sysroot.

Why would anyone want to pass a -L outside the sysroot?  Isn't the
idea of a sysroot for cross toolchains?  So -L outside the sysroot
can't find compatible libraries anyway?  Well, yes, but I'm extending
the idea:  Making a sysroot for a native toolchain so that you can
install a complete toolchain including a new glibc without danger of
trashing your system.


Having not tried your patch, I am a little confused.


My libc and other system libraries are indeed in the sysroot, so no problem there. However hypothetically, I build my application (which includes several dynamic libraries with their own DT_NEEDED) outside of the sysroot and pass -L so the linker can find them. It sounds like you are saying that with your change, the dependencies of libraries outside of the sysroot may no longer be found and I will now get linker errors unless I manually specify *all* needed libraries.

In any event, as long as most cross toolchains continue resolve dependencies in a somewhat sane manner I would feel neutral about the change.

David Daney





Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.190
diff -u -p -r1.190 elf32.em
--- ld/emultempl/elf32.em 15 Feb 2008 03:35:53 -0000 1.190
+++ ld/emultempl/elf32.em 7 Aug 2008 00:46:34 -0000
@@ -1497,6 +1497,9 @@ gld${EMULATION_NAME}_open_dynamic_archiv
if (! entry->is_archive)
return FALSE;
+ if (*ld_sysroot && !search->sysrooted)
+ return FALSE;
+
filename = entry->filename;
/* This allocates a few bytes too many when EXTRA_SHLIB_EXTENSION




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