Fix empty string alignment in .rodata.str*
authorMarcin Kościelnicki <koriakin@0x04.net>
Mon, 5 Oct 2015 14:57:14 +0000 (16:57 +0200)
committerCary Coutant <ccoutant@gmail.com>
Wed, 28 Oct 2015 23:48:16 +0000 (16:48 -0700)
gold/
PR gold/18959
* stringpool.cc (Stringpool_template::new_key_offset): Align all
strings, even zero-length.
(Stringpool_template::set_string_offsets):

gold/ChangeLog
gold/stringpool.cc

index 23d64ed32487301e2a909b77cba0f9b4457b239f..71bee61cf01f9df418e7e92c182d0e246f6b6046 100644 (file)
@@ -1,3 +1,10 @@
+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.
index d6fd7157bf0fbd53b21111dc7006a7343af2a26d..595b1c74d5765f77a2cbc95705db94c9af32b939 100644 (file)
@@ -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,
This page took 0.031851 seconds and 4 git commands to generate.