aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/ARM/ARMAsmBackend.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2011-06-24 20:06:59 +0000
committerJim Grosbach <grosbach@apple.com>2011-06-24 20:06:59 +0000
commit8b45456700f1e156b0a14000124f274dfac86f14 (patch)
tree09ed6777054e44a385c08a38df4c09aaa3d2b29c /lib/Target/ARM/ARMAsmBackend.cpp
parent32e7abd0804de228c50d90e9ee43568c4316b624 (diff)
downloadexternal_llvm-8b45456700f1e156b0a14000124f274dfac86f14.zip
external_llvm-8b45456700f1e156b0a14000124f274dfac86f14.tar.gz
external_llvm-8b45456700f1e156b0a14000124f274dfac86f14.tar.bz2
ARM movw/movt fixups need to mask the high bits.
The fixup value comes in as the whole 32-bit value, so for the lo16 fixup, the upper bits need to be masked off. Previously we assumed the masking had already been done and asserted. rdar://9635991 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133818 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMAsmBackend.cpp')
-rw-r--r--lib/Target/ARM/ARMAsmBackend.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Target/ARM/ARMAsmBackend.cpp b/lib/Target/ARM/ARMAsmBackend.cpp
index 79e9897..5e438a9 100644
--- a/lib/Target/ARM/ARMAsmBackend.cpp
+++ b/lib/Target/ARM/ARMAsmBackend.cpp
@@ -174,7 +174,8 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) {
Value >>= 16;
// Fallthrough
case ARM::fixup_t2_movw_lo16:
- case ARM::fixup_t2_movt_hi16_pcrel:
+ case ARM::fixup_t2_movt_hi16_pcrel: //FIXME: Shouldn't this be shifted like
+ // the other hi16 fixup?
case ARM::fixup_t2_movw_lo16_pcrel: {
unsigned Hi4 = (Value & 0xF000) >> 12;
unsigned i = (Value & 0x800) >> 11;
@@ -184,8 +185,10 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) {
// inst{26} = i;
// inst{14-12} = Mid3;
// inst{7-0} = Lo8;
- assert ((((int64_t)Value) >= -0x8000) && (((int64_t)Value) <= 0x7fff) &&
- "Out of range pc-relative fixup value!");
+ // The value comes in as the whole thing, not just the portion required
+ // for this fixup, so we need to mask off the bits not handled by this
+ // portion (lo vs. hi).
+ Value &= 0xffff;
Value = (Hi4 << 16) | (i << 26) | (Mid3 << 12) | (Lo8);
uint64_t swapped = (Value & 0xFFFF0000) >> 16;
swapped |= (Value & 0x0000FFFF) << 16;