Commit: Report failed attempts to find needed files

Nick Clifton nickc@redhat.com
Thu Sep 22 13:29:00 GMT 2016


Hi Guys,

  When linking with --verbose the linker will report failed attempts to
  locate files and libraries.  This can be really useful when debugging
  problems involving linker search paths.  Currently however the linker
  does not report failed attempts to locate libraries that are pulled in
  via DT_NEEDED tags.  This can happen with a mis-configured linker (as
  happened to me) or because of problems with the linker script or
  sysroot being used.

  So I am applying the patch below to add the ability.  It is only
  triggered when --verbose is in effect, so it should not affect the day
  to day running of the linker.

Cheers
  Nick

ld/ChangeLog
2016-09-22  Nick Clifton  <nickc@redhat.com>

	* emultempl/elf32.em (_try_needed): In verbose mode, report failed
	attempts to find a needed library.

diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 2153bf9..b675691 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -337,7 +337,11 @@ gld${EMULATION_NAME}_try_needed (struct dt_needed *needed,
 
   abfd = bfd_openr (name, bfd_get_target (link_info.output_bfd));
   if (abfd == NULL)
-    return FALSE;
+    {
+      if (verbose)
+       info_msg (_("attempt to open %s failed\n"), name);
+      return FALSE;
+    }
 
   /* Linker needs to decompress sections.  */
   abfd->flags |= BFD_DECOMPRESS;



More information about the Binutils mailing list