OSDN Git Service

* options.h (class General_options): Add --[no-]gnu-unique options.
authorccoutant <ccoutant>
Mon, 31 Oct 2011 22:43:48 +0000 (22:43 +0000)
committerccoutant <ccoutant>
Mon, 31 Oct 2011 22:43:48 +0000 (22:43 +0000)
* symtab.cc (Symbol_table::sized_write_globals): Convert
STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.

gold/ChangeLog
gold/options.h
gold/symtab.cc

index fddf7d0..cc8aae0 100644 (file)
@@ -1,5 +1,11 @@
 2011-10-31  Cary Coutant  <ccoutant@google.com>
 
+       * options.h (class General_options): Add --[no-]gnu-unique options.
+       * symtab.cc (Symbol_table::sized_write_globals): Convert
+       STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
+
+2011-10-31  Cary Coutant  <ccoutant@google.com>
+
        PR gold/13359
        * i386.cc (Target_i386::Relocate::relocate_tls): Remove
        unnecessary assertion.
index 2837790..9909483 100644 (file)
@@ -787,6 +787,10 @@ class General_options
   DEFINE_bool(g, options::EXACTLY_ONE_DASH, '\0', false,
              N_("Ignored"), NULL);
 
+  DEFINE_bool(gnu_unique, options::TWO_DASHES, '\0', true,
+             N_("Enable STB_GNU_UNIQUE symbol binding (default)"),
+             N_("Disable STB_GNU_UNIQUE symbol binding"));
+
   DEFINE_string(soname, options::ONE_DASH, 'h', NULL,
                 N_("Set shared library name"), N_("FILENAME"));
 
index 3b76adb..f0ba1d5 100644 (file)
@@ -2814,6 +2814,12 @@ Symbol_table::sized_write_globals(const Stringpool* sympool,
       typename elfcpp::Elf_types<size>::Elf_Addr sym_value = sym->value();
       typename elfcpp::Elf_types<size>::Elf_Addr dynsym_value = sym_value;
       elfcpp::STB binding = sym->binding();
+
+      // If --no-gnu-unique is set, change STB_GNU_UNIQUE to STB_GLOBAL.
+      if (binding == elfcpp::STB_GNU_UNIQUE
+         && !parameters->options().gnu_unique())
+       binding = elfcpp::STB_GLOBAL;
+
       switch (sym->source())
        {
        case Symbol::FROM_OBJECT: