Ensure that dynamically loaded libraries won't use separate copies of GNU_UNIQUE...
authorIan Coolidge <icoolidge@google.com>
Tue, 21 Apr 2015 01:04:07 +0000 (18:04 -0700)
committerCary Coutant <ccoutant@gmail.com>
Tue, 21 Apr 2015 01:07:49 +0000 (18:07 -0700)
gold/
* symtab.cc (Symbol::should_add_dynsym_entry): Return true for
GNU_UNIQUE.

gold/ChangeLog
gold/symtab.cc

index 789ba66726c42ffb3d7148292424a4d89b7efc8c..e736d3310431e40edc0e08ce6caf8c94dc1ad1da 100644 (file)
@@ -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
index d4f40c8d54ebada9c2687b5f0216e6818f6378f2..c1972210d67600d49705679dcb035e51d1758576 100644 (file)
@@ -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())