Change Section_id type to use Relobj* instead of Object*.

2015-04-29  Cary Coutant  <cary@google.com>
	    Rafael Ávila de Espíndola <rafael.espindola@gmail.com>

gold/
	* gc.h (Garbage_collection::is_section_garbage): Change Object*
	to Relobj*.
	(Garbage_collection::add_reference): Likewise.
	(Garbage_collection::gc_process_relocs): Likewise. Don't push
	object/shndx pair onto *secvec for dynamic objects. Don't follow
	relocations pointing to dynamic objects for GC.
	* icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
	(Icf::unfold_section): Likewise.
	(Icf::is_section_folded): Likewise.
	(Icf::get_folded_section): Likewise.
	* icf.h: (Icf::get_folded_section): Likewise.
	(Icf::unfold_section): Likewise.
	(Icf::is_section_folded): Likewise.
	(Icf::section_has_function_pointers): Likewise.
	(Icf::set_section_has_function_pointers): Likewise.
	* object.h (Section_id): Likewise.
	(Const_section_id): Likewise.
	* output.cc (Output_section::update_section_layout): Likewise.
	* output.h: (Output_section_lookup_maps::find_relaxed_input_section):
	Likewise.
	* plugin.cc (update_section_order): Likewise.
	(unique_segment_for_sections): Likewise.
	* powerpc.cc (Powerpc_relobj::add_reference): Likewise.
	(Target_powerpc::do_gc_add_reference): Likewise.
	(Target_powerpc::gc_process_relocs): Likewise.
	(Target_powerpc::do_gc_add_reference): Likewise.
	* symtab.cc (Symbol_table::is_section_folded): Likewise.
	(Symbol_table::gc_mark_symbol): Likewise.
	* symtab.h: (Symbol_table::is_section_folded): Likewise.
	* target.h: (Sized_target::gc_add_reference): Likewise.
	(Sized_target::do_gc_add_reference): Likewise.
This commit is contained in:
Cary Coutant
2015-05-02 08:40:09 -07:00
parent 0138c3463d
commit efc6fa128f
12 changed files with 80 additions and 43 deletions

View File

@@ -585,7 +585,7 @@ Symbol_table::Symbol_table_eq::operator()(const Symbol_table_key& k1,
}
bool
Symbol_table::is_section_folded(Object* obj, unsigned int shndx) const
Symbol_table::is_section_folded(Relobj* obj, unsigned int shndx) const
{
return (parameters->options().icf_enabled()
&& this->icf_->is_section_folded(obj, shndx));
@@ -650,10 +650,11 @@ Symbol_table::gc_mark_symbol(Symbol* sym)
// Add the object and section to the work list.
bool is_ordinary;
unsigned int shndx = sym->shndx(&is_ordinary);
if (is_ordinary && shndx != elfcpp::SHN_UNDEF)
if (is_ordinary && shndx != elfcpp::SHN_UNDEF && !sym->object()->is_dynamic())
{
gold_assert(this->gc_!= NULL);
this->gc_->worklist().push_back(Section_id(sym->object(), shndx));
Relobj* relobj = static_cast<Relobj*>(sym->object());
this->gc_->worklist().push_back(Section_id(relobj, shndx));
}
parameters->target().gc_mark_symbol(this, sym);
}