diff options
author | Cary Coutant <ccoutant@google.com> | 2010-11-05 21:14:33 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2010-11-05 21:14:33 +0000 |
commit | 5f9bcf5825f56b017aacf20aaabce0ed07920454 (patch) | |
tree | 1aaf51098dae857ffd0ef4f6ced0f832257d15a6 /gold/copy-relocs.cc | |
parent | 8baf536a5a90596ba9b85da65246645321df0823 (diff) | |
download | gdb-5f9bcf5825f56b017aacf20aaabce0ed07920454.zip gdb-5f9bcf5825f56b017aacf20aaabce0ed07920454.tar.gz gdb-5f9bcf5825f56b017aacf20aaabce0ed07920454.tar.bz2 |
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.
Diffstat (limited to 'gold/copy-relocs.cc')
-rw-r--r-- | gold/copy-relocs.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gold/copy-relocs.cc b/gold/copy-relocs.cc index ed8002f..4931aa0 100644 --- a/gold/copy-relocs.cc +++ b/gold/copy-relocs.cc @@ -125,8 +125,17 @@ Copy_relocs<sh_type, size, big_endian>::emit_copy_reloc( 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) |