aboutsummaryrefslogtreecommitdiff
path: root/gold/plugin.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2008-12-24 06:17:18 +0000
committerCary Coutant <ccoutant@google.com>2008-12-24 06:17:18 +0000
commit483620e86f09fcb4bc923c9f4b0c211e10efd334 (patch)
tree2e24f24e6eee98a246bb3da678e6348a31309549 /gold/plugin.cc
parent7fe893f8f0c0e1964745aa2b2f8dab5babe173e9 (diff)
downloadgdb-483620e86f09fcb4bc923c9f4b0c211e10efd334.zip
gdb-483620e86f09fcb4bc923c9f4b0c211e10efd334.tar.gz
gdb-483620e86f09fcb4bc923c9f4b0c211e10efd334.tar.bz2
* gold.cc (gold_exit): Call plugin cleanup handlers on exit.
* plugin.cc (Plugin_manager::finish): Rename as layout_deferred_objects. Move cleanup to separate function. (Plugin_manager::cleanup): New function. (Plugin_finish::run): Call layout_deferred_objects and cleanup separately. * plugin.h (Plugin_manager::finish): Rename as layout_deferred_objects. (Plugin_manager::cleanup): New function. (Plugin_manager::cleanup_done): New field.
Diffstat (limited to 'gold/plugin.cc')
-rw-r--r--gold/plugin.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/gold/plugin.cc b/gold/plugin.cc
index c624ef1..e2a9e60 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -306,10 +306,10 @@ Plugin_manager::all_symbols_read(Workqueue* workqueue,
*last_blocker = this->this_blocker_;
}
-// Layout deferred sections and call the cleanup handlers.
+// Layout deferred objects.
void
-Plugin_manager::finish()
+Plugin_manager::layout_deferred_objects()
{
Deferred_layout_list::iterator obj;
@@ -317,11 +317,20 @@ Plugin_manager::finish()
obj != this->deferred_layout_objects_.end();
++obj)
(*obj)->layout_deferred_sections(this->layout_);
+}
+
+// Call the cleanup handlers.
+void
+Plugin_manager::cleanup()
+{
+ if (this->cleanup_done_)
+ return;
for (this->current_ = this->plugins_.begin();
this->current_ != this->plugins_.end();
++this->current_)
(*this->current_)->cleanup();
+ this->cleanup_done_ = true;
}
// Make a new Pluginobj object. This is called when the plugin calls
@@ -766,7 +775,12 @@ class Plugin_finish : public Task
void
run(Workqueue*)
- { parameters->options().plugins()->finish(); }
+ {
+ Plugin_manager* plugins = parameters->options().plugins();
+ gold_assert(plugins != NULL);
+ plugins->layout_deferred_objects();
+ plugins->cleanup();
+ }
std::string
get_name() const