aboutsummaryrefslogtreecommitdiff
path: root/gold/plugin.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gold/plugin.cc')
-rw-r--r--gold/plugin.cc31
1 files changed, 29 insertions, 2 deletions
diff --git a/gold/plugin.cc b/gold/plugin.cc
index c01e4cd..4aeb3ea 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -112,6 +112,9 @@ static enum ld_plugin_status
get_symbols_v2(const void *handle, int nsyms, struct ld_plugin_symbol *syms);
static enum ld_plugin_status
+get_symbols_v3(const void *handle, int nsyms, struct ld_plugin_symbol *syms);
+
+static enum ld_plugin_status
add_input_file(const char *pathname);
static enum ld_plugin_status
@@ -199,7 +202,7 @@ Plugin::load()
sscanf(ver, "%d.%d", &major, &minor);
// Allocate and populate a transfer vector.
- const int tv_fixed_size = 26;
+ const int tv_fixed_size = 27;
int tv_size = this->args_.size() + tv_fixed_size;
ld_plugin_tv* tv = new ld_plugin_tv[tv_size];
@@ -277,6 +280,10 @@ Plugin::load()
tv[i].tv_u.tv_get_symbols = get_symbols_v2;
++i;
+ tv[i].tv_tag = LDPT_GET_SYMBOLS_V3;
+ tv[i].tv_u.tv_get_symbols = get_symbols_v3;
+
+ ++i;
tv[i].tv_tag = LDPT_ADD_INPUT_FILE;
tv[i].tv_u.tv_add_input_file = add_input_file;
@@ -937,7 +944,7 @@ Pluginobj::get_symbol_resolution_info(Symbol_table* symtab,
gold_assert(this->symbols_.size() == 0);
for (int i = 0; i < nsyms; i++)
syms[i].resolution = LDPR_PREEMPTED_REG;
- return LDPS_OK;
+ return version > 2 ? LDPS_NO_SYMS : LDPS_OK;
}
for (int i = 0; i < nsyms; i++)
@@ -1545,6 +1552,26 @@ get_symbols_v2(const void* handle, int nsyms, ld_plugin_symbol* syms)
return plugin_obj->get_symbol_resolution_info(symtab, nsyms, syms, 2);
}
+// Version 3 of the above. The only difference from v2 is that it
+// returns LDPS_NO_SYMS instead of LDPS_OK for the objects we never
+// decided to include.
+
+static enum ld_plugin_status
+get_symbols_v3(const void* handle, int nsyms, ld_plugin_symbol* syms)
+{
+ gold_assert(parameters->options().has_plugins());
+ Plugin_manager* plugins = parameters->options().plugins();
+ Object* obj = plugins->object(
+ static_cast<unsigned int>(reinterpret_cast<intptr_t>(handle)));
+ if (obj == NULL)
+ return LDPS_ERR;
+ Pluginobj* plugin_obj = obj->pluginobj();
+ if (plugin_obj == NULL)
+ return LDPS_ERR;
+ Symbol_table* symtab = plugins->symtab();
+ return plugin_obj->get_symbol_resolution_info(symtab, nsyms, syms, 3);
+}
+
// Add a new (real) input file generated by a plugin.
static enum ld_plugin_status