aboutsummaryrefslogtreecommitdiff
path: root/gold/object.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2006-12-06 06:28:56 +0000
committerIan Lance Taylor <iant@google.com>2006-12-06 06:28:56 +0000
commit008db82ec1ba308dba0fcf7767b93c1d56897bcc (patch)
tree93fef89fd7f3241e644fc770a3e59129a01f3407 /gold/object.cc
parent8f2e9323f0b754011d0fa089bac65c9d28b73483 (diff)
downloadgdb-008db82ec1ba308dba0fcf7767b93c1d56897bcc.zip
gdb-008db82ec1ba308dba0fcf7767b93c1d56897bcc.tar.gz
gdb-008db82ec1ba308dba0fcf7767b93c1d56897bcc.tar.bz2
Don't emit symbols seen only in dynamic object, don't read duplicate
dynamic object.
Diffstat (limited to 'gold/object.cc')
-rw-r--r--gold/object.cc26
1 files changed, 21 insertions, 5 deletions
diff --git a/gold/object.cc b/gold/object.cc
index 2086fed..01c4c16 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -718,15 +718,29 @@ Sized_relobj<size, big_endian>::write_local_symbols(Output_file* of,
// Input_objects methods.
-// Add a regular relocatable object to the list.
+// Add a regular relocatable object to the list. Return false if this
+// object should be ignored.
-void
+bool
Input_objects::add_object(Object* obj)
{
- if (obj->is_dynamic())
- this->dynobj_list_.push_back(static_cast<Dynobj*>(obj));
- else
+ if (!obj->is_dynamic())
this->relobj_list_.push_back(static_cast<Relobj*>(obj));
+ else
+ {
+ // See if this is a duplicate SONAME.
+ Dynobj* dynobj = static_cast<Dynobj*>(obj);
+
+ std::pair<Unordered_set<std::string>::iterator, bool> ins =
+ this->sonames_.insert(dynobj->soname());
+ if (!ins.second)
+ {
+ // We have already seen a dynamic object with this soname.
+ return false;
+ }
+
+ this->dynobj_list_.push_back(dynobj);
+ }
Target* target = obj->target();
if (this->target_ == NULL)
@@ -737,6 +751,8 @@ Input_objects::add_object(Object* obj)
program_name, obj->name().c_str());
gold_exit(false);
}
+
+ return true;
}
// Relocate_info methods.