aboutsummaryrefslogtreecommitdiff
path: root/gold/symtab.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-11-14 07:34:53 +0000
committerIan Lance Taylor <iant@google.com>2007-11-14 07:34:53 +0000
commite2827e5f525574e8620bd43c8bcb27dba3407a7f (patch)
treea72625b3bd98a7beb23dde4aad331598572564f3 /gold/symtab.cc
parenta55ce7febfaa52670ce3d9c236d3033de80ac091 (diff)
downloadgdb-e2827e5f525574e8620bd43c8bcb27dba3407a7f.zip
gdb-e2827e5f525574e8620bd43c8bcb27dba3407a7f.tar.gz
gdb-e2827e5f525574e8620bd43c8bcb27dba3407a7f.tar.bz2
Warn about undefined references in shared libraries if we have seen
all the DT_NEEDED entries for that library.
Diffstat (limited to 'gold/symtab.cc')
-rw-r--r--gold/symtab.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/gold/symtab.cc b/gold/symtab.cc
index 9bee283..f5e2132 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -1599,6 +1599,26 @@ Symbol_table::sized_write_globals(const Target* target,
{
Sized_symbol<size>* sym = static_cast<Sized_symbol<size>*>(p->second);
+ // Optionally check for unresolved symbols in shared libraries.
+ // This is controlled by the --allow-shlib-undefined option. We
+ // only warn about libraries for which we have seen all the
+ // DT_NEEDED entries. We don't try to track down DT_NEEDED
+ // entries which were not seen in this link. If we didn't see a
+ // DT_NEEDED entry, we aren't going to be able to reliably
+ // report whether the symbol is undefined.
+ if (sym->source() == Symbol::FROM_OBJECT
+ && sym->object()->is_dynamic()
+ && sym->shndx() == elfcpp::SHN_UNDEF
+ && sym->binding() != elfcpp::STB_WEAK
+ && !parameters->allow_shlib_undefined())
+ {
+ // A very ugly cast.
+ Dynobj* dynobj = static_cast<Dynobj*>(sym->object());
+ if (!dynobj->has_unknown_needed_entries())
+ gold_error(_("%s: undefined reference to '%s'"),
+ sym->object()->name().c_str(), sym->name());
+ }
+
unsigned int sym_index = sym->symtab_index();
unsigned int dynsym_index;
if (dynamic_view == NULL)