aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/ARM/ARMFrameLowering.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-05-07 03:03:27 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-05-07 03:03:27 +0000
commitacd0338c61f6c9c7ea46501152ea40afae8e9386 (patch)
treea8156e93c18a1269abfa1121db3ab0c3cfb4faad /llvm/lib/Target/ARM/ARMFrameLowering.cpp
parentd968717126480d8fab681d4bf8ade59ba20b0ef7 (diff)
downloadllvm-acd0338c61f6c9c7ea46501152ea40afae8e9386.zip
llvm-acd0338c61f6c9c7ea46501152ea40afae8e9386.tar.gz
llvm-acd0338c61f6c9c7ea46501152ea40afae8e9386.tar.bz2
ARM: fix WoA PEI instruction selection
The ARM::BLX instruction is an ARM mode instruction. The Windows on ARM target is limited to Thumb instructions. Correctly use the thumb mode tBLXr instruction. This would manifest as an errant write into the object file as the instruction is 4-bytes in length rather than 2. The result would be a corrupted object file that would eventually result in an executable that would crash at runtime. llvm-svn: 208152
Diffstat (limited to 'llvm/lib/Target/ARM/ARMFrameLowering.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMFrameLowering.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMFrameLowering.cpp b/llvm/lib/Target/ARM/ARMFrameLowering.cpp
index 5a114a9..8da7fb8 100644
--- a/llvm/lib/Target/ARM/ARMFrameLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMFrameLowering.cpp
@@ -319,7 +319,8 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF) const {
BuildMI(MBB, MBBI, dl, TII.get(ARM::t2MOVi32imm), ARM::R12)
.addExternalSymbol("__chkstk");
- BuildMI(MBB, MBBI, dl, TII.get(ARM::BLX))
+ BuildMI(MBB, MBBI, dl, TII.get(ARM::tBLXr))
+ .addImm((unsigned)ARMCC::AL).addReg(0)
.addReg(ARM::R12, RegState::Kill)
.addReg(ARM::R4, RegState::Implicit);
break;