[lld] r328391 - Move a Repl access.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 23 16:55:49 PDT 2018


Author: rafael
Date: Fri Mar 23 16:55:49 2018
New Revision: 328391

URL: http://llvm.org/viewvc/llvm-project?rev=328391&view=rev
Log:
Move a Repl access.

Since SectionBase::getOutputSection handles ICF replaces and
SectionBase::getOffset was handling it in some cases, it is more
consistent to have getOffset always handle it.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/Symbols.cpp

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=328391&r1=328390&r2=328391&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Fri Mar 23 16:55:49 2018
@@ -142,9 +142,9 @@ uint64_t SectionBase::getOffset(uint64_t
     return Offset == uint64_t(-1) ? OS->Size : Offset;
   }
   case Regular:
-    return cast<InputSection>(this)->OutSecOff + Offset;
+    return cast<InputSection>(this->Repl)->OutSecOff + Offset;
   case Synthetic: {
-    auto *IS = cast<InputSection>(this);
+    auto *IS = cast<InputSection>(this->Repl);
     // For synthetic sections we treat offset -1 as the end of the section.
     return IS->OutSecOff + (Offset == uint64_t(-1) ? IS->getSize() : Offset);
   }

Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=328391&r1=328390&r2=328391&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Fri Mar 23 16:55:49 2018
@@ -56,7 +56,6 @@ static uint64_t getSymVA(const Symbol &S
     if (!IS)
       return D.Value;
 
-    IS = IS->Repl;
     uint64_t Offset = D.Value;
 
     // An object in an SHF_MERGE section might be referenced via a




More information about the llvm-commits mailing list