aboutsummaryrefslogtreecommitdiff
path: root/gold/plugin.cc
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
commit4674ecfcf4045b3a3d81a4a979debd59ea1b6b11 (patch)
tree304093024cd1aed1d02654b688a607510c40efc8 /gold/plugin.cc
parentfd06b4aa51e5e4b322f4784e3ea248e25aab733a (diff)
downloadgdb-4674ecfcf4045b3a3d81a4a979debd59ea1b6b11.zip
gdb-4674ecfcf4045b3a3d81a4a979debd59ea1b6b11.tar.gz
gdb-4674ecfcf4045b3a3d81a4a979debd59ea1b6b11.tar.bz2
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.cc')
-rw-r--r--gold/plugin.cc33
1 files changed, 8 insertions, 25 deletions
diff --git a/gold/plugin.cc b/gold/plugin.cc
index 1b0eb01..9056a3b 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -85,31 +85,13 @@ void
Plugin::load()
{
#ifdef ENABLE_PLUGINS
- std::string filename;
- std::vector<std::string> args;
-
- // Parse the filename and arguments, each separated by commas.
- // FIXME: Temporarily allowing semicolon as an argument separator
- // so args can be passed through gcc's -Wl,... option, which
- // breaks arguments at the commas.
- const char* p = this->args_;
- int n = strcspn(p, ",;");
- filename.assign(p, n);
- p += n;
- while (*p == ',' || *p == ';')
- {
- ++p;
- n = strcspn(p, ",;");
- args.push_back(std::string(p, n));
- p += n;
- }
-
// Load the plugin library.
// FIXME: Look for the library in standard locations.
- this->handle_ = dlopen(filename.c_str(), RTLD_NOW);
+ this->handle_ = dlopen(this->filename_.c_str(), RTLD_NOW);
if (this->handle_ == NULL)
{
- gold_error(_("%s: could not load plugin library"), filename.c_str());
+ gold_error(_("%s: could not load plugin library"),
+ this->filename_.c_str());
return;
}
@@ -118,7 +100,8 @@ Plugin::load()
(dlsym(this->handle_, "onload"));
if (onload == NULL)
{
- gold_error(_("%s: could not find onload entry point"), filename.c_str());
+ gold_error(_("%s: could not find onload entry point"),
+ this->filename_.c_str());
return;
}
@@ -130,7 +113,7 @@ Plugin::load()
// Allocate and populate a transfer vector.
const int tv_fixed_size = 11;
- int tv_size = args.size() + tv_fixed_size;
+ int tv_size = this->args_.size() + tv_fixed_size;
ld_plugin_tv *tv = new ld_plugin_tv[tv_size];
int i = 0;
@@ -150,11 +133,11 @@ Plugin::load()
else
tv[i].tv_u.tv_val = LDPO_EXEC;
- for (unsigned int j = 0; j < args.size(); ++j)
+ for (unsigned int j = 0; j < this->args_.size(); ++j)
{
++i;
tv[i].tv_tag = LDPT_OPTION;
- tv[i].tv_u.tv_string = args[j].c_str();
+ tv[i].tv_u.tv_string = this->args_[j].c_str();
}
++i;