* options.h (class General_options): Add --[no-]gnu-unique options.
authorCary Coutant <ccoutant@google.com>
Mon, 31 Oct 2011 22:43:49 +0000 (22:43 +0000)
committerCary Coutant <ccoutant@google.com>
Mon, 31 Oct 2011 22:43:49 +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 fddf7d0700fb564b7f073033667689fbd9492376..cc8aae0f9c1989710faea5d780f9f09884541750 100644 (file)
@@ -1,3 +1,9 @@
+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
index 28377908b7b476bec87bcd81f40060d79a1cfe21..99094830a5e91c8ee905d67ffdb95a9d64dd28af 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 3b76adb283548f52ba1a05c36122776ef6dc24b8..f0ba1d560fb5563d5bfa4d80f358c90ab7307959 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:
This page took 0.049795 seconds and 4 git commands to generate.