aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Kościelnicki <koriakin@0x04.net>2015-10-05 16:57:14 +0200
committerCary Coutant <ccoutant@gmail.com>2015-10-28 16:48:16 -0700
commita817ff49c331c180f5b75cff4da1c338366c5d4e (patch)
tree86024dba164a84e36885dc1d7f375b6a4a47e938
parente79a4bad70029595e43cc536c0d1e60d5d6ee115 (diff)
downloadgdb-a817ff49c331c180f5b75cff4da1c338366c5d4e.zip
gdb-a817ff49c331c180f5b75cff4da1c338366c5d4e.tar.gz
gdb-a817ff49c331c180f5b75cff4da1c338366c5d4e.tar.bz2
Fix empty string alignment in .rodata.str*
gold/ PR gold/18959 * stringpool.cc (Stringpool_template::new_key_offset): Align all strings, even zero-length. (Stringpool_template::set_string_offsets):
-rw-r--r--gold/ChangeLog7
-rw-r--r--gold/stringpool.cc7
2 files changed, 11 insertions, 3 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 23d64ed..71bee61 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,5 +1,12 @@
2015-10-28 Marcin Kościelnicki <koriakin@0x04.net>
+ PR gold/18959
+ * stringpool.cc (Stringpool_template::new_key_offset): Align all
+ strings, even zero-length.
+ (Stringpool_template::set_string_offsets): Likewise.
+
+2015-10-28 Marcin Kościelnicki <koriakin@0x04.net>
+
* s390.cc: New file.
* Makefile.am (TARGETSOURCES): Add s390.cc.
(ALL_TARGETOBJS): Add s390.o.
diff --git a/gold/stringpool.cc b/gold/stringpool.cc
index d6fd715..595b1c7 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,8 @@ 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,