+2010-11-05 Cary Coutant <ccoutant@google.com>
+
+ 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.
+
2010-11-03 Nick Clifton <nickc@redhat.com>
PR gold/12001
bool is_ordinary;
unsigned int shndx = sym->shndx(&is_ordinary);
gold_assert(is_ordinary);
- typename elfcpp::Elf_types<size>::Elf_WXword addralign =
- sym->object()->section_addralign(shndx);
+ typename elfcpp::Elf_types<size>::Elf_WXword addralign;
+
+ {
+ // Lock the object so we can read from it. This is only called
+ // single-threaded from scan_relocs, 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);
+ Object* obj = sym->object();
+ Task_lock_obj<Object> tl(dummy_task, obj);
+ addralign = obj->section_addralign(shndx);
+ }
typename Sized_symbol<size>::Value_type value = sym->value();
while ((value & (addralign - 1)) != 0)
p != input_objects->relobj_end();
++p)
{
+ Task_lock_obj<Object> tlo(task, *p);
(*p)->layout(symtab, layout, NULL);
}
}
section_size_type plen;
if (section_contents == NULL)
{
+ // 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, secn.first);
const unsigned char* contents;
contents = secn.first->section_contents(secn.second,
&plen,
if (first_iteration)
{
+ // 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, secn.first);
contents = secn.first->section_contents(secn.second,
&plen,
false);
if (!first_iteration)
continue;
+ // 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, it_v->first);
+
uint64_t secn_flags = (it_v->first)->section_flags(it_v->second);
// This reloc points to a merge section. Hash the
// contents of this section.
p != input_objects->relobj_end();
++p)
{
+ // 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, *p);
+
for (unsigned int i = 0;i < (*p)->shnum(); ++i)
{
const char* section_name = (*p)->section_name(i).c_str();
++p)
{
Relobj* relobj = *p;
+ // Lock the object so we can read from it. This is only called
+ // single-threaded from Layout_task_runner, 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, relobj);
+
unsigned int shnum = relobj->shnum();
for (unsigned int i = 0; i < shnum; ++i)
{
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.