summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/MCTargetDesc
diff options
context:
space:
mode:
authorPrakhar Bahuguna <prakhar.bahuguna@arm.com>2016-08-16 10:41:56 +0000
committerPrakhar Bahuguna <prakhar.bahuguna@arm.com>2016-08-16 10:41:56 +0000
commita27c4a0e66e3f5c514baa6dafd6a8b1925a0d470 (patch)
tree046846031cf2d5f344bd10e2b614cda4d2b1eade /llvm/lib/Target/ARM/MCTargetDesc
parent15ed7ec5aab8de283b2cfc9b674b5382024c1da1 (diff)
downloadbcm5719-llvm-a27c4a0e66e3f5c514baa6dafd6a8b1925a0d470.tar.gz
bcm5719-llvm-a27c4a0e66e3f5c514baa6dafd6a8b1925a0d470.zip
Correct the upper bound for a CBZ/CBNZ branch target.
Summary: Fix for the upper bound check that was causing a build failure. Reviewers: olista01, rengolin, t.p.northover Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D23501 llvm-svn: 278789
Diffstat (limited to 'llvm/lib/Target/ARM/MCTargetDesc')
-rw-r--r--llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
index 5ac2d65a89e..2c3214fe20e 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
@@ -578,8 +578,10 @@ unsigned ARMAsmBackend::adjustFixupValue(const MCFixup &Fixup, uint64_t Value,
// Offset by 4, and don't encode the low two bits.
return ((Value - 4) >> 2) & 0xff;
case ARM::fixup_arm_thumb_cb: {
- // CB instructions can only branch to offsets in [0, 126] in multiples of 2
- if (Ctx && ((int64_t)Value < 0 || Value > 0x3e || Value & 1)) {
+ // CB instructions can only branch to offsets in [4, 126] in multiples of 2
+ // so ensure that the raw value LSB is zero and it lies in [2, 130].
+ // An offset of 2 will be relaxed to a NOP.
+ if (Ctx && ((int64_t)Value < 2 || Value > 0x82 || Value & 1)) {
Ctx->reportError(Fixup.getLoc(), "out of range pc-relative fixup value");
return 0;
}
OpenPOWER on IntegriCloud