summaryrefslogtreecommitdiff
path: root/gold/symtab.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-10-16 23:23:08 +0000
committerIan Lance Taylor <iant@google.com>2007-10-16 23:23:08 +0000
commitb285f7d6a873a8780998df74a9e3c7b358309a0f (patch)
tree5eb729d6f067b812c5823d580a23192fe2cfcf30 /gold/symtab.cc
parent18c136e07f92b1f92e9a58072310d6bff9baa712 (diff)
downloadbinutils-redhat-b285f7d6a873a8780998df74a9e3c7b358309a0f.tar.gz
From Cary Coutant: preliminary shared library support.
Diffstat (limited to 'gold/symtab.cc')
-rw-r--r--gold/symtab.cc26
1 files changed, 22 insertions, 4 deletions
diff --git a/gold/symtab.cc b/gold/symtab.cc
index 7e0af342a8..3eee9be854 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -188,6 +188,27 @@ Sized_symbol<size>::init(const char* name, Value_type value, Size_type symsize,
this->symsize_ = symsize;
}
+// Return true if this symbol should be added to the dynamic symbol
+// table.
+
+inline bool
+Symbol::should_add_dynsym_entry() const
+{
+ // If the symbol is used by a dynamic relocation, we need to add it.
+ if (this->needs_dynsym_entry())
+ return true;
+
+ // If exporting all symbols or building a shared library,
+ // and the symbol is defined in a regular object and is
+ // externally visible, we need to add it.
+ if ((parameters->export_dynamic() || parameters->output_is_shared())
+ && !this->is_from_dynobj()
+ && this->is_externally_visible())
+ return true;
+
+ return false;
+}
+
// Return true if the final value of this symbol is known at link
// time.
@@ -1225,10 +1246,7 @@ Symbol_table::set_dynsym_indexes(const General_options* options,
// some symbols appear more than once in the symbol table, with
// and without a version.
- if (!sym->needs_dynsym_entry()
- && (!options->export_dynamic()
- || !sym->in_reg()
- || !sym->is_externally_visible()))
+ if (!sym->should_add_dynsym_entry())
sym->set_dynsym_index(-1U);
else if (!sym->has_dynsym_index())
{