From f480a93b4ee32680f135f3507ecc33b33e719c39 Mon Sep 17 00:00:00 2001 From: Cary Coutant Date: Fri, 5 Dec 2008 21:34:54 +0000 Subject: 2008-12-05 Rafael Avila de Espindola * options.cc (General_options::parse_plugin_opt): New. (General_options::add_plugin): The argument now is just the filename. (General_options::add_plugin_option): New. * options.h (plugin_opt): New. (add_plugin): Change argument name. (add_plugin_option): New. * plugin.cc (Plugin::load): Don't parse the plugin option. * plugin.h (Plugin::Plugin): Rename argument. Init filename_. (Plugin::add_option): New. (Plugin::args_): Change type. (Plugin::filename_): New. (Plugin_manager::add_plugin_option): New. * testsuite/Makefile.am (plugin_test_1): Use new syntax. * testsuite/Makefile.in: Regenerate. --- gold/plugin.h | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'gold/plugin.h') diff --git a/gold/plugin.h b/gold/plugin.h index 3f573ced27..5b6fa1fd34 100644 --- a/gold/plugin.h +++ b/gold/plugin.h @@ -48,9 +48,10 @@ class Pluginobj; class Plugin { public: - Plugin(const char* args) + Plugin(const char* filename) : handle_(NULL), - args_(args), + filename_(filename), + args_(), claim_file_handler_(NULL), all_symbols_read_handler_(NULL), cleanup_handler_(NULL) @@ -90,6 +91,13 @@ class Plugin set_cleanup_handler(ld_plugin_cleanup_handler handler) { this->cleanup_handler_ = handler; } + // Add an argument + void + add_option(const char *arg) + { + this->args_.push_back(arg); + } + private: Plugin(const Plugin&); Plugin& operator=(const Plugin&); @@ -97,7 +105,9 @@ class Plugin // The shared library handle returned by dlopen. void* handle_; // The argument string given to --plugin. - const char* args_; + std::string filename_; + // The list of argument string given to --plugin-opt. + std::vector args_; // The plugin's event handlers. ld_plugin_claim_file_handler claim_file_handler_; ld_plugin_all_symbols_read_handler all_symbols_read_handler_; @@ -119,8 +129,16 @@ class Plugin_manager // Add a plugin library. void - add_plugin(const char* args) - { this->plugins_.push_back(new Plugin(args)); } + add_plugin(const char* filename) + { this->plugins_.push_back(new Plugin(filename)); } + + // Add an argument to the current plugin. + void + add_plugin_option(const char* opt) + { + Plugin* last = this->plugins_.back(); + last->add_option(opt); + } // Load all plugin libraries. void -- cgit v1.2.1