From e6f16d642a4a5a04f9e08e3998cc09e435d18671 Mon Sep 17 00:00:00 2001 From: Cary Coutant Date: Tue, 23 Dec 2008 02:02:20 +0000 Subject: * 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. --- gold/plugin.h | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'gold/plugin.h') diff --git a/gold/plugin.h b/gold/plugin.h index 5b6fa1fd34..20d416aac7 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_list; typedef std::vector Object_list; + typedef std::vector 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_; -- cgit v1.2.1