aboutsummaryrefslogtreecommitdiff
path: root/gold/plugin.cc
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <respindola@mozilla.com>2010-06-21 21:21:25 +0000
committerRafael Ávila de Espíndola <respindola@mozilla.com>2010-06-21 21:21:25 +0000
commit42218b9f16a40780716d3ec5b817d3d44fbf4d2e (patch)
treedaa80a4703213d7613379142b6cafd7025ab0aa1 /gold/plugin.cc
parent75079b2b314a0c1a9a70a5786098559595f56c7c (diff)
downloadfsf-binutils-gdb-42218b9f16a40780716d3ec5b817d3d44fbf4d2e.zip
fsf-binutils-gdb-42218b9f16a40780716d3ec5b817d3d44fbf4d2e.tar.gz
fsf-binutils-gdb-42218b9f16a40780716d3ec5b817d3d44fbf4d2e.tar.bz2
2010-06-21 Rafael Espindola <espindola@google.com>
* fileread.cc (Input_file::find_fie): New (Input_file::open): Use Input_file::find_fie. * fileread.h (Input_file::find_fie): New * plugin.cc (set_extra_library_path): New. (Plugin::load): Add set_extra_library_path to the transfer vector. (Plugin_manager::set_extra_library_path): New. (Plugin_manager::add_input_file): Use the extra search path if set. (set_extra_library_path(): New. * plugin.h (Plugin_manager): Add set_extra_library_path and extra_search_path_. 2010-06-21 Rafael Espindola <espindola@google.com> * plugin-api.h (ld_plugin_set_extra_library_path): New. (ld_plugin_tag): Add LDPT_SET_EXTRA_LIBRARY_PATH. (ld_plugin_tv): Add tv_set_extra_library_path.
Diffstat (limited to 'gold/plugin.cc')
-rw-r--r--gold/plugin.cc34
1 files changed, 32 insertions, 2 deletions
diff --git a/gold/plugin.cc b/gold/plugin.cc
index 1c33b12..c9e55ef 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -81,6 +81,9 @@ static enum ld_plugin_status
add_input_library(const char *pathname);
static enum ld_plugin_status
+set_extra_library_path(const char *path);
+
+static enum ld_plugin_status
message(int level, const char *format, ...);
};
@@ -127,7 +130,7 @@ Plugin::load()
sscanf(ver, "%d.%d", &major, &minor);
// Allocate and populate a transfer vector.
- const int tv_fixed_size = 15;
+ const int tv_fixed_size = 16;
int tv_size = this->args_.size() + tv_fixed_size;
ld_plugin_tv *tv = new ld_plugin_tv[tv_size];
@@ -202,6 +205,10 @@ Plugin::load()
tv[i].tv_u.tv_add_input_library = add_input_library;
++i;
+ tv[i].tv_tag = LDPT_SET_EXTRA_LIBRARY_PATH;
+ tv[i].tv_u.tv_set_extra_library_path = set_extra_library_path;
+
+ ++i;
tv[i].tv_tag = LDPT_NULL;
tv[i].tv_u.tv_val = 0;
@@ -418,6 +425,15 @@ Plugin_manager::release_input_file(unsigned int handle)
return LDPS_OK;
}
+// Add a new library path.
+
+ld_plugin_status
+Plugin_manager::set_extra_library_path(const char *path)
+{
+ this->extra_search_path_ = std::string(path);
+ return LDPS_OK;
+}
+
// Add a new input file.
ld_plugin_status
@@ -427,7 +443,11 @@ Plugin_manager::add_input_file(const char *pathname, bool is_lib)
(is_lib
? Input_file_argument::INPUT_FILE_TYPE_LIBRARY
: Input_file_argument::INPUT_FILE_TYPE_FILE),
- "", false, this->options_);
+ (is_lib
+ ? this->extra_search_path_.c_str()
+ : ""),
+ false,
+ this->options_);
Input_argument* input_argument = new Input_argument(file);
Task_token* next_blocker = new Task_token(true);
next_blocker->add_blocker();
@@ -1038,6 +1058,16 @@ add_input_library(const char *pathname)
return parameters->options().plugins()->add_input_file(pathname, true);
}
+// Set the extra library path to be used by libraries added via
+// add_input_library
+
+static enum ld_plugin_status
+set_extra_library_path(const char *path)
+{
+ gold_assert(parameters->options().has_plugins());
+ return parameters->options().plugins()->set_extra_library_path(path);
+}
+
// Issue a diagnostic message from a plugin.
static enum ld_plugin_status