This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[RFC] sysroot and dynamic libraries
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sourceware dot org
- Date: Thu, 7 Aug 2008 10:27:55 +0930
- Subject: [RFC] sysroot and dynamic libraries
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.
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
--
Alan Modra
Australia Development Lab, IBM