summaryrefslogtreecommitdiffstats
path: root/lld/COFF/Chunks.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2017-12-14 08:56:36 +0000
committerMartin Storsjo <martin@martin.st>2017-12-14 08:56:36 +0000
commit94d72b89d663e73e3178395e8a4f9bfafaff4b23 (patch)
tree87d32ee0be310b8025686214f7db763cf78ed735 /lld/COFF/Chunks.cpp
parent9603b8e3f5c49ec554513694ebcc495def3abf09 (diff)
downloadbcm5719-llvm-94d72b89d663e73e3178395e8a4f9bfafaff4b23.tar.gz
bcm5719-llvm-94d72b89d663e73e3178395e8a4f9bfafaff4b23.zip
[COFF] Error out if 20 bit thumb branches are out of range
This is similar to what was added in SVN r277838 for 24 bit branch instructions. Differential Revision: https://reviews.llvm.org/D41163 llvm-svn: 320677
Diffstat (limited to 'lld/COFF/Chunks.cpp')
-rw-r--r--lld/COFF/Chunks.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp
index df98a041cd5..557b0265442 100644
--- a/lld/COFF/Chunks.cpp
+++ b/lld/COFF/Chunks.cpp
@@ -129,6 +129,8 @@ void applyMOV32T(uint8_t *Off, uint32_t V) {
}
static void applyBranch20T(uint8_t *Off, int32_t V) {
+ if (!isInt<21>(V))
+ fatal("relocation out of range");
uint32_t S = V < 0 ? 1 : 0;
uint32_t J1 = (V >> 19) & 1;
uint32_t J2 = (V >> 18) & 1;
OpenPOWER on IntegriCloud