summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2017-08-18 19:13:56 +0000
committerTim Northover <tnorthover@apple.com>2017-08-18 19:13:56 +0000
commit14302fcb247673fe3a5a9b2b18dbb3e93de12ba7 (patch)
tree89ad453a40ac95fd5239df6be23a9d78fb61417c /llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
parent5c7fc76983f609894c1b24f6c03195a5db00d718 (diff)
downloadbcm5719-llvm-14302fcb247673fe3a5a9b2b18dbb3e93de12ba7.tar.gz
bcm5719-llvm-14302fcb247673fe3a5a9b2b18dbb3e93de12ba7.zip
ARM: use an external relocation for calls from MachO ARM mode.
The internal (__text-relative) relocation risks the offset not being encodable if the destination is Thumb. llvm-svn: 311187
Diffstat (limited to 'llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp')
-rw-r--r--llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
index 4a8139dea66..6f0372c9019 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
@@ -322,11 +322,10 @@ bool ARMMachObjectWriter::requiresExternRelocation(MachObjectWriter *Writer,
default:
return false;
case MachO::ARM_RELOC_BR24:
- // PC pre-adjustment of 8 for these instructions.
- Value -= 8;
- // ARM BL/BLX has a 25-bit offset.
- Range = 0x1ffffff;
- break;
+ // An ARM call might be to a Thumb function, in which case the offset may
+ // not be encodable in the instruction and we must use an external
+ // relocation that explicitly mentions the function.
+ return true;
case MachO::ARM_THUMB_RELOC_BR22:
// PC pre-adjustment of 4 for these instructions.
Value -= 4;
OpenPOWER on IntegriCloud