This is the mail archive of the binutils@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]

[PATCH] Put GNU_UNIQUE symbols into the dynamic section.


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


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