From dc8d2d90da3f191ae0461900ab98e3b29cc2b280 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 8 Nov 2017 15:56:54 -0800 Subject: gold: Ignore def/ref from a dynamic object for special symbols Since special symbol must be defined in a regular object, definition from a dynamic object should be ignored. If special symbol has the hidden or internal visibility, reference from a dynamic object should also be ignored. Also __start and __stop symbols in a dynamic object shouldn't be preempted. PR gold/22291 * layout.cc (Layout::define_section_symbols): Use STV_PROTECTED for __start and __stop symbols. * symtab.cc (Symbol_table::define_special_symbol): Add an argument, visibility. Ignore definition and reference from a dynamic object, depending on visibility. (Symbol_table::do_define_in_output_data): Pass visibility to define_special_symbol. (Symbol_table::do_define_in_output_segment): Likewise. (Symbol_table::do_define_as_constant): Likewise. (Symbol_table::add_undefined_symbol_from_command_line): Pass STV_DEFAULT to define_special_symbol. * symtab.h (Symbol_table::define_special_symbol): Add an argument, visibility. --- gold/layout.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gold/layout.cc') diff --git a/gold/layout.cc b/gold/layout.cc index 15c5434..351c4b4 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -2252,7 +2252,7 @@ Layout::define_section_symbols(Symbol_table* symtab) 0, // symsize elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL, - elfcpp::STV_DEFAULT, + elfcpp::STV_PROTECTED, 0, // nonvis false, // offset_is_from_end true); // only_if_ref @@ -2265,7 +2265,7 @@ Layout::define_section_symbols(Symbol_table* symtab) 0, // symsize elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL, - elfcpp::STV_DEFAULT, + elfcpp::STV_PROTECTED, 0, // nonvis true, // offset_is_from_end true); // only_if_ref -- cgit v1.1