From 4674ecfcf4045b3a3d81a4a979debd59ea1b6b11 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/options.cc | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'gold/options.cc') diff --git a/gold/options.cc b/gold/options.cc index 90fa163..6b2b5cf 100644 --- a/gold/options.cc +++ b/gold/options.cc @@ -304,6 +304,15 @@ General_options::parse_plugin(const char*, const char* arg, { this->add_plugin(arg); } + +// Parse --plugin-opt. + +void +General_options::parse_plugin_opt(const char*, const char* arg, + Command_line*) +{ + this->add_plugin_option(arg); +} #endif // ENABLE_PLUGINS void @@ -650,14 +659,24 @@ General_options::add_sysroot() free(canonical_sysroot); } -// Add a plugin and its arguments to the list of plugins. +// Add a plugin to the list of plugins. void -General_options::add_plugin(const char* arg) +General_options::add_plugin(const char* filename) { if (this->plugins_ == NULL) this->plugins_ = new Plugin_manager(*this); - this->plugins_->add_plugin(arg); + this->plugins_->add_plugin(filename); +} + +// Add a plugin option to a plugin. + +void +General_options::add_plugin_option(const char* arg) +{ + if (this->plugins_ == NULL) + gold_fatal("--plugin-opt requires --plugin."); + this->plugins_->add_plugin_option(arg); } // Set up variables and other state that isn't set up automatically by -- cgit v1.1