aboutsummaryrefslogtreecommitdiff
path: root/gold/plugin.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gold/plugin.cc')
-rw-r--r--gold/plugin.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/gold/plugin.cc b/gold/plugin.cc
index 02fef25..566f1b7 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -580,6 +580,11 @@ Plugin_manager::all_symbols_read(Workqueue* workqueue, Task* task,
this->mapfile_ = mapfile;
this->this_blocker_ = NULL;
+ // Set symbols used in defsym expressions as seen in real ELF.
+ Layout *layout = parameters->options().plugins()->layout();
+ layout->script_options()->set_defsym_uses_in_real_elf(symtab);
+ layout->script_options()->find_defsym_defs(this->defsym_defines_set_);
+
for (this->current_ = this->plugins_.begin();
this->current_ != this->plugins_.end();
++this->current_)
@@ -989,6 +994,7 @@ Pluginobj::get_symbol_resolution_info(Symbol_table* symtab,
return version > 2 ? LDPS_NO_SYMS : LDPS_OK;
}
+ Plugin_manager* plugins = parameters->options().plugins();
for (int i = 0; i < nsyms; i++)
{
ld_plugin_symbol* isym = &syms[i];
@@ -997,9 +1003,16 @@ Pluginobj::get_symbol_resolution_info(Symbol_table* symtab,
lsym = symtab->resolve_forwards(lsym);
ld_plugin_symbol_resolution res = LDPR_UNKNOWN;
- if (lsym->is_undefined())
- // The symbol remains undefined.
- res = LDPR_UNDEF;
+ if (plugins->is_defsym_def(lsym->name()))
+ {
+ // The symbol is redefined via defsym.
+ res = LDPR_PREEMPTED_REG;
+ }
+ else if (lsym->is_undefined())
+ {
+ // The symbol remains undefined.
+ res = LDPR_UNDEF;
+ }
else if (isym->def == LDPK_UNDEF
|| isym->def == LDPK_WEAKUNDEF
|| isym->def == LDPK_COMMON)