Restore empty string handling
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 1 May 2013 19:45:27 +0000 (19:45 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 1 May 2013 19:45:27 +0000 (19:45 +0000)
* merge.cc (Output_merge_string<Char_type>::do_add_input_section):
Restore empty string handling.

gold/ChangeLog
gold/merge.cc

index a6f3d5985418e2cc2d9f7b4f8768a4f09103d01b..164da85b7d82e01b1f2d1798be6f2042184b0795 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
+       Restore empty string handling.
+
 2013-05-01  Cary Coutant  <ccoutant@google.com>
 
        * stringpool.cc (Stringpool_template::new_key_offset): Fix
index 6480bd933117fd690a52298133be1c292914737e..2d014629356619936ab4995c77718ac716bd2086 100644 (file)
@@ -565,18 +565,16 @@ Output_merge_string<Char_type>::do_add_input_section(Relobj* object,
     {
       size_t len = string_length(p);
 
-      if (len != 0)
-       {
-         // Within merge input section each string must be aligned.
-         if ((reinterpret_cast<uintptr_t>(p) & (this->addralign() - 1))
-             != init_align_modulo)
-           has_misaligned_strings = true;
+      // Within merge input section each string must be aligned.
+      if (len != 0
+         && ((reinterpret_cast<uintptr_t>(p) & (this->addralign() - 1))
+             != init_align_modulo))
+         has_misaligned_strings = true;
 
-         Stringpool::Key key;
-         this->stringpool_.add_with_length(p, len, true, &key);
+      Stringpool::Key key;
+      this->stringpool_.add_with_length(p, len, true, &key);
 
-         merged_strings.push_back(Merged_string(i, key));
-       }
+      merged_strings.push_back(Merged_string(i, key));
       p += len + 1;
       i += (len + 1) * sizeof(Char_type);
     }