From 9634ed06a66c3693045bb8b3bf86b43942239dd8 Mon Sep 17 00:00:00 2001 From: Cary Coutant Date: Mon, 31 Oct 2011 22:43:49 +0000 Subject: [PATCH] * 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. --- gold/ChangeLog | 6 ++++++ gold/options.h | 4 ++++ gold/symtab.cc | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/gold/ChangeLog b/gold/ChangeLog index fddf7d0700f..cc8aae0f9c1 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,9 @@ +2011-10-31 Cary Coutant + + * 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 PR gold/13359 diff --git a/gold/options.h b/gold/options.h index 28377908b7b..99094830a5e 100644 --- a/gold/options.h +++ b/gold/options.h @@ -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")); diff --git a/gold/symtab.cc b/gold/symtab.cc index 3b76adb2835..f0ba1d560fb 100644 --- a/gold/symtab.cc +++ b/gold/symtab.cc @@ -2814,6 +2814,12 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, typename elfcpp::Elf_types::Elf_Addr sym_value = sym->value(); typename elfcpp::Elf_types::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: -- 2.30.2