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 | c0873094f582f8dffda7eaea2ea21bd87f351570 (patch) | |
tree | b080a2190a75cc4a90bfaa40ab6b158636aa858b /gold/merge.cc | |
parent | 2353d21439630f851ce2c38ed5f41973562c804a (diff) | |
download | gdb-c0873094f582f8dffda7eaea2ea21bd87f351570.zip gdb-c0873094f582f8dffda7eaea2ea21bd87f351570.tar.gz gdb-c0873094f582f8dffda7eaea2ea21bd87f351570.tar.bz2 |
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 65acf82..2c76759 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(); |