summaryrefslogtreecommitdiffstats
path: root/contrib/binutils
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2014-12-02 01:30:53 +0000
committerdim <dim@FreeBSD.org>2014-12-02 01:30:53 +0000
commitd02f49e959007a290381ba996e8f6a23551024da (patch)
tree2fc0026293b01276ddbc0245efebeea551c7eff7 /contrib/binutils
parent00e7b79cd55d7682ea57d39c32fc2384115ddbd5 (diff)
downloadFreeBSD-src-d02f49e959007a290381ba996e8f6a23551024da.zip
FreeBSD-src-d02f49e959007a290381ba996e8f6a23551024da.tar.gz
Let GNU ld be less obscure about missing symbols and DSOs. If the BFD
object looks like a typical shared library, suggest adding '-l<foo>', where <foo> has the 'lib' prefix and '.so<bar>' or '.a' suffix removed. Otherwise, suggest adding '-l:<foo>', where <foo> is the full DT_SONAME. Submitted by: Conrad Meyer <conrad.meyer@isilon.com> Sponsored by: EMC / Isilon storage division Reviewed by: emaste PR: 194296 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D1152
Diffstat (limited to 'contrib/binutils')
-rw-r--r--contrib/binutils/bfd/elflink.c33
-rw-r--r--contrib/binutils/bfd/po/bfd.pot4
2 files changed, 33 insertions, 4 deletions
diff --git a/contrib/binutils/bfd/elflink.c b/contrib/binutils/bfd/elflink.c
index e80f8ee..f1e50de 100644
--- a/contrib/binutils/bfd/elflink.c
+++ b/contrib/binutils/bfd/elflink.c
@@ -4356,9 +4356,38 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
--no-add-needed is used. */
if ((elf_dyn_lib_class (abfd) & DYN_NO_NEEDED) != 0)
{
+ bfd_boolean looks_soish;
+ const char *print_name;
+ int print_len;
+ size_t len, lend = 0;
+
+ looks_soish = FALSE;
+ print_name = soname;
+ print_len = strlen(soname);
+ if (strncmp(soname, "lib", 3) == 0)
+ {
+ len = print_len;
+ if (len > 5 && strcmp(soname + len - 2, ".a") == 0)
+ lend = len - 5;
+ else
+ {
+ while (len > 6 && (ISDIGIT(soname[len - 1]) ||
+ soname[len - 1] == '.'))
+ len--;
+ if (strncmp(soname + len - 3, ".so", 3) == 0)
+ lend = len - 6;
+ }
+ if (lend != 0)
+ {
+ print_name = soname + 3;
+ print_len = lend;
+ looks_soish = TRUE;
+ }
+ }
+
(*_bfd_error_handler)
- (_("%B: invalid DSO for symbol `%s' definition"),
- abfd, name);
+ (_("undefined reference to symbol `%s' (try adding -l%s%.*s)"),
+ name, looks_soish? "" : ":", print_len, print_name);
bfd_set_error (bfd_error_bad_value);
goto error_free_vers;
}
diff --git a/contrib/binutils/bfd/po/bfd.pot b/contrib/binutils/bfd/po/bfd.pot
index e528238..e436b18 100644
--- a/contrib/binutils/bfd/po/bfd.pot
+++ b/contrib/binutils/bfd/po/bfd.pot
@@ -2438,9 +2438,9 @@ msgstr ""
msgid "Warning: size of symbol `%s' changed from %lu in %B to %lu in %B"
msgstr ""
-#: elflink.c:4309
+#: elflink.c:4389
#, c-format
-msgid "%B: invalid DSO for symbol `%s' definition"
+msgid "undefined reference to symbol `%s' (try adding -l%s%.*s)"
msgstr ""
#: elflink.c:5535
OpenPOWER on IntegriCloud