gas: NEWS: Add the RISC-V features for 2.39
[binutils-gdb.git] / gold / reloc.cc
index 7cd9f859e0d9973ac46b0fd383c61817cb44cd71..9cab05264171d23c2a155ca4a867546b23875a02 100644 (file)
@@ -1,6 +1,6 @@
 // reloc.cc -- relocate input files for gold.
 
-// Copyright (C) 2006-2020 Free Software Foundation, Inc.
+// Copyright (C) 2006-2022 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -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;