2011-10-31 Sriraman Tallam <tmsriram@google.com>
* symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to gc_mark_symbol. * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to gc_mark_symbol. Change to just keep the section associated with symbol. (Symbol_table::add_from_relobj): Mark symbols as not garbage when they are externally visible and --export-dynamic is turned on. (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
This commit is contained in:
parent
b9fd179153
commit
7257cc92ac
@ -1,3 +1,14 @@
|
|||||||
|
2011-10-31 Sriraman Tallam <tmsriram@google.com>
|
||||||
|
|
||||||
|
* symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
|
||||||
|
gc_mark_symbol.
|
||||||
|
* symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
|
||||||
|
gc_mark_symbol.
|
||||||
|
Change to just keep the section associated with symbol.
|
||||||
|
(Symbol_table::add_from_relobj): Mark symbols as not garbage when
|
||||||
|
they are externally visible and --export-dynamic is turned on.
|
||||||
|
(Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
|
||||||
|
|
||||||
2011-10-19 Ian Lance Taylor <iant@google.com>
|
2011-10-19 Ian Lance Taylor <iant@google.com>
|
||||||
|
|
||||||
PR gold/13163
|
PR gold/13163
|
||||||
|
@ -602,20 +602,16 @@ Symbol_table::gc_mark_undef_symbols(Layout* layout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Symbol_table::gc_mark_symbol_for_shlib(Symbol* sym)
|
Symbol_table::gc_mark_symbol(Symbol* sym)
|
||||||
{
|
{
|
||||||
if (!sym->is_from_dynobj()
|
// Add the object and section to the work list.
|
||||||
&& sym->is_externally_visible())
|
Relobj* obj = static_cast<Relobj*>(sym->object());
|
||||||
|
bool is_ordinary;
|
||||||
|
unsigned int shndx = sym->shndx(&is_ordinary);
|
||||||
|
if (is_ordinary && shndx != elfcpp::SHN_UNDEF)
|
||||||
{
|
{
|
||||||
//Add the object and section to the work list.
|
gold_assert(this->gc_!= NULL);
|
||||||
Relobj* obj = static_cast<Relobj*>(sym->object());
|
this->gc_->worklist().push(Section_id(obj, shndx));
|
||||||
bool is_ordinary;
|
|
||||||
unsigned int shndx = sym->shndx(&is_ordinary);
|
|
||||||
if (is_ordinary && shndx != elfcpp::SHN_UNDEF)
|
|
||||||
{
|
|
||||||
gold_assert(this->gc_!= NULL);
|
|
||||||
this->gc_->worklist().push(Section_id(obj, shndx));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,16 +622,7 @@ Symbol_table::gc_mark_dyn_syms(Symbol* sym)
|
|||||||
{
|
{
|
||||||
if (sym->in_dyn() && sym->source() == Symbol::FROM_OBJECT
|
if (sym->in_dyn() && sym->source() == Symbol::FROM_OBJECT
|
||||||
&& !sym->object()->is_dynamic())
|
&& !sym->object()->is_dynamic())
|
||||||
{
|
this->gc_mark_symbol(sym);
|
||||||
Relobj* obj = static_cast<Relobj*>(sym->object());
|
|
||||||
bool is_ordinary;
|
|
||||||
unsigned int shndx = sym->shndx(&is_ordinary);
|
|
||||||
if (is_ordinary && shndx != elfcpp::SHN_UNDEF)
|
|
||||||
{
|
|
||||||
gold_assert(this->gc_ != NULL);
|
|
||||||
this->gc_->worklist().push(Section_id(obj, shndx));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make TO a symbol which forwards to FROM.
|
// Make TO a symbol which forwards to FROM.
|
||||||
@ -1251,11 +1238,16 @@ Symbol_table::add_from_relobj(
|
|||||||
if (is_forced_local)
|
if (is_forced_local)
|
||||||
this->force_local(res);
|
this->force_local(res);
|
||||||
|
|
||||||
// If building a shared library using garbage collection, do not
|
// Do not treat this symbol as garbage if this symbol will be
|
||||||
// treat externally visible symbols as garbage.
|
// exported to the dynamic symbol table. This is true when
|
||||||
if (parameters->options().gc_sections()
|
// building a shared library or using --export-dynamic and
|
||||||
&& parameters->options().shared())
|
// the symbol is externally visible.
|
||||||
this->gc_mark_symbol_for_shlib(res);
|
if (parameters->options().gc_sections()
|
||||||
|
&& res->is_externally_visible()
|
||||||
|
&& !res->is_from_dynobj()
|
||||||
|
&& (parameters->options().shared()
|
||||||
|
|| parameters->options().export_dynamic()))
|
||||||
|
this->gc_mark_symbol(res);
|
||||||
|
|
||||||
if (is_defined_in_discarded_section)
|
if (is_defined_in_discarded_section)
|
||||||
res->set_is_defined_in_discarded_section();
|
res->set_is_defined_in_discarded_section();
|
||||||
|
@ -1313,10 +1313,9 @@ class Symbol_table
|
|||||||
void
|
void
|
||||||
gc_mark_undef_symbols(Layout*);
|
gc_mark_undef_symbols(Layout*);
|
||||||
|
|
||||||
// During garbage collection, this ensures externally visible symbols
|
// This tells garbage collection that this symbol is referenced.
|
||||||
// are not treated as garbage while building shared objects.
|
|
||||||
void
|
void
|
||||||
gc_mark_symbol_for_shlib(Symbol* sym);
|
gc_mark_symbol(Symbol* sym);
|
||||||
|
|
||||||
// During garbage collection, this keeps sections that correspond to
|
// During garbage collection, this keeps sections that correspond to
|
||||||
// symbols seen in dynamic objects.
|
// symbols seen in dynamic objects.
|
||||||
|
Loading…
Reference in New Issue
Block a user