summaryrefslogtreecommitdiff
path: root/gold/symtab.cc
diff options
context:
space:
mode:
authorIan Coolidge <icoolidge@google.com>2015-04-20 18:04:07 -0700
committerCary Coutant <ccoutant@gmail.com>2015-04-20 18:07:49 -0700
commit4b889c3013d7d45e2775781c3904b657419db2fa (patch)
tree1b525037f020ab96f55b8a376f4c88bb208fe9bc /gold/symtab.cc
parentefdacec57ccde20bb53045e2930ef02e7e49416b (diff)
Ensure that dynamically loaded libraries won't use separate copies of GNU_UNIQUE symbols.
gold/ * symtab.cc (Symbol::should_add_dynsym_entry): Return true for GNU_UNIQUE.
Diffstat (limited to 'gold/symtab.cc')
-rw-r--r--gold/symtab.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/gold/symtab.cc b/gold/symtab.cc
index d4f40c8d54..c1972210d6 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -419,9 +419,13 @@ Symbol::should_add_dynsym_entry(Symbol_table* symtab) const
}
// If exporting all symbols or building a shared library,
+ // or the symbol should be globally unique (GNU_UNIQUE),
// and the symbol is defined in a regular object and is
// externally visible, we need to add it.
- if ((parameters->options().export_dynamic() || parameters->options().shared())
+ if ((parameters->options().export_dynamic()
+ || parameters->options().shared()
+ || (parameters->options().gnu_unique()
+ && this->binding() == elfcpp::STB_GNU_UNIQUE))
&& !this->is_from_dynobj()
&& !this->is_undefined()
&& this->is_externally_visible())