[PATCH] [PECOFF] Relocations now take into account the address which is stored at the relocation site

Ron Ofir ron.ofir at gmail.com
Fri Jul 26 12:12:57 PDT 2013


Hi ruiu,

Fixed AtomChunk::applyRelocations to use the offset which is already stored at the relocation site when applying relocations.

http://llvm-reviews.chandlerc.com/D1229

Files:
  WriterPECOFF.cpp

Index: WriterPECOFF.cpp
===================================================================
--- WriterPECOFF.cpp
+++ WriterPECOFF.cpp
@@ -290,6 +290,8 @@
         auto relocSite = reinterpret_cast<ulittle32_t *>(
             fileBuffer + layout->_fileOffset + ref->offsetInAtom());
         uint64_t targetAddr = atomRva[ref->target()];
+        // Also account for whatever offset is already stored at the relocation site
+        targetAddr += *relocSite;
 
         // Skip if this reference is not for relocation.
         if (ref->kind() < lld::Reference::kindTargetLow)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1229.1.patch
Type: text/x-patch
Size: 577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130726/4aa21e2d/attachment.bin>


More information about the llvm-commits mailing list