PR28098 Skip R_*_NONE relocation entries with zero r_sym without counting
authorMichael Krasnyk <mkrasnyk@argo.ai>
Sat, 17 Jul 2021 15:35:56 +0000 (17:35 +0200)
committerAlan Modra <amodra@gmail.com>
Sun, 18 Jul 2021 12:34:36 +0000 (22:04 +0930)
PR gold/28098
* reloc.cc (Track_relocs::advance): Skip R_*_NONE relocation entries
with r_sym of zero without counting in advance method.

gold/ChangeLog
gold/reloc.cc
gold/reloc.h

index d37902b8d24ac1faafd151eb65b169e97a8456e8..6aba1e0e3ec5ca7c5f1a162ec6ab1674df6b4f76 100644 (file)
@@ -1,3 +1,9 @@
+2021-07-17  Michael Krasnyk  <michael.krasnyk@gmail.com>
+
+       PR gold/28098
+       * reloc.cc (Track_relocs::advance): Skip R_*_NONE relocation entries
+       with r_sym of zero without counting in advance method.
+
 2021-07-03  Nick Clifton  <nickc@redhat.com>
 
        * po/gold.pot: Regenerate.
index 34a836f4e6fcce4468c926a6ee652a47466fd418..82ec6cbcc05cd48913578828d8c7485a69189e70 100644 (file)
@@ -1602,7 +1602,10 @@ Track_relocs<size, big_endian>::advance(off_t offset)
       elfcpp::Rel<size, big_endian> rel(this->prelocs_ + this->pos_);
       if (static_cast<off_t>(rel.get_r_offset()) >= offset)
        break;
-      ++ret;
+      // Skip R_*_NONE relocation entries with r_sym of zero
+      // without counting.
+      if (rel.get_r_info() != 0)
+       ++ret;
       this->pos_ += this->reloc_size_;
     }
   return ret;
index 5f1d382a70766bd9f0449a212ce3b1d3c9938ca7..773e79bdb7b162ef9b9c0eb9a18f9ec968a3c1c5 100644 (file)
@@ -1171,7 +1171,7 @@ class Track_relocs
   next_addend() const;
 
   // Advance to OFFSET within the data section, and return the number
-  // of relocs which would be skipped.
+  // of relocs which would be skipped, excluding r_info==0 relocs.
   int
   advance(off_t offset);