diff options
author | Nick Clifton <nickc@redhat.com> | 2020-04-01 17:25:28 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-04-01 17:25:28 +0100 |
commit | 77bf7b5317195e092a9f18fef993c412e2e05f53 (patch) | |
tree | 4b2113258ba79d89043c290072941389ec4ba01e /ld/ldfile.c | |
parent | e139a727be23643702eecbbcaa9c590cc680e3d7 (diff) | |
download | binutils-77bf7b5317195e092a9f18fef993c412e2e05f53.zip binutils-77bf7b5317195e092a9f18fef993c412e2e05f53.tar.gz binutils-77bf7b5317195e092a9f18fef993c412e2e05f53.tar.bz2 |
Extend the linker's error message for missing libraries if there is an almost match.
PR ld/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.
Diffstat (limited to 'ld/ldfile.c')
-rw-r--r-- | ld/ldfile.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ld/ldfile.c b/ld/ldfile.c index aa84906..3248a04 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; } |