aboutsummaryrefslogtreecommitdiff
path: root/gold/plugin.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2008-12-23 02:02:20 +0000
committerCary Coutant <ccoutant@google.com>2008-12-23 02:02:20 +0000
commit5995b57073ad5990e2f63c7f65c0a6c27cad55a9 (patch)
tree9748f0e3d8e6651b0446acc2556b3083887d7606 /gold/plugin.h
parentbce3bbcb768f893debb22320380b25e34547c8c6 (diff)
downloadgdb-5995b57073ad5990e2f63c7f65c0a6c27cad55a9.zip
gdb-5995b57073ad5990e2f63c7f65c0a6c27cad55a9.tar.gz
gdb-5995b57073ad5990e2f63c7f65c0a6c27cad55a9.tar.bz2
* object.cc (Sized_relobj::layout_section): New function.
(Sized_relobj::do_layout): Defer layout of input sections until after plugin has provided replacement files. (Sized_relobj::do_layout_deferred_sections): New function. * object.h (Relobj::set_section_offset): Remove virtual keyword. (Relobj::layout_deferred_sections): New function. (Relobj::do_layout_deferred_sections): New function. (Sized_relobj::do_layout_deferred_sections): New function. (Sized_relobj::layout_section): New function. (Sized_relobj::Deferred_layout): New structure. (Sized_relobj::deferred_layout_): New field. * plugin.cc (Plugin_manager::finish): Renamed, was cleanup. Change all callers. Layout deferred sections. (class Plugin_finish): Renamed, was Plugin_cleanup. Change all references. (Plugin_hook::run): Move code from do_plugin_hook inline. (Plugin_hook::do_plugin_hook): Remove. * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers. (Plugin_manager::finish): Renamed, was cleanup. (Plugin_manager::should_defer_layout): New function. (Plugin_manager::add_deferred_layout_object): New function. (Plugin_manager::Deferred_layout_list): New type. (Plugin_manager::deferred_layout_objects_): New field. (Plugin_hook::do_plugin_hook): Remove.
Diffstat (limited to 'gold/plugin.h')
-rw-r--r--gold/plugin.h28
1 files changed, 21 insertions, 7 deletions
diff --git a/gold/plugin.h b/gold/plugin.h
index 5b6fa1f..20d416a 100644
--- a/gold/plugin.h
+++ b/gold/plugin.h
@@ -120,7 +120,8 @@ class Plugin_manager
{
public:
Plugin_manager(const General_options& options)
- : plugins_(), in_replacement_phase_(false), options_(options),
+ : plugins_(), objects_(), deferred_layout_objects_(), input_file_(NULL),
+ plugin_input_file_(), in_replacement_phase_(false), options_(options),
workqueue_(NULL), input_objects_(NULL), symtab_(NULL), layout_(NULL),
dirpath_(NULL), mapfile_(NULL), this_blocker_(NULL)
{ this->current_ = plugins_.end(); }
@@ -154,9 +155,9 @@ class Plugin_manager
Symbol_table* symtab, Layout* layout, Dirsearch* dirpath,
Mapfile* mapfile, Task_token** last_blocker);
- // Call the cleanup handlers.
+ // Run deferred layout and call the cleanup handlers.
void
- cleanup();
+ finish();
// Register a claim-file handler.
void
@@ -196,6 +197,19 @@ class Plugin_manager
return this->objects_[handle];
}
+ // Return TRUE if any input files have been claimed by a plugin
+ // and we are still in the initial input phase.
+ bool
+ should_defer_layout() const
+ { return !this->objects_.empty() && !this->in_replacement_phase_; }
+
+ // Add a regular object to the deferred layout list. These are
+ // objects whose layout has been deferred until after the
+ // replacement files have arrived.
+ void
+ add_deferred_layout_object(Relobj* obj)
+ { this->deferred_layout_objects_.push_back(obj); }
+
// Add a new input file.
ld_plugin_status
add_input_file(char *pathname);
@@ -211,6 +225,7 @@ class Plugin_manager
typedef std::list<Plugin*> Plugin_list;
typedef std::vector<Pluginobj*> Object_list;
+ typedef std::vector<Relobj*> Deferred_layout_list;
// The list of plugin libraries.
Plugin_list plugins_;
@@ -221,6 +236,9 @@ class Plugin_manager
// serves as the "handle" that we pass to the plugins.
Object_list objects_;
+ // The list of regular objects whose layout has been deferred.
+ Deferred_layout_list deferred_layout_objects_;
+
// The file currently up for claim by the plugins.
Input_file* input_file_;
struct ld_plugin_input_file plugin_input_file_;
@@ -456,10 +474,6 @@ class Plugin_hook : public Task
{ return "Plugin_hook"; }
private:
- // Call the plugin hook.
- void
- do_plugin_hook(Workqueue*);
-
const General_options& options_;
Input_objects* input_objects_;
Symbol_table* symtab_;