From b39b8b9d90e142179709e846c15afdebd49b0fb1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Wed, 4 Feb 2015 17:37:05 -0500 Subject: [PATCH] Combine loop epilogue into main loop body to reduce duplication. --- gold/ChangeLog | 5 +++++ gold/merge.cc | 15 ++------------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index a7deb77..73ee43e 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,8 @@ +2015-02-04 Rafael Ávila de Espíndola + + * merge.cc (do_add_input_section): Combine loop epilogue into main loop + body. + 2015-02-04 Peter Collingbourne * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve diff --git a/gold/merge.cc b/gold/merge.cc index 269e6bf..f547388 100644 --- a/gold/merge.cc +++ b/gold/merge.cc @@ -564,9 +564,9 @@ Output_merge_string::do_add_input_section(Relobj* object, & (this->addralign() - 1)); bool has_misaligned_strings = false; - while (p < pend0) + while (p < pend) { - size_t len = string_length(p); + size_t len = p < pend0 ? string_length(p) : pend - p; // Within merge input section each string must be aligned. if (len != 0 @@ -581,17 +581,6 @@ Output_merge_string::do_add_input_section(Relobj* object, p += len + 1; i += (len + 1) * sizeof(Char_type); } - if (p < pend) - { - size_t len = pend - p; - - Stringpool::Key key; - this->stringpool_.add_with_length(p, len, true, &key); - - merged_strings.push_back(Merged_string(i, key)); - - i += (len + 1) * sizeof(Char_type); - } // Record the last offset in the input section so that we can // compute the length of the last string. -- 2.7.4