aboutsummaryrefslogtreecommitdiff
path: root/gold/plugin.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2009-10-28 18:07:25 +0000
committerCary Coutant <ccoutant@google.com>2009-10-28 18:07:25 +0000
commit40f36857fe3640c0d8dd96b2e36527ffc7f7d954 (patch)
tree241ff081e28d4b13dff85b4aa022343712b0a492 /gold/plugin.cc
parent7aee19a1c49ad1ec97080e6f34715b625b6a43c1 (diff)
downloadfsf-binutils-gdb-40f36857fe3640c0d8dd96b2e36527ffc7f7d954.zip
fsf-binutils-gdb-40f36857fe3640c0d8dd96b2e36527ffc7f7d954.tar.gz
fsf-binutils-gdb-40f36857fe3640c0d8dd96b2e36527ffc7f7d954.tar.bz2
* plugin.h (Plugin::Plugin): Initialize cleanup_done_.
(Plugin::cleanup_done_): New member. (Plugin_manager::Plugin_manager): Remove cleanup_done_. (Plugin_manager::cleanup_done_): Remove. (Plugin_manager::add_input_file): Edit error message. * plugin.cc (Plugin::cleanup): Test and set cleanup_done_. (Plugin_manager::cleanup): Remove use of cleanup_done_.
Diffstat (limited to 'gold/plugin.cc')
-rw-r--r--gold/plugin.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/gold/plugin.cc b/gold/plugin.cc
index ed334ab..317fb7d 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -238,8 +238,14 @@ Plugin::all_symbols_read()
inline void
Plugin::cleanup()
{
- if (this->cleanup_handler_ != NULL)
- (*this->cleanup_handler_)();
+ if (this->cleanup_handler_ != NULL && !this->cleanup_done_)
+ {
+ // Set this flag before calling to prevent a recursive plunge
+ // in the event that a plugin's cleanup handler issues a
+ // fatal error.
+ this->cleanup_done_ = true;
+ (*this->cleanup_handler_)();
+ }
}
// Plugin_manager methods.
@@ -350,13 +356,10 @@ Plugin_manager::layout_deferred_objects()
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
@@ -423,8 +426,8 @@ Plugin_manager::add_input_file(char *pathname, bool is_lib)
Task_token* next_blocker = new Task_token(true);
next_blocker->add_blocker();
if (this->layout_->incremental_inputs())
- gold_error(_("Input files added by plug-ins in --incremental mode not "
- "supported yet.\n"));
+ gold_error(_("input files added by plug-ins in --incremental mode not "
+ "supported yet"));
this->workqueue_->queue_soon(new Read_symbols(this->input_objects_,
this->symtab_,
this->layout_,