Index: contrib/binutils/bfd/elflink.c =================================================================== --- contrib/binutils/bfd/elflink.c +++ contrib/binutils/bfd/elflink.c @@ -4356,9 +4356,48 @@ --no-add-needed is used. */ if ((elf_dyn_lib_class (abfd) & DYN_NO_NEEDED) != 0) { + bfd_boolean looks_soish; + char libname[200], *lend; + const char *print_name; + size_t len; + + looks_soish = FALSE; + print_name = soname; + if (strncmp(soname, "lib", 3) == 0 && + (strstr(soname, ".so") != NULL || strstr(soname, ".a") != NULL)) + { + lend = NULL; + + strlcpy(libname, soname + 3, sizeof(libname)); + len = strlen(libname); + if (len >= 2 && strcmp(&libname[len - 2], ".a") == 0) + lend = &libname[len - 2]; + if (lend == NULL) + { + char *sover; + lend = strstr(libname, ".so"); + if (lend) + { + for (sover = lend + 3; *sover; sover++) + { + if (!ISDIGIT(*sover) && *sover != '.') + { + sover = lend = NULL; + break; + } + } + } + } + if (lend) + { + print_name = libname; + looks_soish = TRUE; + *lend = '\0'; + } + } (*_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_name); bfd_set_error (bfd_error_bad_value); goto error_free_vers; } Index: contrib/binutils/bfd/po/bfd.pot =================================================================== --- contrib/binutils/bfd/po/bfd.pot +++ contrib/binutils/bfd/po/bfd.pot @@ -2438,9 +2438,9 @@ msgid "Warning: size of symbol `%s' changed from %lu in %B to %lu in %B" msgstr "" -#: elflink.c:4309 +#: elflink.c:4383 #, 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