Resolve forwarding symbols in plugins.
2015-02-04 Peter Collingbourne <pcc@google.com> * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve forwarding symbols when computing symbol resolution info for plugins.
This commit is contained in:
parent
42d9e5288b
commit
3c537f7fdb
2 changed files with 18 additions and 6 deletions
|
@ -914,7 +914,8 @@ is_visible_from_outside(Symbol* lsym)
|
||||||
// Get symbol resolution info.
|
// Get symbol resolution info.
|
||||||
|
|
||||||
ld_plugin_status
|
ld_plugin_status
|
||||||
Pluginobj::get_symbol_resolution_info(int nsyms,
|
Pluginobj::get_symbol_resolution_info(Symbol_table* symtab,
|
||||||
|
int nsyms,
|
||||||
ld_plugin_symbol* syms,
|
ld_plugin_symbol* syms,
|
||||||
int version) const
|
int version) const
|
||||||
{
|
{
|
||||||
|
@ -943,6 +944,8 @@ Pluginobj::get_symbol_resolution_info(int nsyms,
|
||||||
{
|
{
|
||||||
ld_plugin_symbol* isym = &syms[i];
|
ld_plugin_symbol* isym = &syms[i];
|
||||||
Symbol* lsym = this->symbols_[i];
|
Symbol* lsym = this->symbols_[i];
|
||||||
|
if (lsym->is_forwarder())
|
||||||
|
lsym = symtab->resolve_forwards(lsym);
|
||||||
ld_plugin_symbol_resolution res = LDPR_UNKNOWN;
|
ld_plugin_symbol_resolution res = LDPR_UNKNOWN;
|
||||||
|
|
||||||
if (lsym->is_undefined())
|
if (lsym->is_undefined())
|
||||||
|
@ -1511,14 +1514,16 @@ static enum ld_plugin_status
|
||||||
get_symbols(const void* handle, int nsyms, ld_plugin_symbol* syms)
|
get_symbols(const void* handle, int nsyms, ld_plugin_symbol* syms)
|
||||||
{
|
{
|
||||||
gold_assert(parameters->options().has_plugins());
|
gold_assert(parameters->options().has_plugins());
|
||||||
Object* obj = parameters->options().plugins()->object(
|
Plugin_manager* plugins = parameters->options().plugins();
|
||||||
|
Object* obj = plugins->object(
|
||||||
static_cast<unsigned int>(reinterpret_cast<intptr_t>(handle)));
|
static_cast<unsigned int>(reinterpret_cast<intptr_t>(handle)));
|
||||||
if (obj == NULL)
|
if (obj == NULL)
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
Pluginobj* plugin_obj = obj->pluginobj();
|
Pluginobj* plugin_obj = obj->pluginobj();
|
||||||
if (plugin_obj == NULL)
|
if (plugin_obj == NULL)
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
return plugin_obj->get_symbol_resolution_info(nsyms, syms, 1);
|
Symbol_table* symtab = plugins->symtab();
|
||||||
|
return plugin_obj->get_symbol_resolution_info(symtab, nsyms, syms, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Version 2 of the above. The only difference is that this version
|
// Version 2 of the above. The only difference is that this version
|
||||||
|
@ -1528,14 +1533,16 @@ static enum ld_plugin_status
|
||||||
get_symbols_v2(const void* handle, int nsyms, ld_plugin_symbol* syms)
|
get_symbols_v2(const void* handle, int nsyms, ld_plugin_symbol* syms)
|
||||||
{
|
{
|
||||||
gold_assert(parameters->options().has_plugins());
|
gold_assert(parameters->options().has_plugins());
|
||||||
Object* obj = parameters->options().plugins()->object(
|
Plugin_manager* plugins = parameters->options().plugins();
|
||||||
|
Object* obj = plugins->object(
|
||||||
static_cast<unsigned int>(reinterpret_cast<intptr_t>(handle)));
|
static_cast<unsigned int>(reinterpret_cast<intptr_t>(handle)));
|
||||||
if (obj == NULL)
|
if (obj == NULL)
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
Pluginobj* plugin_obj = obj->pluginobj();
|
Pluginobj* plugin_obj = obj->pluginobj();
|
||||||
if (plugin_obj == NULL)
|
if (plugin_obj == NULL)
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
return plugin_obj->get_symbol_resolution_info(nsyms, syms, 2);
|
Symbol_table* symtab = plugins->symtab();
|
||||||
|
return plugin_obj->get_symbol_resolution_info(symtab, nsyms, syms, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a new (real) input file generated by a plugin.
|
// Add a new (real) input file generated by a plugin.
|
||||||
|
|
|
@ -282,6 +282,10 @@ class Plugin_manager
|
||||||
input_objects() const
|
input_objects() const
|
||||||
{ return this->input_objects_; }
|
{ return this->input_objects_; }
|
||||||
|
|
||||||
|
Symbol_table*
|
||||||
|
symtab()
|
||||||
|
{ return this->symtab_; }
|
||||||
|
|
||||||
Layout*
|
Layout*
|
||||||
layout()
|
layout()
|
||||||
{ return this->layout_; }
|
{ return this->layout_; }
|
||||||
|
@ -396,7 +400,8 @@ class Pluginobj : public Object
|
||||||
|
|
||||||
// Fill in the symbol resolution status for the given plugin symbols.
|
// Fill in the symbol resolution status for the given plugin symbols.
|
||||||
ld_plugin_status
|
ld_plugin_status
|
||||||
get_symbol_resolution_info(int nsyms,
|
get_symbol_resolution_info(Symbol_table* symtab,
|
||||||
|
int nsyms,
|
||||||
ld_plugin_symbol* syms,
|
ld_plugin_symbol* syms,
|
||||||
int version) const;
|
int version) const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue