This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] 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: kmackay at google dot com, shenhan at google dot com, Ian Coolidge <icoolidge at google dot com>
- Date: Fri, 17 Apr 2015 00:19:42 -0700
- Subject: [PATCH] Put GNU_UNIQUE symbols into the dynamic section.
- Authentication-results: sourceware.org; auth=none
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 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gold/symtab.cc b/gold/symtab.cc
index 8ec8f73..2508676 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -419,9 +419,11 @@ 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() ||
+ this->binding() == elfcpp::STB_GNU_UNIQUE)
&& !this->is_from_dynobj()
&& !this->is_undefined()
&& this->is_externally_visible())
--
2.2.0.rc0.207.ga3a616c