summaryrefslogtreecommitdiff
path: root/gold/plugin.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2008-12-05 21:34:54 +0000
committerCary Coutant <ccoutant@google.com>2008-12-05 21:34:54 +0000
commitf480a93b4ee32680f135f3507ecc33b33e719c39 (patch)
treeaae9866ee2ee84194edda87b2126fa892cbfbe51 /gold/plugin.h
parent7e93cd3fcd76f2573dbf8854bdf8ae05e3102040 (diff)
downloadbinutils-redhat-f480a93b4ee32680f135f3507ecc33b33e719c39.tar.gz
2008-12-05 Rafael Avila de Espindola <espindola@google.com>
* 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.
Diffstat (limited to 'gold/plugin.h')
-rw-r--r--gold/plugin.h28
1 files changed, 23 insertions, 5 deletions
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<std::string> 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