This is the mail archive of the 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: finding libraries from linker via $ORIGIN

Alan Modra wrote:
> On Wed, Apr 10, 2013 at 06:31:28PM +0200, Oliver Kiddle wrote:
> > It seems the bfd linker reads in all shared libraries from transitive
> > library dependencies. When using --no-copy-dt-needed-entries this is
> > surely fairly pointless?
> Well, no, because as you found:
> > it then fails because of symbols in needed
> > by
> It might be reasonable to omit loading DT_NEEDED libraries if both
> --no-copy-dt-needed-entries *and* --allow-shlib-undefined is specified.

That makes sense, thanks. It seems to work well as far as my testing
goes. I've put the corresponding small patch below. Is there any chance
of this change or a similar one being included?

I'd also be happy to put together a patch for expanding $ORIGIN when
searching for DT_NEEDED libraries if there's any willingness to include
such a change(?). Judging from a web search other people have also had
my original issue (but used -rpath-link to resolve it).

Thanks also to John Reiser for the hint regarding spec files.


Index: ld/emultempl/elf32.em
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.242
diff -u -r1.242 elf32.em
--- ld/emultempl/elf32.em	4 Apr 2013 14:38:47 -0000	1.242
+++ ld/emultempl/elf32.em	11 Apr 2013 21:34:13 -0000
@@ -1183,7 +1183,8 @@
 	 DT_NEEDED entres.  */
       if (l->by != NULL
 	  && ((bfd_elf_get_dyn_lib_class (l->by) & DYN_AS_NEEDED) != 0
-	      || (!link_info.executable
+	      || ((!link_info.executable
+	          || link_info.unresolved_syms_in_shared_libs == RM_IGNORE)
 		  && bfd_elf_get_dyn_lib_class (l->by) & DYN_NO_ADD_NEEDED) != 0))

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