[PATCH] D38020: [COFF] Adjust secrel limit assertion

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 19:48:10 PDT 2017


smeenai created this revision.

According to Microsoft's PE/COFF documentation, a SECREL relocation is
"The 32-bit offset of the target from the beginning of its section". By
my reading, the "from the beginning of its section" implies that the
offset is unsigned. Adjust the assertion accordingly.


https://reviews.llvm.org/D38020

Files:
  COFF/Chunks.cpp


Index: COFF/Chunks.cpp
===================================================================
--- COFF/Chunks.cpp
+++ COFF/Chunks.cpp
@@ -62,7 +62,7 @@
     fatal("SECREL relocation cannot be applied to absolute symbols");
   }
   uint64_t SecRel = S - OS->getRVA();
-  assert(SecRel < INT32_MAX && "overflow in SECREL relocation");
+  assert(SecRel < UINT32_MAX && "overflow in SECREL relocation");
   add32(Off, SecRel);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38020.115779.patch
Type: text/x-patch
Size: 425 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170919/4c0c5d18/attachment.bin>


More information about the llvm-commits mailing list