This is the mail archive of the 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 v2] Put GNU_UNIQUE symbols into the dynamic section.

This ensures that dynamically loaded libraries won't
use separate copies of these symbols.

    * (Symbol::should_add_dynsym_entry):
    return true for GNU_UNIQUE.
 gold/ | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gold/ b/gold/
index 225856a..4f02267 100644
--- a/gold/
+++ b/gold/
@@ -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]