aboutsummaryrefslogtreecommitdiff
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
commit436ca963fd42564971f2906e4ba7263d513e483c (patch)
tree422fb94d22ab9e5df3475ff43c3b734625a489f2 /gold/symtab.cc
parenta360aedd0fd0e2c02c0896046bec126e6ad72308 (diff)
downloadgdb-436ca963fd42564971f2906e4ba7263d513e483c.zip
gdb-436ca963fd42564971f2906e4ba7263d513e483c.tar.gz
gdb-436ca963fd42564971f2906e4ba7263d513e483c.tar.bz2
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 7e0af34..3eee9be 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())
{