diff options
author | Ian Lance Taylor <iant@google.com> | 2007-12-19 00:29:28 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2007-12-19 00:29:28 +0000 |
commit | 34b61495afbc2776d99de6dc6ed7497635e68926 (patch) | |
tree | caac89c0e8ae8cc1f5ee5b7fb3e9e9c5085654b3 /gold/merge.cc | |
parent | 4b9a4b0cb9af657bb0d374ef4a271492bfc46d9b (diff) | |
download | binutils-redhat-34b61495afbc2776d99de6dc6ed7497635e68926.tar.gz |
Use string length when available when calling Stringpool. Compare
pointers first when looking up Stringpool entries.
Diffstat (limited to 'gold/merge.cc')
-rw-r--r-- | gold/merge.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gold/merge.cc b/gold/merge.cc index 65acf82721..2c76759db6 100644 --- a/gold/merge.cc +++ b/gold/merge.cc @@ -520,7 +520,8 @@ Output_merge_string<Char_type>::do_add_input_section(Relobj* object, } } - const Char_type* str = this->stringpool_.add_prefix(p, pl - p, NULL); + const Char_type* str = this->stringpool_.add_with_length(p, pl - p, true, + NULL); section_size_type bytelen_with_null = ((pl - p) + 1) * sizeof(Char_type); this->merged_strings_.push_back(Merged_string(object, shndx, i, str, @@ -549,8 +550,13 @@ Output_merge_string<Char_type>::finalize_merged_data() this->merged_strings_.begin(); p != this->merged_strings_.end(); ++p) - this->add_mapping(p->object, p->shndx, p->offset, p->length, - this->stringpool_.get_offset(p->string)); + { + size_t charlen_without_null = (p->length / sizeof(Char_type)) - 1; + section_offset_type offset = + this->stringpool_.get_offset_with_length(p->string, + charlen_without_null); + this->add_mapping(p->object, p->shndx, p->offset, p->length, offset); + } // Save some memory. this->merged_strings_.clear(); |