summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-08-16 12:52:08 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-08-16 12:52:08 +0000
commit671aea08f8dfb09a0191e7b9e266c2884efd3252 (patch)
treef7281df97d7c9ec5ce846ce619b519b8b0613a0a /lib
parente97fc44045732de9fc4715241013f9238ec007dc (diff)
downloadllvm-671aea08f8dfb09a0191e7b9e266c2884efd3252.tar.gz
llvm-671aea08f8dfb09a0191e7b9e266c2884efd3252.tar.bz2
llvm-671aea08f8dfb09a0191e7b9e266c2884efd3252.tar.xz
When initializing the PIC global base register on ARM/ELF add pc to fix the address.
This unbreaks PIC with fast isel on ELF targets (PR16717). The output matches what GCC and SDag do for PIC but may not cover all of the many flavors of PIC that exist. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188551 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/ARM/ARMInstrInfo.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMInstrInfo.cpp b/lib/Target/ARM/ARMInstrInfo.cpp
index 8cdb85369f..868dd47743 100644
--- a/lib/Target/ARM/ARMInstrInfo.cpp
+++ b/lib/Target/ARM/ARMInstrInfo.cpp
@@ -130,6 +130,10 @@ namespace {
MIB.addImm(0);
AddDefaultPred(MIB);
+ // Fix the GOT address by adding pc.
+ BuildMI(FirstMBB, MBBI, DL, TII.get(ARM::tPICADD), GlobalBaseReg)
+ .addReg(GlobalBaseReg).addImm(ARMPCLabelIndex);
+
return true;
}