This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 4/6] gold: Fix empty string alignment in .rodata.str*
- From: Marcin KoÅcielnicki <koriakin at 0x04 dot net>
- To: binutils at sourceware dot org
- Cc: Marcin KoÅcielnicki <koriakin at 0x04 dot net>
- Date: Mon, 5 Oct 2015 16:57:14 +0200
- Subject: [PATCH 4/6] gold: Fix empty string alignment in .rodata.str*
- Authentication-results: sourceware.org; auth=none
- References: <55F75B12 dot 8080704 at 0x04 dot net> <1444057036-12237-1-git-send-email-koriakin at 0x04 dot net>
Fixes #18959
---
gold/stringpool.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gold/stringpool.cc b/gold/stringpool.cc
index d6fd715..168c10a 100644
--- a/gold/stringpool.cc
+++ b/gold/stringpool.cc
@@ -228,9 +228,8 @@ Stringpool_template<Stringpool_char>::new_key_offset(size_t length)
else
{
offset = this->offset_;
- // Align non-zero length strings.
- if (length != 0)
- offset = align_address(offset, this->addralign_);
+ // Align strings.
+ offset = align_address(offset, this->addralign_);
this->offset_ = offset + (length + 1) * sizeof(Stringpool_char);
}
this->key_to_offset_.push_back(offset);
@@ -421,6 +420,7 @@ Stringpool_template<Stringpool_char>::set_string_offsets()
if (this->zero_null_ && (*curr)->first.string[0] == 0)
this_offset = 0;
else if (last != v.end()
+ && ((*curr)->first.length - (*last)->first.length) % this->addralign_ == 0
&& is_suffix((*curr)->first.string,
(*curr)->first.length,
(*last)->first.string,
--
2.5.3