mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
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
This commit is contained in:
parent
e97fc44045
commit
671aea08f8
@ -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;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,8 @@ entry:
|
||||
; ARMv7: add [[reg2]], pc, [[reg2]]
|
||||
; ARMv7-ELF: LoadGV
|
||||
; ARMv7-ELF: ldr r[[reg2:[0-9]+]],
|
||||
; ARMv7-ELF: .LPC
|
||||
; ARMv7-ELF-NEXT: add r[[reg2]], pc
|
||||
; ARMv7-ELF: ldr r[[reg3:[0-9]+]],
|
||||
; ARMv7-ELF: ldr r[[reg2]], [r[[reg3]], r[[reg2]]]
|
||||
%tmp = load i32* @g
|
||||
@ -54,6 +56,8 @@ entry:
|
||||
; ARMv7: ldr r[[reg5]], [r[[reg5]]]
|
||||
; ARMv7-ELF: LoadIndirectSymbol
|
||||
; ARMv7-ELF: ldr r[[reg5:[0-9]+]],
|
||||
; ARMv7-ELF: .LPC
|
||||
; ARMv7-ELF-NEXT: add r[[reg5]], pc
|
||||
; ARMv7-ELF: ldr r[[reg6:[0-9]+]],
|
||||
; ARMv7-ELF: ldr r[[reg5]], [r[[reg6]], r[[reg5]]]
|
||||
%tmp = load i32* @i
|
||||
|
Loading…
Reference in New Issue
Block a user