diff options
author | Sriraman Tallam <tmsriram@google.com> | 2018-02-15 17:35:16 -0800 |
---|---|---|
committer | Sriraman Tallam <tmsriram@google.com> | 2018-02-15 17:35:16 -0800 |
commit | 3281b315c89caf1d539a316e41cc095e46482f75 (patch) | |
tree | c324284c8a21bf2bac30f2bb5678cbb430e63867 /gold/plugin.h | |
parent | 43859909e2982252d136e19258431f3aa8afb890 (diff) | |
download | gdb-3281b315c89caf1d539a316e41cc095e46482f75.zip gdb-3281b315c89caf1d539a316e41cc095e46482f75.tar.gz gdb-3281b315c89caf1d539a316e41cc095e46482f75.tar.bz2 |
Fix symbol resolution with linker plugins for defsym symbols.
2018-02-07 Sriraman Tallam <tmsriram@google.com>
* expression.cc (Symbol_expression::set_expr_sym_in_real_elf):
New method.
(Unary_expression::set_expr_sym_in_real_elf): New method.
(Binary_expression::set_expr_sym_in_real_elf): New method.
(Trinary_expression::set_expr_sym_in_real_elf): New method.
* plugin.cc (get_symbol_resolution_info): Fix symbol resolution if
defined or used in defsyms.
* plugin.h (Plugin_manager::is_defsym_def): New method.
(Plugin_manager::Plugin_manager): Initialize defsym_defines_set_.
(Plugin_manager::defsym_defines_set_): New member.
(Plugin_manager::Defsym_defines_set): New typedef.
* script.cc (Script_options::set_defsym_uses_in_real_elf): New method.
(Script_options::find_defsym_defs): New method.
* script.h (Expression::set_expr_sym_in_real_elf): New method.
(Symbol_assignment::is_defsym): New method.
(Symbol_assignment::value): New method.
(Script_options::find_defsym_defs): New method.
(Script_options::set_defsym_uses_in_real_elf): New method.
* testsuite/Makefile.am (plugin_test_defsym): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/plugin_test.c: Check for new symbol resolution.
* testsuite/plugin_test_defsym.sh: New script.
* testsuite/plugin_test_defsym.c: New test source.
Diffstat (limited to 'gold/plugin.h')
-rw-r--r-- | gold/plugin.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gold/plugin.h b/gold/plugin.h index db6093d..e64ee07 100644 --- a/gold/plugin.h +++ b/gold/plugin.h @@ -146,11 +146,18 @@ class Plugin_manager options_(options), workqueue_(NULL), task_(NULL), input_objects_(NULL), symtab_(NULL), layout_(NULL), dirpath_(NULL), mapfile_(NULL), this_blocker_(NULL), extra_search_path_(), lock_(NULL), - initialize_lock_(&lock_) + initialize_lock_(&lock_), defsym_defines_set_() { this->current_ = plugins_.end(); } ~Plugin_manager(); + // Returns true if the symbol name is used in the LHS of a defsym. + bool + is_defsym_def(const char* sym_name) const + { + return defsym_defines_set_.find(sym_name) != defsym_defines_set_.end(); + } + // Add a plugin library. void add_plugin(const char* filename) @@ -402,6 +409,10 @@ class Plugin_manager std::string extra_search_path_; Lock* lock_; Initialize_lock initialize_lock_; + + // Keep track of all symbols defined by defsym. + typedef Unordered_set<std::string> Defsym_defines_set; + Defsym_defines_set defsym_defines_set_; }; |