summaryrefslogtreecommitdiff
path: root/gold/plugin.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gold/plugin.cc')
-rw-r--r--gold/plugin.cc27
1 files changed, 14 insertions, 13 deletions
diff --git a/gold/plugin.cc b/gold/plugin.cc
index 9056a3b93b5..c4e46b501ad 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -116,7 +116,13 @@ Plugin::load()
int tv_size = this->args_.size() + tv_fixed_size;
ld_plugin_tv *tv = new ld_plugin_tv[tv_size];
+ // Put LDPT_MESSAGE at the front of the list so the plugin can use it
+ // while processing subsequent entries.
int i = 0;
+ tv[i].tv_tag = LDPT_MESSAGE;
+ tv[i].tv_u.tv_message = message;
+
+ ++i;
tv[i].tv_tag = LDPT_API_VERSION;
tv[i].tv_u.tv_val = LD_PLUGIN_API_VERSION;
@@ -165,10 +171,6 @@ Plugin::load()
tv[i].tv_u.tv_add_input_file = add_input_file;
++i;
- tv[i].tv_tag = LDPT_MESSAGE;
- tv[i].tv_u.tv_message = message;
-
- ++i;
tv[i].tv_tag = LDPT_NULL;
tv[i].tv_u.tv_val = 0;
@@ -265,14 +267,13 @@ Plugin_manager::claim_file(Input_file* input_file, off_t offset,
{
if ((*this->current_)->claim_file(&this->plugin_input_file_))
{
- if (this->objects_.size() <= handle)
- {
- gold_error(_("%s: plugin claimed the file "
- "but did not provide any symbols"),
- this->plugin_input_file_.name);
- return NULL;
- }
- return this->objects_[handle];
+ if (this->objects_.size() > handle)
+ return this->objects_[handle];
+
+ // If the plugin claimed the file but did not call the
+ // add_symbols callback, we need to create the Pluginobj now.
+ Pluginobj* obj = this->make_plugin_object(handle);
+ return obj;
}
}
@@ -369,7 +370,7 @@ Pluginobj::Pluginobj(const std::string& name, Input_file* input_file,
ld_plugin_status
Pluginobj::get_symbol_resolution_info(int nsyms, ld_plugin_symbol* syms) const
{
- if (this->nsyms_ == 0)
+ if (nsyms > this->nsyms_)
return LDPS_NO_SYMS;
for (int i = 0; i < nsyms; i++)
{