[lld] r330307 - Simplify. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 18 20:51:26 PDT 2018


Author: rafael
Date: Wed Apr 18 20:51:26 2018
New Revision: 330307

URL: http://llvm.org/viewvc/llvm-project?rev=330307&view=rev
Log:
Simplify. NFC.

Using getOffset is here was a bit of an overkill. This is being
written and has relocations. This implies it is a .eh_frame or regular
section.

Modified:
    lld/trunk/ELF/InputSection.cpp

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=330307&r1=330306&r2=330307&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Wed Apr 18 20:51:26 2018
@@ -710,7 +710,9 @@ void InputSectionBase::relocateAlloc(uin
   const unsigned Bits = Config->Wordsize * 8;
 
   for (const Relocation &Rel : Relocations) {
-    uint64_t Offset = getOffset(Rel.Offset);
+    uint64_t Offset = Rel.Offset;
+    if (auto *Sec = dyn_cast<InputSection>(this))
+      Offset += Sec->OutSecOff;
     uint8_t *BufLoc = Buf + Offset;
     RelType Type = Rel.Type;
 




More information about the llvm-commits mailing list