aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2010-04-09 00:04:30 +0000
committerDoug Kwan <dougkwan@google.com>2010-04-09 00:04:30 +0000
commit6bf924b0ab37b8fd62d11262e93f34902ed5e457 (patch)
tree8ffd987c75364592ecd5eb45c4192ec315bbaba6 /gold/merge.cc
parentdaily update (diff)
downloadbinutils-gdb-6bf924b0ab37b8fd62d11262e93f34902ed5e457.tar.gz
binutils-gdb-6bf924b0ab37b8fd62d11262e93f34902ed5e457.tar.bz2
binutils-gdb-6bf924b0ab37b8fd62d11262e93f34902ed5e457.zip
2010-04-08 Doug Kwan <dougkwan@google.com>
* merge.cc (Output_merge_data::set_final_data_size): Handle empty Output_merge_data. * output.cc (Output_section::add_merge_input_section): Simplify code and return status of Output_merge_base::add_input_section. Update merge section map only if Output_merge_base::add_input_section returns true.
Diffstat (limited to 'gold/merge.cc')
-rw-r--r--gold/merge.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/gold/merge.cc b/gold/merge.cc
index 3d9692124a0..e2b6eef2f7a 100644
--- a/gold/merge.cc
+++ b/gold/merge.cc
@@ -425,7 +425,10 @@ Output_merge_data::set_final_data_size()
{
// Release the memory we don't need.
this->p_ = static_cast<unsigned char*>(realloc(this->p_, this->len_));
- gold_assert(this->p_ != NULL);
+ // An Output_merge_data object may be empty and realloc is allowed
+ // to return a NULL pointer in this case. An Output_merge_data is empty
+ // if all its input sections have sizes that are not multiples of entsize.
+ gold_assert(this->p_ != NULL || this->len_ == 0);
this->set_data_size(this->len_);
}