OLD | NEW |
(Empty) | |
| 1 commit 3c537f7fdb11f02f7082749f3f21dfdd2c2025e8 |
| 2 Author: Peter Collingbourne <pcc@google.com> |
| 3 Date: Wed Feb 4 09:47:28 2015 -0800 |
| 4 |
| 5 Resolve forwarding symbols in plugins. |
| 6 |
| 7 2015-02-04 Peter Collingbourne <pcc@google.com> |
| 8 |
| 9 * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve |
| 10 forwarding symbols when computing symbol resolution info for plugins. |
| 11 |
| 12 diff --git a/gold/plugin.cc b/gold/plugin.cc |
| 13 index bde8c78..68da8e3 100644 |
| 14 --- a/gold/plugin.cc |
| 15 +++ b/gold/plugin.cc |
| 16 @@ -914,7 +914,8 @@ is_visible_from_outside(Symbol* lsym) |
| 17 // Get symbol resolution info. |
| 18 |
| 19 ld_plugin_status |
| 20 -Pluginobj::get_symbol_resolution_info(int nsyms, |
| 21 +Pluginobj::get_symbol_resolution_info(Symbol_table* symtab, |
| 22 + int nsyms, |
| 23 ld_plugin_symbol* syms, |
| 24 int version) const |
| 25 { |
| 26 @@ -943,6 +944,8 @@ Pluginobj::get_symbol_resolution_info(int nsyms, |
| 27 { |
| 28 ld_plugin_symbol* isym = &syms[i]; |
| 29 Symbol* lsym = this->symbols_[i]; |
| 30 + if (lsym->is_forwarder()) |
| 31 + lsym = symtab->resolve_forwards(lsym); |
| 32 ld_plugin_symbol_resolution res = LDPR_UNKNOWN; |
| 33 |
| 34 if (lsym->is_undefined()) |
| 35 @@ -1511,14 +1514,16 @@ static enum ld_plugin_status |
| 36 get_symbols(const void* handle, int nsyms, ld_plugin_symbol* syms) |
| 37 { |
| 38 gold_assert(parameters->options().has_plugins()); |
| 39 - Object* obj = parameters->options().plugins()->object( |
| 40 + Plugin_manager* plugins = parameters->options().plugins(); |
| 41 + Object* obj = plugins->object( |
| 42 static_cast<unsigned int>(reinterpret_cast<intptr_t>(handle))); |
| 43 if (obj == NULL) |
| 44 return LDPS_ERR; |
| 45 Pluginobj* plugin_obj = obj->pluginobj(); |
| 46 if (plugin_obj == NULL) |
| 47 return LDPS_ERR; |
| 48 - return plugin_obj->get_symbol_resolution_info(nsyms, syms, 1); |
| 49 + Symbol_table* symtab = plugins->symtab(); |
| 50 + return plugin_obj->get_symbol_resolution_info(symtab, nsyms, syms, 1); |
| 51 } |
| 52 |
| 53 // Version 2 of the above. The only difference is that this version |
| 54 @@ -1528,14 +1533,16 @@ static enum ld_plugin_status |
| 55 get_symbols_v2(const void* handle, int nsyms, ld_plugin_symbol* syms) |
| 56 { |
| 57 gold_assert(parameters->options().has_plugins()); |
| 58 - Object* obj = parameters->options().plugins()->object( |
| 59 + Plugin_manager* plugins = parameters->options().plugins(); |
| 60 + Object* obj = plugins->object( |
| 61 static_cast<unsigned int>(reinterpret_cast<intptr_t>(handle))); |
| 62 if (obj == NULL) |
| 63 return LDPS_ERR; |
| 64 Pluginobj* plugin_obj = obj->pluginobj(); |
| 65 if (plugin_obj == NULL) |
| 66 return LDPS_ERR; |
| 67 - return plugin_obj->get_symbol_resolution_info(nsyms, syms, 2); |
| 68 + Symbol_table* symtab = plugins->symtab(); |
| 69 + return plugin_obj->get_symbol_resolution_info(symtab, nsyms, syms, 2); |
| 70 } |
| 71 |
| 72 // Add a new (real) input file generated by a plugin. |
| 73 diff --git a/gold/plugin.h b/gold/plugin.h |
| 74 index ef78b84..f926879 100644 |
| 75 --- a/gold/plugin.h |
| 76 +++ b/gold/plugin.h |
| 77 @@ -282,6 +282,10 @@ class Plugin_manager |
| 78 input_objects() const |
| 79 { return this->input_objects_; } |
| 80 |
| 81 + Symbol_table* |
| 82 + symtab() |
| 83 + { return this->symtab_; } |
| 84 + |
| 85 Layout* |
| 86 layout() |
| 87 { return this->layout_; } |
| 88 @@ -396,7 +400,8 @@ class Pluginobj : public Object |
| 89 |
| 90 // Fill in the symbol resolution status for the given plugin symbols. |
| 91 ld_plugin_status |
| 92 - get_symbol_resolution_info(int nsyms, |
| 93 + get_symbol_resolution_info(Symbol_table* symtab, |
| 94 + int nsyms, |
| 95 ld_plugin_symbol* syms, |
| 96 int version) const; |
| 97 |
OLD | NEW |