forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -80,6 +80,9 @@ add_input_file(const char *pathname);
|
||||
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];
|
||||
|
||||
@@ -201,6 +204,10 @@ Plugin::load()
|
||||
tv[i].tv_tag = LDPT_ADD_INPUT_LIBRARY;
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user