gold: Ignore def/ref from a dynamic object for special symbols
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 8 Nov 2017 23:56:54 +0000 (15:56 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 9 Nov 2017 00:02:50 +0000 (16:02 -0800)
commitdc8d2d90da3f191ae0461900ab98e3b29cc2b280
tree810c9e619488f444ac0079866dc15714da1a2d9f
parentcb1a122cce8a7eefe1025d8d189c52f96da6138f
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/ChangeLog
gold/layout.cc
gold/symtab.cc
gold/symtab.h