diff options
author | Ian Lance Taylor <iant@google.com> | 2007-11-14 16:53:25 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2007-11-14 16:53:25 +0000 |
commit | 9a2d69841557c502021be98221a796ebe253fa09 (patch) | |
tree | 0b92ca469f9782810c95cbbc2e2aa5e80273c669 /gold/object.cc | |
parent | 3e6fe5ae738660d48c8b6a3e0206cbd2d23fa1c5 (diff) | |
download | gdb-9a2d69841557c502021be98221a796ebe253fa09.zip gdb-9a2d69841557c502021be98221a796ebe253fa09.tar.gz gdb-9a2d69841557c502021be98221a796ebe253fa09.tar.bz2 |
Add heuristics for undefined symbol warnings.
Diffstat (limited to 'gold/object.cc')
-rw-r--r-- | gold/object.cc | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/gold/object.cc b/gold/object.cc index fa16d13..7a4b1fb 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -25,6 +25,7 @@ #include <cerrno> #include <cstring> #include <cstdarg> +#include "libiberty.h" #include "target-select.h" #include "dwarf_reader.h" @@ -1062,9 +1063,10 @@ Input_objects::add_object(Object* obj) { // See if this is a duplicate SONAME. Dynobj* dynobj = static_cast<Dynobj*>(obj); + const char* soname = dynobj->soname(); std::pair<Unordered_set<std::string>::iterator, bool> ins = - this->sonames_.insert(dynobj->soname()); + this->sonames_.insert(soname); if (!ins.second) { // We have already seen a dynamic object with this soname. @@ -1072,6 +1074,19 @@ Input_objects::add_object(Object* obj) } this->dynobj_list_.push_back(dynobj); + + // If this is -lc, remember the directory in which we found it. + // We use this when issuing warnings about undefined symbols: as + // a heuristic, we don't warn about system libraries found in + // the same directory as -lc. + if (strncmp(soname, "libc.so", 7) == 0) + { + const char* object_name = dynobj->name().c_str(); + const char* base = lbasename(object_name); + if (base != object_name) + this->system_library_directory_.assign(object_name, + base - 1 - object_name); + } } set_parameters_size_and_endianness(target->get_size(), @@ -1080,6 +1095,17 @@ Input_objects::add_object(Object* obj) return true; } +// Return whether an object was found in the system library directory. + +bool +Input_objects::found_in_system_library_directory(const Object* object) const +{ + return (!this->system_library_directory_.empty() + && object->name().compare(0, + this->system_library_directory_.size(), + this->system_library_directory_) == 0); +} + // For each dynamic object, record whether we've seen all of its // explicit dependencies. |