[PATCH] D23157: [COFF][ARM] Error out if 24 bit thumb branches are out of range

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 4 02:12:50 PDT 2016


mstorsjo created this revision.
mstorsjo added reviewers: peter.smith, zatrazz.
mstorsjo added a subscriber: llvm-commits.
Herald added subscribers: samparker, rengolin, aemerson.

In the ELF linker, the same situation already errors out with "relocation R_ARM_THM_CALL out of range".



https://reviews.llvm.org/D23157

Files:
  COFF/Chunks.cpp

Index: COFF/Chunks.cpp
===================================================================
--- COFF/Chunks.cpp
+++ COFF/Chunks.cpp
@@ -114,6 +114,8 @@
   uint32_t S = V < 0 ? 1 : 0;
   uint32_t J1 = ((~V >> 23) & 1) ^ S;
   uint32_t J2 = ((~V >> 22) & 1) ^ S;
+  if (!isInt<25>(V))
+    fatal("relocation out of range");
   or16(Off, (S << 10) | ((V >> 12) & 0x3ff));
   // The J1 and J2 bits are set in the opcode already, so mask them out
   // before or'ing in the new bits.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23157.66773.patch
Type: text/x-patch
Size: 478 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160804/b758d871/attachment.bin>


More information about the llvm-commits mailing list