This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH v2] Put GNU_UNIQUE symbols into the dynamic section.
- From: Ian Coolidge <icoolidge at google dot com>
- To: binutils at sourceware dot org, ccoutant at gmail dot com
- Cc: ppluzhnikov at google dot com, shenhan at google dot com, kmackay at google dot com, Ian Coolidge <icoolidge at google dot com>
- Date: Fri, 17 Apr 2015 20:31:49 -0700
- Subject: [PATCH v2] Put GNU_UNIQUE symbols into the dynamic section.
- Authentication-results: sourceware.org; auth=none
- References: <1429255182-11847-1-git-send-email-icoolidge at google dot com>
This ensures that dynamically loaded libraries won't
use separate copies of these symbols.
gold/
* symtab.cc (Symbol::should_add_dynsym_entry):
return true for GNU_UNIQUE.
---
gold/symtab.cc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gold/symtab.cc b/gold/symtab.cc
index 225856a..4f02267 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())
--
2.2.0.rc0.207.ga3a616c