This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Commit: Report failed attempts to find needed files
- From: Nick Clifton <nickc at redhat dot com>
- To: binutils at sourceware dot org
- Date: Thu, 22 Sep 2016 14:29:41 +0100
- Subject: Commit: Report failed attempts to find needed files
- Authentication-results: sourceware.org; auth=none
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;