public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Commit: PR 25747: Tell users about a missing "lib" prefix to library names
@ 2020-04-01 16:24 Nick Clifton
  2020-04-01 17:19 ` Maciej W. Rozycki
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Clifton @ 2020-04-01 16:24 UTC (permalink / raw)
  To: binutils

Hi Guys

  I am applying the patch below to extend the linker's error message
  when it fails to find a library, but there is a file present in the
  search path which matches if the "lib" prefix were to be ignored.

Cheers
  Nick

ld/ChangeLog
2020-04-01  Nick Clifton  <nickc@redhat.com>

	PR ;d/25747
	* ldfile.c (ldfile_open_file): If a search for a library fails,
	but there is a file that would match if it had a "lib" prefix to
	its name, then tell the user.

diff --git a/ld/ldfile.c b/ld/ldfile.c
index aa84906992..3248a04607 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -445,6 +445,22 @@ ldfile_open_file (lang_input_statement_type *entry)
 		   entry->local_sym_name, ld_sysroot);
 	  else
 	    einfo (_("%P: cannot find %s\n"), entry->local_sym_name);
+
+	  /* PR 25747: Be kind to users who forgot to add the
+	     "lib" prefix to their library when it was created.  */
+	  for (arch = search_arch_head; arch != NULL; arch = arch->next)
+	    {
+	      if (ldfile_open_file_search (arch->name, entry, "", ".a"))
+		{
+		  const char * base = lbasename (entry->filename);
+
+		  einfo (_("%P: note to link with %s use use -l:%s or rename it to lib%s\n"),
+			 entry->filename, base, base);
+		  bfd_close (entry->the_bfd);
+		  entry->the_bfd = NULL;
+		  break;
+		}
+	    }
 	  entry->flags.missing_file = TRUE;
 	  input_flags.missing_file = TRUE;
 	}


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Commit: PR 25747: Tell users about a missing "lib" prefix to library names
  2020-04-01 16:24 Commit: PR 25747: Tell users about a missing "lib" prefix to library names Nick Clifton
@ 2020-04-01 17:19 ` Maciej W. Rozycki
  0 siblings, 0 replies; 2+ messages in thread
From: Maciej W. Rozycki @ 2020-04-01 17:19 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

On Wed, 1 Apr 2020, Nick Clifton via Binutils wrote:

> diff --git a/ld/ldfile.c b/ld/ldfile.c
> index aa84906992..3248a04607 100644
> --- a/ld/ldfile.c
> +++ b/ld/ldfile.c
> @@ -445,6 +445,22 @@ ldfile_open_file (lang_input_statement_type *entry)
>  		   entry->local_sym_name, ld_sysroot);
>  	  else
>  	    einfo (_("%P: cannot find %s\n"), entry->local_sym_name);
> +
> +	  /* PR 25747: Be kind to users who forgot to add the
> +	     "lib" prefix to their library when it was created.  */
> +	  for (arch = search_arch_head; arch != NULL; arch = arch->next)
> +	    {
> +	      if (ldfile_open_file_search (arch->name, entry, "", ".a"))
> +		{
> +		  const char * base = lbasename (entry->filename);
> +
> +		  einfo (_("%P: note to link with %s use use -l:%s or rename it to lib%s\n"),

 s/use use/use/ I presume here.

 Can you please match the heading of the change committed with the subject 
of the corresponding message sent to the mailing list (as `git am' would)?  
It will make it easier to chase any discussion corresponding to a commit 
when someone does repo excavation in the future.

  Maciej

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-01 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-01 16:24 Commit: PR 25747: Tell users about a missing "lib" prefix to library names Nick Clifton
2020-04-01 17:19 ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).