Preliminary PIC JIT support for X86 (32-bit) / Darwin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45313 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng
2007-12-22 09:40:20 +00:00
parent a9ab846669
commit aabe38bf0c
5 changed files with 89 additions and 65 deletions

View File

@@ -437,7 +437,14 @@ void X86JITInfo::relocate(void *Function, MachineRelocation *MR,
case X86::reloc_pcrel_word: {
// PC relative relocation, add the relocated value to the value already in
// memory, after we adjust it for where the PC is.
ResultPtr = ResultPtr-(intptr_t)RelocPos-4-MR->getConstantVal();
ResultPtr = ResultPtr -(intptr_t)RelocPos - 4 - MR->getConstantVal();
*((unsigned*)RelocPos) += (unsigned)ResultPtr;
break;
}
case X86::reloc_picrel_word: {
// PIC base relative relocation, add the relocated value to the value
// already in memory, after we adjust it for where the PIC base is.
ResultPtr = ResultPtr - ((intptr_t)Function + MR->getConstantVal());
*((unsigned*)RelocPos) += (unsigned)ResultPtr;
break;
}