This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Ensure that dynamically loaded libraries won't use separate copies of GNU_UNIQUE symbols.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4b889c3013d7d45e2775781c3904b657419db2fa

commit 4b889c3013d7d45e2775781c3904b657419db2fa
Author: Ian Coolidge <icoolidge@google.com>
Date:   Mon Apr 20 18:04:07 2015 -0700

    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.

Diff:
---
 gold/ChangeLog | 5 +++++
 gold/symtab.cc | 6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/gold/ChangeLog b/gold/ChangeLog
index 789ba66..e736d33 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-20  Ian Coolidge  <icoolidge@google.com>
+
+	* symtab.cc (Symbol::should_add_dynsym_entry): Return true for
+	GNU_UNIQUE.
+
 2015-04-17  Rafael �vila de Espíndola <rafael.espindola@gmail.com>
 
 	* gc.cc (Garbage_collection::do_transitive_closure): Use back and
diff --git a/gold/symtab.cc b/gold/symtab.cc
index d4f40c8..c197221 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())


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]