Line 129... |
Line 129... |
public:
|
public:
|
Plugin_manager(const General_options& options)
|
Plugin_manager(const General_options& options)
|
: plugins_(), objects_(), deferred_layout_objects_(), input_file_(NULL),
|
: plugins_(), objects_(), deferred_layout_objects_(), input_file_(NULL),
|
plugin_input_file_(), rescannable_(), undefined_symbols_(),
|
plugin_input_file_(), rescannable_(), undefined_symbols_(),
|
any_claimed_(false), in_replacement_phase_(false), any_added_(false),
|
any_claimed_(false), in_replacement_phase_(false), any_added_(false),
|
|
in_claim_file_handler_(false),
|
options_(options), workqueue_(NULL), task_(NULL), input_objects_(NULL),
|
options_(options), workqueue_(NULL), task_(NULL), input_objects_(NULL),
|
symtab_(NULL), layout_(NULL), dirpath_(NULL), mapfile_(NULL),
|
symtab_(NULL), layout_(NULL), dirpath_(NULL), mapfile_(NULL),
|
this_blocker_(NULL), extra_search_path_()
|
this_blocker_(NULL), extra_search_path_()
|
{ this->current_ = plugins_.end(); }
|
{ this->current_ = plugins_.end(); }
|
|
|
Line 151... |
Line 152... |
last->add_option(opt);
|
last->add_option(opt);
|
}
|
}
|
|
|
// Load all plugin libraries.
|
// Load all plugin libraries.
|
void
|
void
|
load_plugins();
|
load_plugins(Layout* layout);
|
|
|
// Call the plugin claim-file handlers in turn to see if any claim the file.
|
// Call the plugin claim-file handlers in turn to see if any claim the file.
|
Pluginobj*
|
Pluginobj*
|
claim_file(Input_file* input_file, off_t offset, off_t filesize);
|
claim_file(Input_file* input_file, off_t offset, off_t filesize,
|
|
Object* elf_object);
|
|
|
|
// Get the object associated with the handle and check if it is an elf object.
|
|
// If it is not a Pluginobj, it is an elf object.
|
|
Object*
|
|
get_elf_object(const void* handle);
|
|
|
|
// True if the claim_file handler of the plugins is being called.
|
|
bool
|
|
in_claim_file_handler()
|
|
{ return in_claim_file_handler_; }
|
|
|
// Let the plugin manager save an archive for later rescanning.
|
// Let the plugin manager save an archive for later rescanning.
|
// This takes ownership of the Archive pointer.
|
// This takes ownership of the Archive pointer.
|
void
|
void
|
save_archive(Archive*);
|
save_archive(Archive*);
|
Line 171... |
Line 183... |
|
|
// Call the all-symbols-read handlers.
|
// Call the all-symbols-read handlers.
|
void
|
void
|
all_symbols_read(Workqueue* workqueue, Task* task,
|
all_symbols_read(Workqueue* workqueue, Task* task,
|
Input_objects* input_objects, Symbol_table* symtab,
|
Input_objects* input_objects, Symbol_table* symtab,
|
Layout* layout, Dirsearch* dirpath, Mapfile* mapfile,
|
Dirsearch* dirpath, Mapfile* mapfile,
|
Task_token** last_blocker);
|
Task_token** last_blocker);
|
|
|
// Tell the plugin manager that we've a new undefined symbol which
|
// Tell the plugin manager that we've a new undefined symbol which
|
// may require rescanning.
|
// may require rescanning.
|
void
|
void
|
Line 216... |
Line 228... |
// Make a new Pluginobj object. This is called when the plugin calls
|
// Make a new Pluginobj object. This is called when the plugin calls
|
// the add_symbols API.
|
// the add_symbols API.
|
Pluginobj*
|
Pluginobj*
|
make_plugin_object(unsigned int handle);
|
make_plugin_object(unsigned int handle);
|
|
|
// Return the Pluginobj associated with the given HANDLE.
|
// Return the object associated with the given HANDLE.
|
Pluginobj*
|
Object*
|
object(unsigned int handle) const
|
object(unsigned int handle) const
|
{
|
{
|
if (handle >= this->objects_.size())
|
if (handle >= this->objects_.size())
|
return NULL;
|
return NULL;
|
return this->objects_[handle];
|
return this->objects_[handle];
|
Line 263... |
Line 275... |
// Return TRUE if we are in the replacement phase.
|
// Return TRUE if we are in the replacement phase.
|
bool
|
bool
|
in_replacement_phase() const
|
in_replacement_phase() const
|
{ return this->in_replacement_phase_; }
|
{ return this->in_replacement_phase_; }
|
|
|
|
Input_objects*
|
|
input_objects() const
|
|
{ return this->input_objects_; }
|
|
|
|
Layout*
|
|
layout()
|
|
{ return this->layout_; }
|
|
|
private:
|
private:
|
Plugin_manager(const Plugin_manager&);
|
Plugin_manager(const Plugin_manager&);
|
Plugin_manager& operator=(const Plugin_manager&);
|
Plugin_manager& operator=(const Plugin_manager&);
|
|
|
// Plugin_rescan is a Task which calls the private rescan method.
|
// Plugin_rescan is a Task which calls the private rescan method.
|
Line 291... |
Line 311... |
: is_archive(false)
|
: is_archive(false)
|
{ this->u.input_group = input_group; }
|
{ this->u.input_group = input_group; }
|
};
|
};
|
|
|
typedef std::list<Plugin*> Plugin_list;
|
typedef std::list<Plugin*> Plugin_list;
|
typedef std::vector<Pluginobj*> Object_list;
|
typedef std::vector<Object*> Object_list;
|
typedef std::vector<Relobj*> Deferred_layout_list;
|
typedef std::vector<Relobj*> Deferred_layout_list;
|
typedef std::vector<Rescannable> Rescannable_list;
|
typedef std::vector<Rescannable> Rescannable_list;
|
typedef std::vector<Symbol*> Undefined_symbol_list;
|
typedef std::vector<Symbol*> Undefined_symbol_list;
|
|
|
// Rescan archives for undefined symbols.
|
// Rescan archives for undefined symbols.
|
Line 338... |
Line 358... |
bool in_replacement_phase_;
|
bool in_replacement_phase_;
|
|
|
// Whether any input files or libraries were added by a plugin.
|
// Whether any input files or libraries were added by a plugin.
|
bool any_added_;
|
bool any_added_;
|
|
|
|
// Set to true when the claim_file handler of a plugin is called.
|
|
bool in_claim_file_handler_;
|
|
|
const General_options& options_;
|
const General_options& options_;
|
Workqueue* workqueue_;
|
Workqueue* workqueue_;
|
Task* task_;
|
Task* task_;
|
Input_objects* input_objects_;
|
Input_objects* input_objects_;
|
Symbol_table* symtab_;
|
Symbol_table* symtab_;
|