aboutsummaryrefslogtreecommitdiff
path: root/gold/ehframe.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2013-10-11 14:12:16 -0700
committerCary Coutant <ccoutant@google.com>2013-11-14 10:33:36 -0800
commit7cdd7d57e6fa3932eb63aa785ae0e3fa837aab20 (patch)
tree4e130cceefd5f2295ed39b574a4d43bea1567f23 /gold/ehframe.h
parent918229560ce9db307532592047066eac0674190d (diff)
downloadgdb-7cdd7d57e6fa3932eb63aa785ae0e3fa837aab20.zip
gdb-7cdd7d57e6fa3932eb63aa785ae0e3fa837aab20.tar.gz
gdb-7cdd7d57e6fa3932eb63aa785ae0e3fa837aab20.tar.bz2
Fix race condition while building EH frame header.
gold/ PR gold/14860 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_. (Ehframe_hdr::set_final_data_size): Allocate a Lock. * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while updating fde_offsets_. (Eh_frame_hdr::lock_): New data member.
Diffstat (limited to 'gold/ehframe.h')
-rw-r--r--gold/ehframe.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/gold/ehframe.h b/gold/ehframe.h
index 8aab8b8..d5ac668 100644
--- a/gold/ehframe.h
+++ b/gold/ehframe.h
@@ -60,7 +60,10 @@ class Eh_frame_hdr : public Output_section_data
record_fde(section_offset_type fde_offset, unsigned char fde_encoding)
{
if (!this->any_unrecognized_eh_frame_sections_)
- this->fde_offsets_.push_back(std::make_pair(fde_offset, fde_encoding));
+ {
+ Hold_lock(*this->lock_);
+ this->fde_offsets_.push_back(std::make_pair(fde_offset, fde_encoding));
+ }
}
protected:
@@ -157,6 +160,8 @@ class Eh_frame_hdr : public Output_section_data
// Whether we found any .eh_frame sections which we could not
// process.
bool any_unrecognized_eh_frame_sections_;
+ // Lock held while updating fde_offsets_.
+ Lock* lock_;
};
// This class holds an FDE.