diff options
author | Evgeniy Dushistov <dushistov@mail.ru> | 2014-11-07 16:12:58 -0800 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2014-11-07 16:12:58 -0800 |
commit | d37ffe2537a2ec5a22abfaad316a640a40cccda1 (patch) | |
tree | 98f069f1e66350e7afa5383a91ecc46a667c1d6a /gold/plugin.cc | |
parent | 8ee35f2ab5f91c7a558009ff9ba341dc7133ef4c (diff) | |
download | gdb-d37ffe2537a2ec5a22abfaad316a640a40cccda1.zip gdb-d37ffe2537a2ec5a22abfaad316a640a40cccda1.tar.gz gdb-d37ffe2537a2ec5a22abfaad316a640a40cccda1.tar.bz2 |
Fix race condition when using --threads with linker plugins.
2014-11-06 Evgeniy Dushistov <dushistov@mail.ru>
gold/
* plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
* plugin.h: add lock definition
Diffstat (limited to 'gold/plugin.cc')
-rw-r--r-- | gold/plugin.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gold/plugin.cc b/gold/plugin.cc index 0339d42..4b0f3cf 100644 --- a/gold/plugin.cc +++ b/gold/plugin.cc @@ -427,6 +427,7 @@ Plugin_manager::~Plugin_manager() ++obj) delete *obj; this->objects_.clear(); + delete this->lock_; } // Load all plugin libraries. @@ -447,6 +448,10 @@ Pluginobj* Plugin_manager::claim_file(Input_file* input_file, off_t offset, off_t filesize, Object* elf_object) { + bool lock_initialized = this->initialize_lock_.initialize(); + + gold_assert(lock_initialized); + Hold_lock hl(*this->lock_); if (this->in_replacement_phase_) return NULL; |