diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-10-29 23:55:43 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-10-29 23:55:43 +0000 |
commit | 19d64ba8bf11aa213fbe2a5e54e2d2c57411ab60 (patch) | |
tree | 73d96ce8dd31aa5faa50d9bc1857c0fe29e3d454 /llvm/lib/Target/ARM/ARMJITInfo.cpp | |
parent | de9dbc5584d73584e0c766d8b11780c8d0061ecd (diff) | |
download | bcm5719-llvm-19d64ba8bf11aa213fbe2a5e54e2d2c57411ab60.tar.gz bcm5719-llvm-19d64ba8bf11aa213fbe2a5e54e2d2c57411ab60.zip |
Correct way to handle CONSTPOOL_ENTRY instructions.
llvm-svn: 58409
Diffstat (limited to 'llvm/lib/Target/ARM/ARMJITInfo.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMJITInfo.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMJITInfo.cpp b/llvm/lib/Target/ARM/ARMJITInfo.cpp index 3c50caaf6d0..6a2c253ff11 100644 --- a/llvm/lib/Target/ARM/ARMJITInfo.cpp +++ b/llvm/lib/Target/ARM/ARMJITInfo.cpp @@ -174,8 +174,14 @@ void ARMJITInfo::relocate(void *Function, MachineRelocation *MR, unsigned NumRelocs, unsigned char* GOTBase) { for (unsigned i = 0; i != NumRelocs; ++i, ++MR) { void *RelocPos = (char*)Function + MR->getMachineCodeOffset(); - intptr_t ResultPtr = (intptr_t)MR->getResultPointer(); + ARM::RelocationType RT = (ARM::RelocationType)MR->getRelocationType(); + // If this is a constpool relocation, get the address of the + // constpool_entry instruction. + intptr_t ResultPtr = (RT == ARM::reloc_arm_cp_entry) + ? getConstantPoolEntryAddr(MR->getConstantPoolIndex()) + : (intptr_t)MR->getResultPointer(); switch ((ARM::RelocationType)MR->getRelocationType()) { + case ARM::reloc_arm_cp_entry: case ARM::reloc_arm_relative: { // It is necessary to calculate the correct PC relative value. We // subtract the base addr from the target addr to form a byte offset. @@ -195,6 +201,10 @@ void ARMJITInfo::relocate(void *Function, MachineRelocation *MR, *((unsigned*)RelocPos) |= 0xF << 16; break; } + case ARM::reloc_arm_absolute: { + *((unsigned*)RelocPos) += (unsigned)ResultPtr; + break; + } case ARM::reloc_arm_branch: { // It is necessary to calculate the correct value of signed_immed_24 // field. We subtract the base addr from the target addr to form a |