summaryrefslogtreecommitdiff
path: root/gold/ehframe.cc
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.cc
parent918229560ce9db307532592047066eac0674190d (diff)
downloadbinutils-gdb-7cdd7d57e6fa3932eb63aa785ae0e3fa837aab20.tar.gz
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.cc')
-rw-r--r--gold/ehframe.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/gold/ehframe.cc b/gold/ehframe.cc
index 08a9ec6bd17..be262bffad3 100644
--- a/gold/ehframe.cc
+++ b/gold/ehframe.cc
@@ -84,7 +84,8 @@ Eh_frame_hdr::Eh_frame_hdr(Output_section* eh_frame_section,
eh_frame_section_(eh_frame_section),
eh_frame_data_(eh_frame_data),
fde_offsets_(),
- any_unrecognized_eh_frame_sections_(false)
+ any_unrecognized_eh_frame_sections_(false),
+ lock_(NULL)
{
}
@@ -102,6 +103,9 @@ Eh_frame_hdr::set_final_data_size()
this->fde_offsets_.reserve(fde_count);
}
this->set_data_size(data_size);
+ // We need a lock for updating the fde_offsets_ vector while writing
+ // the FDEs.
+ this->lock_ = new Lock();
}
// Write the data to the file.