PR gold/10708

* copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
	object when reading from the file.
	* gold.cc (queue_middle_tasks): Hold a lock on the object when doing
	second layout pass.
	* icf.cc (preprocess_for_unique_sections): Hold a lock on the object
	when reading section contents.
	(get_section_contents): Likewise.
	(icf::find_identical_sections): Likewise.
	* mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
	object when reading from the file.
	* plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
	the object when doing deferred section layout.
This commit is contained in:
Cary Coutant
2010-11-05 21:14:33 +00:00
parent 8baf536a5a
commit 5f9bcf5825
6 changed files with 64 additions and 3 deletions

View File

@@ -361,7 +361,14 @@ Plugin_manager::layout_deferred_objects()
for (obj = this->deferred_layout_objects_.begin();
obj != this->deferred_layout_objects_.end();
++obj)
(*obj)->layout_deferred_sections(this->layout_);
{
// Lock the object so we can read from it. This is only called
// single-threaded from queue_middle_tasks, so it is OK to lock.
// Unfortunately we have no way to pass in a Task token.
const Task* dummy_task = reinterpret_cast<const Task*>(-1);
Task_lock_obj<Object> tl(dummy_task, *obj);
(*obj)->layout_deferred_sections(this->layout_);
}
}
// Call the cleanup handlers.