aboutsummaryrefslogtreecommitdiff
path: root/gold/ehframe.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2008-03-13 20:58:11 +0000
committerIan Lance Taylor <iant@google.com>2008-03-13 20:58:11 +0000
commit1d6531cfad3c386b17a44432c8d915f0147cb716 (patch)
treeaa06d3c971f940021205489831c611ed26d4db71 /gold/ehframe.cc
parent018f1beaa07e1ea906fde814c0f3b45b2a6f21f4 (diff)
downloadgdb-1d6531cfad3c386b17a44432c8d915f0147cb716.zip
gdb-1d6531cfad3c386b17a44432c8d915f0147cb716.tar.gz
gdb-1d6531cfad3c386b17a44432c8d915f0147cb716.tar.bz2
Don't crash if we change the address of the .eh_frame section after we
find its size.
Diffstat (limited to 'gold/ehframe.cc')
-rw-r--r--gold/ehframe.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/gold/ehframe.cc b/gold/ehframe.cc
index df94488..a3a24e5 100644
--- a/gold/ehframe.cc
+++ b/gold/ehframe.cc
@@ -487,7 +487,9 @@ Eh_frame::Eh_frame()
eh_frame_hdr_(NULL),
cie_offsets_(),
unmergeable_cie_offsets_(),
- merge_map_()
+ merge_map_(),
+ mappings_are_done_(false),
+ final_data_size_(0)
{
}
@@ -1011,6 +1013,15 @@ Eh_frame::fde_count() const
void
Eh_frame::set_final_data_size()
{
+ // We can be called more than once if Layout::set_segment_offsets
+ // finds a better mapping. We don't want to add all the mappings
+ // again.
+ if (this->mappings_are_done_)
+ {
+ this->set_data_size(this->final_data_size_);
+ return;
+ }
+
section_offset_type output_offset = 0;
for (Unmergeable_cie_offsets::iterator p =
@@ -1028,6 +1039,9 @@ Eh_frame::set_final_data_size()
this->addralign(),
&this->merge_map_);
+ this->mappings_are_done_ = true;
+ this->final_data_size_ = output_offset;
+
gold_assert((output_offset & (this->addralign() - 1)) == 0);
this->set_data_size(output_offset);
}